Class: Io::Flow::V0::Clients::CheckoutTokens
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::CheckoutTokens
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_checkout_and_tokens_by_id(id) ⇒ Object
- #get_checkout_and_tokens_by_id(id) ⇒ Object
-
#initialize(client) ⇒ CheckoutTokens
constructor
A new instance of CheckoutTokens.
- #post_checkout_and_tokens_by_organization(organization, checkout_token_form, incoming = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ CheckoutTokens
Returns a new instance of CheckoutTokens.
5583 5584 5585 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5583 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_checkout_and_tokens_by_id(id) ⇒ Object
5593 5594 5595 5596 5597 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5593 def delete_checkout_and_tokens_by_id(id) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/checkout/tokens/#{CGI.escape(id)}").delete nil end |
#get_checkout_and_tokens_by_id(id) ⇒ Object
5587 5588 5589 5590 5591 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5587 def get_checkout_and_tokens_by_id(id) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/checkout/tokens/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::CheckoutToken.new(r) end |
#post_checkout_and_tokens_by_organization(organization, checkout_token_form, incoming = {}) ⇒ Object
5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5599 def post_checkout_and_tokens_by_organization(organization, checkout_token_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = checkout_token_form; x.is_a?(::Io::Flow::V0::Models::CheckoutTokenForm) ? x : ::Io::Flow::V0::Models::CheckoutTokenForm.from_json(x)) r = @client.request("/#{CGI.escape(organization)}/checkout/tokens").with_query(query).with_json(checkout_token_form.to_json).post ::Io::Flow::V0::Models::CheckoutToken.new(r) end |