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.



40562
40563
40564
40565
40566
40567
40568
40569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40562

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.



40560
40561
40562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40560

def contact
  @contact
end

#keyObject (readonly)

Returns the value of attribute key.



40560
40561
40562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40560

def key
  @key
end

#locationObject (readonly)

Returns the value of attribute location.



40560
40561
40562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40560

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



40560
40561
40562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40560

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40575
40576
40577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40575

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

#to_hashObject



40579
40580
40581
40582
40583
40584
40585
40586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40579

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

#to_jsonObject



40571
40572
40573
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40571

def to_json
  JSON.dump(to_hash)
end