Class: Io::Flow::V0::Models::DutyItemProducer

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

Overview

Manufacturer of an item.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ DutyItemProducer

Returns a new instance of DutyItemProducer.



37343
37344
37345
37346
37347
37348
37349
37350
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37343

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :name, :location], 'DutyItemProducer')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @location = (x = opts.delete(:location); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @contact = (x = opts.delete(:contact); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Contact) ? x : ::Io::Flow::V0::Models::Contact.new(x)))
end

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



37341
37342
37343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37341

def contact
  @contact
end

#keyObject (readonly)

Returns the value of attribute key.



37341
37342
37343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37341

def key
  @key
end

#locationObject (readonly)

Returns the value of attribute location.



37341
37342
37343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37341

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



37341
37342
37343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37341

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37356
37357
37358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37356

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

#to_hashObject



37360
37361
37362
37363
37364
37365
37366
37367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37360

def to_hash
  {
    :key => key,
    :name => name,
    :location => location.to_hash,
    :contact => contact.nil? ? nil : contact.to_hash
  }
end

#to_jsonObject



37352
37353
37354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37352

def to_json
  JSON.dump(to_hash)
end