Class: Io::Flow::V0::Models::Packaging
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Packaging
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents packaging available to ship items
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Packaging
constructor
A new instance of Packaging.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Packaging
Returns a new instance of Packaging.
51754 51755 51756 51757 51758 51759 51760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51754 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.
51752 51753 51754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51752 def dimensions @dimensions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
51752 51753 51754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51752 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
51752 51753 51754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51752 def number @number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
51766 51767 51768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51766 def copy(incoming={}) Packaging.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
51770 51771 51772 51773 51774 51775 51776 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51770 def to_hash { :dimensions => dimensions.to_hash, :name => name, :number => number } end |
#to_json ⇒ Object
51762 51763 51764 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51762 def to_json JSON.dump(to_hash) end |