Class: Io::Flow::V0::Models::DimensionEstimateForm

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

Returns a new instance of DimensionEstimateForm.



26607
26608
26609
26610
26611
26612
26613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26607

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:q, :dimensions], 'DimensionEstimateForm')
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @dimensions = (x = opts.delete(:dimensions); x.is_a?(::Io::Flow::V0::Models::EstimatedDimensions) ? x : ::Io::Flow::V0::Models::EstimatedDimensions.new(x))
  @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer))
end

Instance Attribute Details

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



26605
26606
26607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26605

def dimensions
  @dimensions
end

#positionObject (readonly)

Returns the value of attribute position.



26605
26606
26607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26605

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



26605
26606
26607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26605

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26619
26620
26621
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26619

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

#to_hashObject



26623
26624
26625
26626
26627
26628
26629
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26623

def to_hash
  {
    :q => q,
    :dimensions => dimensions.to_hash,
    :position => position
  }
end

#to_jsonObject



26615
26616
26617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26615

def to_json
  JSON.dump(to_hash)
end