Class: Io::Flow::V0::Models::ShopifyCartShopifyRepresentation

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 = {}) ⇒ ShopifyCartShopifyRepresentation



45390
45391
45392
45393
45394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45390

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

Instance Attribute Details

#cartObject (readonly)

Returns the value of attribute cart.



45388
45389
45390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45388

def cart
  @cart
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45400
45401
45402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45400

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

#to_hashObject



45404
45405
45406
45407
45408
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45404

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

#to_jsonObject



45396
45397
45398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45396

def to_json
  JSON.dump(to_hash)
end