Class: Io::Flow::V0::Models::Dimensions

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

Returns a new instance of Dimensions.



39876
39877
39878
39879
39880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39876

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @product = (x = opts.delete(:product); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Dimension) ? x : ::Io::Flow::V0::Models::Dimension.new(x)))
  @packaging = (x = opts.delete(:packaging); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Dimension) ? x : ::Io::Flow::V0::Models::Dimension.new(x)))
end

Instance Attribute Details

#packagingObject (readonly)

Returns the value of attribute packaging.



39874
39875
39876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39874

def packaging
  @packaging
end

#productObject (readonly)

Returns the value of attribute product.



39874
39875
39876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39874

def product
  @product
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39886
39887
39888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39886

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

#to_hashObject



39890
39891
39892
39893
39894
39895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39890

def to_hash
  {
    :product => product.nil? ? nil : product.to_hash,
    :packaging => packaging.nil? ? nil : packaging.to_hash
  }
end

#to_jsonObject



39882
39883
39884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39882

def to_json
  JSON.dump(to_hash)
end