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.



29134
29135
29136
29137
29138
29139
29140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29134

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.



29132
29133
29134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29132

def dimensions
  @dimensions
end

#positionObject (readonly)

Returns the value of attribute position.



29132
29133
29134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29132

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



29132
29133
29134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29132

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29146
29147
29148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29146

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

#to_hashObject



29150
29151
29152
29153
29154
29155
29156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29150

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

#to_jsonObject



29142
29143
29144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29142

def to_json
  JSON.dump(to_hash)
end