Class: Spaceship::Portal::Person

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

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance 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

#developer_statusString

Returns Developer status (active, inactive).

Returns:

  • (String)

    Developer status (active, inactive)



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

def developer_status
  @developer_status
end

#email_addressString

Returns Email Address.

Returns:



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

def email_address
  @email_address
end

#firstnameString

Returns First name.

Returns:



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

def firstname
  @firstname
end

#joinedString

Returns Joined Date.

Returns:



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

def joined
  @joined
end

#lastnameString

Returns Last name.

Returns:



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

def lastname
  @lastname
end

#person_idString

Returns Person Id.

Returns:



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

def person_id
  @person_id
end

#team_member_idString

Returns Id in Team scope.

Returns:

  • (String)

    Id in Team scope



25
26
27
# File 'spaceship/lib/spaceship/portal/person.rb', line 25

def team_member_id
  @team_member_id
end

#typeString

Returns Role (member, admin or agent).

Returns:

  • (String)

    Role (member, admin or agent)



28
29
30
# File 'spaceship/lib/spaceship/portal/person.rb', line 28

def type
  @type
end

Class Method Details

.factory(attrs) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'spaceship/lib/spaceship/portal/person.rb', line 49

def factory(attrs)
  begin
    attrs['dateJoined'] = Time.parse(attrs['dateJoined'])
  rescue TypeError
    # Raised if we start getting integer timestamps
  rescue ArgumentError
    # Raised if the string's format can't be parsed
  end
  return self.new(attrs)
end

Instance Method Details

#change_role(role) ⇒ Object



44
45
46
# File 'spaceship/lib/spaceship/portal/person.rb', line 44

def change_role(role)
  client.team_set_role(team_member_id, role)
end

#remove!Object



40
41
42
# File 'spaceship/lib/spaceship/portal/person.rb', line 40

def remove!
  client.team_remove_member!(team_member_id)
end