Class: Io::Flow::V0::Clients::ShopifyCartConversions

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ShopifyCartConversions

Returns a new instance of ShopifyCartConversions.



7171
7172
7173
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7171

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

Instance Method Details

#post_conversions(organization, experience_key, io_flow_shopify_external_v0_models_shopify_external_cart, incoming = {}) ⇒ Object

Creates a shopify cart conversion from a shopify cart



7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7176

def post_conversions(organization, experience_key, io_flow_shopify_external_v0_models_shopify_external_cart, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) }),
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = io_flow_shopify_external_v0_models_shopify_external_cart; x.is_a?(::Io::Flow::Shopify::External::V0::Models::ShopifyExternalCart) ? x : ::Io::Flow::Shopify::External::V0::Models::ShopifyExternalCart.new(x))
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/shopify/cart/conversions").with_query(query).with_json(io_flow_shopify_external_v0_models_shopify_external_cart.to_json).post
  ::Io::Flow::V0::Models::ShopifyCartConversion.new(r)
end