Sha256: 18f2aa869440e4ab99e62b1f318f0c84981b332ccaa039e6d1cab4e105c019d5
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Fulfillment module Resources module Organizations extend self 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 def find(organization_id, type_name = nil) request = ["organizations", organization_id, type_name].compact.join("/") response = Request.new(request).get response.body end def update(organization_id, type_name, data) response = Request.new( "organizations/#{organization_id}/#{type_name}", {data: data} ).post response.body end private def reformat_ids_to_include_type(ids, type) ids.each_with_object({}) do |id, obj| obj[id] = [type] obj end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fulfillment-api-1.1.9 | lib/fulfillment/resources/organizations.rb |