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.
3259 3260 3261 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3259 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
3336 3337 3338 3339 3340 3341 3342 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3336 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
3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3263 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.
3304 3305 3306 3307 3308 3309 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3304 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
3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3311 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? ? "name" : 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
3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3289 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.
3281 3282 3283 3284 3285 3286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3281 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
3327 3328 3329 3330 3331 3332 3333 3334 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3327 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 |