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.



36602
36603
36604
36605
36606
36607
36608
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36602

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.



36600
36601
36602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36600

def dimensions
  @dimensions
end

#positionObject (readonly)

Returns the value of attribute position.



36600
36601
36602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36600

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



36600
36601
36602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36600

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



36614
36615
36616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36614

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

#to_hashObject



36618
36619
36620
36621
36622
36623
36624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36618

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

#to_jsonObject



36610
36611
36612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36610

def to_json
  JSON.dump(to_hash)
end