Class: Spaceship::Portal::Invite

Inherits:
Spaceship::PortalBase show all
Defined in:
spaceship/lib/spaceship/portal/invite.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Methods inherited from Spaceship::PortalBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#createdString

Returns Invite creation date.

Returns:

  • (String)

    Invite creation date


19
20
21
# File 'spaceship/lib/spaceship/portal/invite.rb', line 19

def created
  @created
end

#email_addressString

Returns Recipient Email Address.

Returns:

  • (String)

    Recipient Email Address


13
14
15
# File 'spaceship/lib/spaceship/portal/invite.rb', line 13

def email_address
  @email_address
end

#expiresString

Returns Invite expiration date.

Returns:

  • (String)

    Invite expiration date


22
23
24
# File 'spaceship/lib/spaceship/portal/invite.rb', line 22

def expires
  @expires
end

#invite_idString

Returns Invite Id.

Returns:


7
8
9
# File 'spaceship/lib/spaceship/portal/invite.rb', line 7

def invite_id
  @invite_id
end

#inviter_nameString

Returns Inviter name.

Returns:


10
11
12
# File 'spaceship/lib/spaceship/portal/invite.rb', line 10

def inviter_name
  @inviter_name
end

#typeString

Returns Role (member, admin or agent).

Returns:

  • (String)

    Role (member, admin or agent)


16
17
18
# File 'spaceship/lib/spaceship/portal/invite.rb', line 16

def type
  @type
end

Class Method Details

.factory(attrs) ⇒ Object


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'spaceship/lib/spaceship/portal/invite.rb', line 34

def factory(attrs)
  begin
    attrs['dateCreated'] = Time.at(attrs['dateCreated'] / 1000).utc
  rescue NoMethodError
    # if attrs['dateCreated'] does not implement /
  rescue TypeError
    # if Time.at receives an invalid type
  end
  begin
    attrs['dateExpires'] = Time.at(attrs['dateExpires'] / 1000).utc
  rescue NoMethodError
  rescue TypeError
  end
  attrs['recipientRole'] = attrs['recipientRole'].downcase
  return self.new(attrs)
end