module Fulfillment::Resources::Organizations
Public Instance Methods
find(organization_id, type_name = nil)
click to toggle source
# 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 = {})
click to toggle source
# 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)
click to toggle source
# 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
Private Instance Methods
reformat_ids_to_include_type(ids, type)
click to toggle source
# File lib/fulfillment/resources/organizations.rb, line 38 def reformat_ids_to_include_type(ids, type) ids.each_with_object({}) do |id, obj| obj[id] = [type] obj end end