Module: Fulfillment::Resources::Organizations

Extended by:
Organizations
Included in:
Organizations
Defined in:
lib/fulfillment/resources/organizations.rb

Instance Method Summary collapse

Instance Method Details

#find(organization_id, type_name = nil) ⇒ Object



22
23
24
25
26
# File 'lib/fulfillment/resources/organizations.rb', line 22

def find(organization_id, type_name = nil)
  request = ["organizations", organization_id, type_name].compact.join("/")
  response = Request.new(request).get
  response.body
end

#find_all(params = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fulfillment/resources/organizations.rb', line 6

def find_all(params = {})
  limit_to_type = params["type"]
  request = "organizations"

  if limit_to_type
    request = ["types", limit_to_type, "organizations"].compact.join("/")
  end

  response = Request.new(request).get
  output = response.body

  output = reformat_ids_to_include_type(output, limit_to_type) if limit_to_type

  output
end

#update(organization_id, type_name, data) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/fulfillment/resources/organizations.rb', line 28

def update(organization_id, type_name, data)
  response = Request.new(
    "organizations/#{organization_id}/#{type_name}",
    {data: data}
  ).post
  response.body
end