Class: Io::Flow::V0::Models::QuoteEstimateForm

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

Returns a new instance of QuoteEstimateForm.



14910
14911
14912
14913
14914
14915
14916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14910

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:destination, :experience, :items], 'QuoteEstimateForm')
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @experience = HttpClient::Preconditions.assert_class('experience', opts.delete(:experience), String)
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) }
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



14908
14909
14910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14908

def destination
  @destination
end

#experienceObject (readonly)

Returns the value of attribute experience.



14908
14909
14910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14908

def experience
  @experience
end

#itemsObject (readonly)

Returns the value of attribute items.



14908
14909
14910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14908

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14922
14923
14924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14922

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

#to_hashObject



14926
14927
14928
14929
14930
14931
14932
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14926

def to_hash
  {
    :destination => destination.to_hash,
    :experience => experience,
    :items => items.map { |o| o.to_hash }
  }
end

#to_jsonObject



14918
14919
14920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14918

def to_json
  JSON.dump(to_hash)
end