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.



50580
50581
50582
50583
50584
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50580

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.



50578
50579
50580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50578

def cart
  @cart
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50590
50591
50592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50590

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

#to_hashObject



50594
50595
50596
50597
50598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50594

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

#to_jsonObject



50586
50587
50588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50586

def to_json
  JSON.dump(to_hash)
end