Class: Io::Flow::V0::Models::EstimatedDimensions

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

Returns a new instance of EstimatedDimensions.



31383
31384
31385
31386
31387
31388
31389
31390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31383

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:depth, :length, :weight, :width], 'EstimatedDimensions')
  @depth = (x = opts.delete(:depth); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
  @length = (x = opts.delete(:length); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
  @weight = (x = opts.delete(:weight); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
  @width = (x = opts.delete(:width); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
end

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



31381
31382
31383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31381

def depth
  @depth
end

#lengthObject (readonly)

Returns the value of attribute length.



31381
31382
31383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31381

def length
  @length
end

#weightObject (readonly)

Returns the value of attribute weight.



31381
31382
31383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31381

def weight
  @weight
end

#widthObject (readonly)

Returns the value of attribute width.



31381
31382
31383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31381

def width
  @width
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31396
31397
31398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31396

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

#to_hashObject



31400
31401
31402
31403
31404
31405
31406
31407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31400

def to_hash
  {
    :depth => depth.to_hash,
    :length => length.to_hash,
    :weight => weight.to_hash,
    :width => width.to_hash
  }
end

#to_jsonObject



31392
31393
31394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31392

def to_json
  JSON.dump(to_hash)
end