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.



11906
11907
11908
11909
11910
11911
11912
11913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11906

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.



11904
11905
11906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11904

def depth
  @depth
end

#diameterObject (readonly)

Returns the value of attribute diameter.



11904
11905
11906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11904

def diameter
  @diameter
end

#lengthObject (readonly)

Returns the value of attribute length.



11904
11905
11906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11904

def length
  @length
end

#weightObject (readonly)

Returns the value of attribute weight.



11904
11905
11906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11904

def weight
  @weight
end

#widthObject (readonly)

Returns the value of attribute width.



11904
11905
11906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11904

def width
  @width
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



11919
11920
11921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11919

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

#to_hashObject



11923
11924
11925
11926
11927
11928
11929
11930
11931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11923

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



11915
11916
11917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11915

def to_json
  JSON.dump(to_hash)
end