Class: Io::Flow::V0::Clients::CheckoutTokens

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CheckoutTokens



5067
5068
5069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5067

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



5077
5078
5079
5080
5081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5077

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



5071
5072
5073
5074
5075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5071

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) ⇒ Object



5083
5084
5085
5086
5087
5088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5083

def post_checkout_and_tokens_by_organization(organization, checkout_token_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = checkout_token_form; x.is_a?(::Io::Flow::V0::Models::CheckoutTokenForm) ? x : ::Io::Flow::V0::Models::CheckoutTokenForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/checkout/tokens").with_json(checkout_token_form.to_json).post
  ::Io::Flow::V0::Models::CheckoutToken.new(r)
end