Class: WorkOS::Invitation

Inherits:
Object
  • Object
show all
Includes:
HashProvider
Defined in:
lib/workos/invitation.rb

Overview

The Invitation class provides a lightweight wrapper around a WorkOS Invitation resource. This class is not meant to be instantiated in a user space, and is instantiated internally but exposed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(json) ⇒ Invitation

rubocop:disable Metrics/AbcSize



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/workos/invitation.rb', line 14

def initialize(json)
  hash = JSON.parse(json, symbolize_names: true)

  @id = hash[:id]
  @email = hash[:email]
  @state = hash[:state]
  @token = hash[:token]
  @accept_invitation_url = hash[:accept_invitation_url]
  @organization_id = hash[:organization_id]
  @inviter_user_id = hash[:inviter_user_id]
  @accepted_at = hash[:accepted_at]
  @revoked_at = hash[:revoked_at]
  @expires_at = hash[:expires_at]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#accept_invitation_urlObject

Returns the value of attribute accept_invitation_url.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def accept_invitation_url
  @accept_invitation_url
end

#accepted_atObject

Returns the value of attribute accepted_at.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def accepted_at
  @accepted_at
end

#created_atObject

Returns the value of attribute created_at.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def created_at
  @created_at
end

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def email
  @email
end

#expires_atObject

Returns the value of attribute expires_at.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def expires_at
  @expires_at
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def id
  @id
end

#inviter_user_idObject

Returns the value of attribute inviter_user_id.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def inviter_user_id
  @inviter_user_id
end

#organization_idObject

Returns the value of attribute organization_id.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def organization_id
  @organization_id
end

#revoked_atObject

Returns the value of attribute revoked_at.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def revoked_at
  @revoked_at
end

#stateObject

Returns the value of attribute state.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def state
  @state
end

#tokenObject

Returns the value of attribute token.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def token
  @token
end

#updated_atObject

Returns the value of attribute updated_at.



10
11
12
# File 'lib/workos/invitation.rb', line 10

def updated_at
  @updated_at
end

Instance Method Details

#to_jsonObject

rubocop:enable Metrics/AbcSize



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/workos/invitation.rb', line 32

def to_json(*)
  {
    id: id,
    email: email,
    state: state,
    token: token,
    accept_invitation_url: accept_invitation_url,
    organization_id: organization_id,
    inviter_user_id: inviter_user_id,
    accepted_at: accepted_at,
    revoked_at: revoked_at,
    expires_at: expires_at,
    created_at: created_at,
    updated_at: updated_at,
  }
end