class Io::Flow::V0::Clients::SyncRecords
Public Class Methods
new(client)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8701 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end
Public Instance Methods
delete_by_id(organization, id)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8763 def delete_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/sync/records/#{CGI.escape(id)}").delete nil end
delete_streams_and_systems_and_values_by_stream_key_and_system_and_value(organization, stream_key, system, value)
click to toggle source
Delete a value for a system for this stream.
# File lib/flow_commerce/flow_api_v0_client.rb, line 8739 def delete_streams_and_systems_and_values_by_stream_key_and_system_and_value(organization, stream_key, system, value) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('stream_key', stream_key, String) HttpClient::Preconditions.assert_class('system', system, String) HttpClient::Preconditions.assert_class('value', value, String) r = @client.request("/#{CGI.escape(organization)}/sync/records/streams/#{CGI.escape(stream_key)}/systems/#{CGI.escape(system)}/values/#{CGI.escape(value)}").delete nil end
get(organization, incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8705 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, 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) }), :stream_key => (x = opts.delete(:stream_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('stream_key', x, String)), :system => (x = opts.delete(:system); x.nil? ? nil : HttpClient::Preconditions.assert_class('system', x, String)), :value => (x = opts.delete(:value); x.nil? ? nil : HttpClient::Preconditions.assert_class('value', 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? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/sync/records").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::SyncRecord.new(x) } end
get_by_id(organization, id)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8748 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/sync/records/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::SyncRecord.new(r) end
post(organization, sync_record_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8721 def post(organization, sync_record_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = sync_record_form; x.is_a?(::Io::Flow::V0::Models::SyncRecordForm) ? x : ::Io::Flow::V0::Models::SyncRecordForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/sync/records").with_json(sync_record_form.to_json).post ::Io::Flow::V0::Models::SyncRecord.new(r) end
put_by_id(organization, id, sync_record_form)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 8755 def put_by_id(organization, id, sync_record_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = sync_record_form; x.is_a?(::Io::Flow::V0::Models::SyncRecordForm) ? x : ::Io::Flow::V0::Models::SyncRecordForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/sync/records/#{CGI.escape(id)}").with_json(sync_record_form.to_json).put ::Io::Flow::V0::Models::SyncRecord.new(r) end
put_streams_and_systems_and_values_by_stream_key_and_system_and_value(organization, stream_key, system, value)
click to toggle source
Idempotent method to upsert a value for a system for this stream.
# File lib/flow_commerce/flow_api_v0_client.rb, line 8729 def put_streams_and_systems_and_values_by_stream_key_and_system_and_value(organization, stream_key, system, value) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('stream_key', stream_key, String) HttpClient::Preconditions.assert_class('system', system, String) HttpClient::Preconditions.assert_class('value', value, String) r = @client.request("/#{CGI.escape(organization)}/sync/records/streams/#{CGI.escape(stream_key)}/systems/#{CGI.escape(system)}/values/#{CGI.escape(value)}").put ::Io::Flow::V0::Models::SyncRecord.new(r) end