class Io::Flow::V0::Clients::ChannelOrganizations
Public Class Methods
new(client)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5940 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end
Public Instance Methods
delete_by_key(channel_id, key)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5982 def delete_by_key(channel_id, key) HttpClient::Preconditions.assert_class('channel_id', channel_id, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/channel/#{CGI.escape(channel_id)}/organizations/#{CGI.escape(key)}").delete nil end
get(channel_id, incoming={})
click to toggle source
Returns
the list of organizations in a channel, channel is identified by id
# File lib/flow_commerce/flow_api_v0_client.rb, line 5945 def get(channel_id, incoming={}) HttpClient::Preconditions.assert_class('channel_id', channel_id, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }), :organization_id => (x = opts.delete(:organization_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('organization_id', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "name" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/channel/#{CGI.escape(channel_id)}/organizations").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ChannelOrganization.new(x) } end
get_by_key(channel_id, key)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5967 def get_by_key(channel_id, key) HttpClient::Preconditions.assert_class('channel_id', channel_id, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/channel/#{CGI.escape(channel_id)}/organizations/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ChannelOrganization.new(r) end
post(channel_id, channel_organization_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5960 def post(channel_id, channel_organization_form) HttpClient::Preconditions.assert_class('channel_id', channel_id, String) (x = channel_organization_form; x.is_a?(::Io::Flow::V0::Models::ChannelOrganizationForm) ? x : ::Io::Flow::V0::Models::ChannelOrganizationForm.new(x)) r = @client.request("/channel/#{CGI.escape(channel_id)}/organizations").with_json(channel_organization_form.to_json).post ::Io::Flow::V0::Models::ChannelOrganization.new(r) end
put_by_key(channel_id, key, channel_organization_put_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 5974 def put_by_key(channel_id, key, channel_organization_put_form) HttpClient::Preconditions.assert_class('channel_id', channel_id, String) HttpClient::Preconditions.assert_class('key', key, String) (x = channel_organization_put_form; x.is_a?(::Io::Flow::V0::Models::ChannelOrganizationPutForm) ? x : ::Io::Flow::V0::Models::ChannelOrganizationPutForm.new(x)) r = @client.request("/channel/#{CGI.escape(channel_id)}/organizations/#{CGI.escape(key)}").with_json(channel_organization_put_form.to_json).put ::Io::Flow::V0::Models::ChannelOrganization.new(r) end