Class: Io::Flow::V0::Clients::Captures
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Captures
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_identifiers_by_key_and_identifier(organization, key, identifier) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
-
#get_by_key(organization, key) ⇒ Object
Returns information about a specific capture.
- #get_identifiers_by_key(organization, key, incoming = {}) ⇒ Object
-
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion.
-
#initialize(client) ⇒ Captures
constructor
A new instance of Captures.
-
#post(organization, capture_form) ⇒ Object
Create a new capture.
-
#put_identifiers_by_key_and_identifier(organization, key, identifier, identifier_form) ⇒ Object
Create a new identifier for this capture.
Constructor Details
#initialize(client) ⇒ Captures
Returns a new instance of Captures.
3090 3091 3092 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3090 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_identifiers_by_key_and_identifier(organization, key, identifier) ⇒ Object
3167 3168 3169 3170 3171 3172 3173 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3167 def delete_identifiers_by_key_and_identifier(organization, key, identifier) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('identifier', identifier, String) r = @client.request("/#{CGI.escape(organization)}/captures/#{CGI.escape(key)}/identifiers/#{CGI.escape(identifier)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3094 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) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }), :identifier => (x = opts.delete(:identifier); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifier', x, String)), :authorization_id => (x = opts.delete(:authorization_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('authorization_id', x, String)), :authorization_key => (x = opts.delete(:authorization_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('authorization_key', 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)}/captures").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Capture.new(x) } end |
#get_by_key(organization, key) ⇒ Object
Returns information about a specific capture.
3135 3136 3137 3138 3139 3140 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3135 def get_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/captures/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::Capture.new(r) end |
#get_identifiers_by_key(organization, key, incoming = {}) ⇒ Object
3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3142 def get_identifiers_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, 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) }), :identifier => (x = opts.delete(:identifier); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifier', 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)}/captures/#{CGI.escape(key)}/identifiers").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::CaptureIdentifier.new(x) } end |
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion
3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3120 def get_versions(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, Integer) }), :capture_id => (x = opts.delete(:capture_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('capture_id', x, Array).map { |v| HttpClient::Preconditions.assert_class('capture_id', v, 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? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/captures/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::CaptureVersion.new(x) } end |
#post(organization, capture_form) ⇒ Object
Create a new capture.
3112 3113 3114 3115 3116 3117 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3112 def post(organization, capture_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = capture_form; x.is_a?(::Io::Flow::V0::Models::CaptureForm) ? x : ::Io::Flow::V0::Models::CaptureForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/captures").with_json(capture_form.to_json).post ::Io::Flow::V0::Models::Capture.new(r) end |
#put_identifiers_by_key_and_identifier(organization, key, identifier, identifier_form) ⇒ Object
Create a new identifier for this capture
3158 3159 3160 3161 3162 3163 3164 3165 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3158 def put_identifiers_by_key_and_identifier(organization, key, identifier, identifier_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('identifier', identifier, String) (x = identifier_form; x.is_a?(::Io::Flow::V0::Models::IdentifierForm) ? x : ::Io::Flow::V0::Models::IdentifierForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/captures/#{CGI.escape(key)}/identifiers/#{CGI.escape(identifier)}").with_json(identifier_form.to_json).put ::Io::Flow::V0::Models::CaptureIdentifier.new(r) end |