Class: Giftrocket::OrganizationMember
- Inherits:
-
Object
- Object
- Giftrocket::OrganizationMember
- Defined in:
- lib/giftrocket/organization_member.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invite_url ⇒ Object
Returns the value of attribute invite_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#role ⇒ Object
Returns the value of attribute role.
Class Method Summary collapse
- .create!(organization_id, data) ⇒ Object
- .list(organization_id) ⇒ Object
- .to_path(organization_id) ⇒ Object
Instance Method Summary collapse
-
#initialize(attributes) ⇒ OrganizationMember
constructor
A new instance of OrganizationMember.
Constructor Details
#initialize(attributes) ⇒ OrganizationMember
Returns a new instance of OrganizationMember.
6 7 8 9 10 11 12 13 |
# File 'lib/giftrocket/organization_member.rb', line 6 def initialize(attributes) attributes = attributes.with_indifferent_access self.id = attributes[:id] self.name = attributes[:name] self.email = attributes[:email] self.role = attributes[:role] self.invite_url = attributes[:invite_url] end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/giftrocket/organization_member.rb', line 4 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/giftrocket/organization_member.rb', line 4 def id @id end |
#invite_url ⇒ Object
Returns the value of attribute invite_url.
4 5 6 |
# File 'lib/giftrocket/organization_member.rb', line 4 def invite_url @invite_url end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/giftrocket/organization_member.rb', line 4 def name @name end |
#role ⇒ Object
Returns the value of attribute role.
4 5 6 |
# File 'lib/giftrocket/organization_member.rb', line 4 def role @role end |
Class Method Details
.create!(organization_id, data) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/giftrocket/organization_member.rb', line 19 def self.create!(organization_id, data) response = Giftrocket::Request.post( to_path(organization_id), body: data.merge(Giftrocket.).to_json, headers: { 'Content-Type' => 'application/json' } ) Giftrocket::OrganizationMember.new(response[:member]) end |
.list(organization_id) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/giftrocket/organization_member.rb', line 29 def self.list(organization_id) Giftrocket::Request.get( to_path(organization_id), query: Giftrocket., format: 'json' )[:members].map do |member| Giftrocket::OrganizationMember.new(member) end end |
.to_path(organization_id) ⇒ Object
15 16 17 |
# File 'lib/giftrocket/organization_member.rb', line 15 def self.to_path(organization_id) "organizations/#{organization_id}/members" end |