Class: Io::Flow::V0::Models::ShopifyCartConversionShopifyCart

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyCartConversionShopifyCart

Returns a new instance of ShopifyCartConversionShopifyCart.



59827
59828
59829
59830
59831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59827

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:cart], 'ShopifyCartConversionShopifyCart')
  @cart = (x = opts.delete(:cart); x.is_a?(::Io::Flow::Shopify::External::V0::Models::ShopifyExternalCart) ? x : ::Io::Flow::Shopify::External::V0::Models::ShopifyExternalCart.new(x))
end

Instance Attribute Details

#cartObject (readonly)

Returns the value of attribute cart.



59825
59826
59827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59825

def cart
  @cart
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



59837
59838
59839
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59837

def copy(incoming={})
  ShopifyCartConversionShopifyCart.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



59841
59842
59843
59844
59845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59841

def to_hash
  {
    :cart => cart.to_hash
  }
end

#to_jsonObject



59833
59834
59835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59833

def to_json
  JSON.dump(to_hash)
end