Class: Tremendous::OrganizationMember

Inherits:
Object
  • Object
show all
Defined in:
lib/tremendous/organization_member.rb

Class Method Summary collapse

Class Method Details

.create!(organization_id, data) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/tremendous/organization_member.rb', line 8

def self.create!(organization_id, data)
  response = Tremendous::Request.post(
    to_path(organization_id),
    body: data.merge(Tremendous.default_options).to_json,
    headers: { 'Content-Type' => 'application/json' }
  )

  response[:member]
end

.list(organization_id) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/tremendous/organization_member.rb', line 18

def self.list(organization_id)
  Tremendous::Request.get(
    to_path(organization_id),
    query: Tremendous.default_options,
    format: 'json'
  )[:members]
end

.to_path(organization_id) ⇒ Object



4
5
6
# File 'lib/tremendous/organization_member.rb', line 4

def self.to_path(organization_id)
  "organizations/#{organization_id}/members"
end