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.



6879
6880
6881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6879

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_cart, incoming = {}) ⇒ Object

Creates a shopify cart conversion from a shopify cart



6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6884

def post_conversions(organization, experience_key, io_flow_shopify_external_v0_models_shopify_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) })
  }.delete_if { |k, v| v.nil? }
  (x = io_flow_shopify_external_v0_models_shopify_cart; x.is_a?(::Io::Flow::Shopify::External::V0::Models::ShopifyCart) ? x : ::Io::Flow::Shopify::External::V0::Models::ShopifyCart.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_cart.to_json).post
  ::Io::Flow::V0::Models::ShopifyCartConversion.new(r)
end