Class: Io::Flow::V0::Models::OrderUpdateForm

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

Returns a new instance of OrderUpdateForm.



22269
22270
22271
22272
22273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22269

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @lines = (x = opts.delete(:lines); x.nil? ? nil : HttpClient::Preconditions.assert_class('lines', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderLineUpdateForm) ? x : ::Io::Flow::V0::Models::OrderLineUpdateForm.new(x)) })
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



22267
22268
22269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22267

def attributes
  @attributes
end

#linesObject (readonly)

Returns the value of attribute lines.



22267
22268
22269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22267

def lines
  @lines
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22279
22280
22281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22279

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

#to_hashObject



22283
22284
22285
22286
22287
22288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22283

def to_hash
  {
    :lines => lines.nil? ? nil : lines.map { |o| o.to_hash },
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



22275
22276
22277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22275

def to_json
  JSON.dump(to_hash)
end