Class: Io::Flow::V0::Models::ShopifyCartRepresentation

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

Returns a new instance of ShopifyCartRepresentation.



45362
45363
45364
45365
45366
45367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45362

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

Instance Attribute Details

#flowObject (readonly)

Returns the value of attribute flow.



45360
45361
45362
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45360

def flow
  @flow
end

#shopifyObject (readonly)

Returns the value of attribute shopify.



45360
45361
45362
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45360

def shopify
  @shopify
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45373
45374
45375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45373

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

#to_hashObject



45377
45378
45379
45380
45381
45382
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45377

def to_hash
  {
    :flow => flow.to_hash,
    :shopify => shopify.to_hash
  }
end

#to_jsonObject



45369
45370
45371
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45369

def to_json
  JSON.dump(to_hash)
end