Class: Io::Flow::V0::Clients::SyncRecordFailures

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SyncRecordFailures

Returns a new instance of SyncRecordFailures.



8774
8775
8776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8774

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#delete_by_id(organization, id) ⇒ Object



8817
8818
8819
8820
8821
8822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8817

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/record/failures/#{CGI.escape(id)}").delete
  nil
end

#get(organization, incoming = {}) ⇒ Object



8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8778

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)),
    :value => (x = opts.delete(:value); x.nil? ? nil : HttpClient::Preconditions.assert_class('value', x, String)),
    :system => (x = opts.delete(:system); x.nil? ? nil : HttpClient::Preconditions.assert_class('system', x, String)),
    :reason => (x = opts.delete(:reason); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SyncRecordFailureReason) ? x : ::Io::Flow::V0::Models::SyncRecordFailureReason.apply(x)).value),
    :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/record/failures").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::SyncRecordFailure.new(x) }
end

#get_by_id(organization, id) ⇒ Object



8802
8803
8804
8805
8806
8807
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8802

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/record/failures/#{CGI.escape(id)}").get
  ::Io::Flow::V0::Models::SyncRecordFailure.new(r)
end

#post(organization, sync_record_failure_form) ⇒ Object



8795
8796
8797
8798
8799
8800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8795

def post(organization, sync_record_failure_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = sync_record_failure_form; x.is_a?(::Io::Flow::V0::Models::SyncRecordFailureForm) ? x : ::Io::Flow::V0::Models::SyncRecordFailureForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/sync/record/failures").with_json(sync_record_failure_form.to_json).post
  ::Io::Flow::V0::Models::SyncRecordFailure.new(r)
end

#put_by_id(organization, id, sync_record_failure_form) ⇒ Object



8809
8810
8811
8812
8813
8814
8815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8809

def put_by_id(organization, id, sync_record_failure_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = sync_record_failure_form; x.is_a?(::Io::Flow::V0::Models::SyncRecordFailureForm) ? x : ::Io::Flow::V0::Models::SyncRecordFailureForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/sync/record/failures/#{CGI.escape(id)}").with_json(sync_record_failure_form.to_json).put
  ::Io::Flow::V0::Models::SyncRecordFailure.new(r)
end