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.



55961
55962
55963
55964
55965
55966
55967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55961

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

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



55959
55960
55961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55959

def dimensions
  @dimensions
end

#nameObject (readonly)

Returns the value of attribute name.



55959
55960
55961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55959

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



55959
55960
55961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55959

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



55973
55974
55975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55973

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

#to_hashObject



55977
55978
55979
55980
55981
55982
55983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55977

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

#to_jsonObject



55969
55970
55971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55969

def to_json
  JSON.dump(to_hash)
end