Class: Io::Flow::V0::Models::OrderQuote

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

Returns a new instance of OrderQuote.



49051
49052
49053
49054
49055
49056
49057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49051

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :form], 'OrderQuote')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @form = (x = opts.delete(:form); x.is_a?(::Io::Flow::V0::Models::OrderQuotePutForm) ? x : ::Io::Flow::V0::Models::OrderQuotePutForm.new(x))
  @summary = (x = opts.delete(:summary); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummary) ? x : ::Io::Flow::V0::Models::OrderQuoteSummary.new(x)))
end

Instance Attribute Details

#formObject (readonly)

Returns the value of attribute form.



49049
49050
49051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49049

def form
  @form
end

#idObject (readonly)

Returns the value of attribute id.



49049
49050
49051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49049

def id
  @id
end

#summaryObject (readonly)

Returns the value of attribute summary.



49049
49050
49051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49049

def summary
  @summary
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49063
49064
49065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49063

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

#to_hashObject



49067
49068
49069
49070
49071
49072
49073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49067

def to_hash
  {
    :id => id,
    :form => form.to_hash,
    :summary => summary.nil? ? nil : summary.to_hash
  }
end

#to_jsonObject



49059
49060
49061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49059

def to_json
  JSON.dump(to_hash)
end