Class: Io::Flow::V0::Models::Packaging

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Represents packaging available to ship items

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Packaging

Returns a new instance of Packaging.



17888
17889
17890
17891
17892
17893
17894
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17888

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:dimensions], 'Packaging')
  @dimensions = (x = opts.delete(:dimensions); x.is_a?(::Io::Flow::V0::Models::Dimensions) ? x : ::Io::Flow::V0::Models::Dimensions.new(x))
  @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String))
  @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String))
end

Instance Attribute Details

#dimensions ⇒ Object (readonly)

Returns the value of attribute dimensions.



17886
17887
17888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17886

def dimensions
  @dimensions
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



17886
17887
17888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17886

def name
  @name
end

#number ⇒ Object (readonly)

Returns the value of attribute number.



17886
17887
17888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17886

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17900
17901
17902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17900

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

#to_hash ⇒ Object



17904
17905
17906
17907
17908
17909
17910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17904

def to_hash
  {
    :dimensions => dimensions.to_hash,
    :name => name,
    :number => number
  }
end

#to_json ⇒ Object



17896
17897
17898
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17896

def to_json
  JSON.dump(to_hash)
end