class Giftrocket::OrganizationMember

Attributes

email[RW]
id[RW]
invite_url[RW]
name[RW]
role[RW]

Public Class Methods

create!(organization_id, data) click to toggle source
# 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.default_options).to_json,
    headers: { 'Content-Type' => 'application/json' }
  )

  Giftrocket::OrganizationMember.new(response[:member])
end
list(organization_id) click to toggle source
# File lib/giftrocket/organization_member.rb, line 29
def self.list(organization_id)
  Giftrocket::Request.get(
    to_path(organization_id),
    query: Giftrocket.default_options,
    format: 'json'
  )[:members].map do |member|
    Giftrocket::OrganizationMember.new(member)
  end
end
new(attributes) click to toggle source
# 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
to_path(organization_id) click to toggle source
# File lib/giftrocket/organization_member.rb, line 15
def self.to_path(organization_id)
  "organizations/#{organization_id}/members"
end