Class: RallyUp::Partner::User
- Inherits:
-
Object
- Object
- RallyUp::Partner::User
- Defined in:
- lib/rally_up/partner/user.rb
Instance Attribute Summary collapse
-
#added_date ⇒ Object
Returns the value of attribute added_date.
-
#created_date ⇒ Object
Returns the value of attribute created_date.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#role ⇒ Object
Returns the value of attribute role.
Class Method Summary collapse
- .create(organization_id, email, role = 'Administrator') ⇒ Object
- .delete(organization_id, email) ⇒ Object
- .list(organization_id) ⇒ Object
Instance Method Summary collapse
-
#initialize(json) ⇒ User
constructor
A new instance of User.
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_date ⇒ Object
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_date ⇒ Object
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 |
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/rally_up/partner/user.rb', line 6 def email @email end |
#first_name ⇒ Object
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 |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/rally_up/partner/user.rb', line 6 def id @id end |
#last_name ⇒ Object
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_id ⇒ Object
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 |
#role ⇒ Object
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 |