Class: RallyUp::Partner::User

Inherits:
Object
  • Object
show all
Defined in:
lib/rally_up/partner/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ User

Returns a new instance of User.



9
10
11
12
13
14
15
16
17
18
# File 'lib/rally_up/partner/user.rb', line 9

def initialize(json)
  @id = json[:UserID]
  @organization_id = json[:OrganizationID]
  @first_name = json[:FirstName]
  @last_name = json[:LastName]
  @email = json[:Email]
  @role = json[:Role]
  @created_date = json[:CreatedDate]
  @added_date = json[:AddedDate]
end

Instance Attribute Details

#added_dateObject

Returns the value of attribute added_date.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def added_date
  @added_date
end

#created_dateObject

Returns the value of attribute created_date.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def created_date
  @created_date
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def last_name
  @last_name
end

#organization_idObject

Returns the value of attribute organization_id.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def organization_id
  @organization_id
end

#roleObject

Returns the value of attribute role.



6
7
8
# File 'lib/rally_up/partner/user.rb', line 6

def role
  @role
end

Class Method Details

.create(organization_id, email, role = 'Administrator') ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rally_up/partner/user.rb', line 21

def create(organization_id, email, role = 'Administrator')
  json = RallyUp::Partner.json(:post, '/v1/partnerapi/addorguser', params: {
                                 OrganizationID: organization_id,
                                 Email: email,
                                 Role: role
                               })
  new(json[:Result].to_h)
end

.delete(organization_id, email) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rally_up/partner/user.rb', line 30

def delete(organization_id, email)
  json = RallyUp::Partner.json(:delete, '/v1/partnerapi/deleteorguser', params: {
                                 OrganizationID: organization_id,
                                 Email: email
                               })
  new(json[:Result].to_h)
end

.list(organization_id) ⇒ Object



38
39
40
41
# File 'lib/rally_up/partner/user.rb', line 38

def list(organization_id)
  json = RallyUp::Partner.json(:get, "/v1/partnerapi/listorgusers?OrganizationID=#{organization_id}")
  RallyUp::ListObject.new(json, self)
end