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.



52924
52925
52926
52927
52928
52929
52930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52924

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.



52922
52923
52924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52922

def form
  @form
end

#idObject (readonly)

Returns the value of attribute id.



52922
52923
52924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52922

def id
  @id
end

#summaryObject (readonly)

Returns the value of attribute summary.



52922
52923
52924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52922

def summary
  @summary
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52936
52937
52938
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52936

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

#to_hashObject



52940
52941
52942
52943
52944
52945
52946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52940

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

#to_jsonObject



52932
52933
52934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52932

def to_json
  JSON.dump(to_hash)
end