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.



23057
23058
23059
23060
23061
23062
23063
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23057

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.



23055
23056
23057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23055

def dimensions
  @dimensions
end

#nameObject (readonly)

Returns the value of attribute name.



23055
23056
23057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23055

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



23055
23056
23057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23055

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23069
23070
23071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23069

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

#to_hashObject



23073
23074
23075
23076
23077
23078
23079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23073

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

#to_jsonObject



23065
23066
23067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23065

def to_json
  JSON.dump(to_hash)
end