Class: Io::Flow::V0::Models::DimensionEstimate

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

Returns a new instance of DimensionEstimate.



30325
30326
30327
30328
30329
30330
30331
30332
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30325

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :q, :dimensions, :position], 'DimensionEstimate')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @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 = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
end

Instance Attribute Details

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



30323
30324
30325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30323

def dimensions
  @dimensions
end

#idObject (readonly)

Returns the value of attribute id.



30323
30324
30325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30323

def id
  @id
end

#positionObject (readonly)

Returns the value of attribute position.



30323
30324
30325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30323

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



30323
30324
30325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30323

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30338
30339
30340
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30338

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

#to_hashObject



30342
30343
30344
30345
30346
30347
30348
30349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30342

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

#to_jsonObject



30334
30335
30336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30334

def to_json
  JSON.dump(to_hash)
end