Class: Io::Flow::V0::Models::Dimension

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

Returns a new instance of Dimension.



17455
17456
17457
17458
17459
17460
17461
17462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17455

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @depth = (x = opts.delete(:depth); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x)))
  @diameter = (x = opts.delete(:diameter); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x)))
  @length = (x = opts.delete(:length); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x)))
  @weight = (x = opts.delete(:weight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x)))
  @width = (x = opts.delete(:width); x.nil? ? nil : (x = x; 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.



17453
17454
17455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17453

def depth
  @depth
end

#diameterObject (readonly)

Returns the value of attribute diameter.



17453
17454
17455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17453

def diameter
  @diameter
end

#lengthObject (readonly)

Returns the value of attribute length.



17453
17454
17455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17453

def length
  @length
end

#weightObject (readonly)

Returns the value of attribute weight.



17453
17454
17455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17453

def weight
  @weight
end

#widthObject (readonly)

Returns the value of attribute width.



17453
17454
17455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17453

def width
  @width
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17468
17469
17470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17468

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

#to_hashObject



17472
17473
17474
17475
17476
17477
17478
17479
17480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17472

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

#to_jsonObject



17464
17465
17466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17464

def to_json
  JSON.dump(to_hash)
end