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.



22058
22059
22060
22061
22062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22058

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.



22056
22057
22058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22056

def attributes
  @attributes
end

#linesObject (readonly)

Returns the value of attribute lines.



22056
22057
22058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22056

def lines
  @lines
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22068
22069
22070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22068

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

#to_hashObject



22072
22073
22074
22075
22076
22077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22072

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

#to_jsonObject



22064
22065
22066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22064

def to_json
  JSON.dump(to_hash)
end