Class: Io::Flow::V0::Models::ShopifyCartFlowRepresentation

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

Returns a new instance of ShopifyCartFlowRepresentation.



45270
45271
45272
45273
45274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45270

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

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



45268
45269
45270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45268

def order
  @order
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45280
45281
45282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45280

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

#to_hashObject



45284
45285
45286
45287
45288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45284

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

#to_jsonObject



45276
45277
45278
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45276

def to_json
  JSON.dump(to_hash)
end