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.



8439
8440
8441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8439

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



8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8444

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