Class: Tremendous::Organization::OrganizationResource

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/tremendous/organization.rb

Instance Method Summary collapse

Methods included from Request

#_execute, #access_token, #delete, #get, #handle_response, #initialize, #post, #put, #uri, #url

Instance Method Details

#create!(data) ⇒ Object



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

def create!(data)
  post(
    'organizations',
    body: data.to_json,
    headers: { 'Content-Type' => 'application/json' }
  )[:organization]
end

#create_access_token!(id, data = {}) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/tremendous/organization.rb', line 29

def create_access_token!(id, data={})
  post(
    "organizations/#{id}/access_token",
    body: data.to_json,
    headers: { 'Content-Type' => 'application/json' }
  )[:access_token]
end

#list(filters = {}) ⇒ Object



25
26
27
# File 'lib/tremendous/organization.rb', line 25

def list(filters={})
  get('organizations', query: filters)[:organizations]
end