Class: Io::Flow::V0::Models::DutyItemApproval

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ DutyItemApproval

Returns a new instance of DutyItemApproval.



40457
40458
40459
40460
40461
40462
40463
40464
40465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40457

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:status, :trade_agreement, :certifier, :producer, :effective_at], 'DutyItemApproval')
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::DutyItemApprovalStatus) ? x : ::Io::Flow::V0::Models::DutyItemApprovalStatus.apply(x))
  @trade_agreement = (x = opts.delete(:trade_agreement); x.is_a?(::Io::Flow::V0::Models::TradeAgreement) ? x : ::Io::Flow::V0::Models::TradeAgreement.new(x))
  @certifier = (x = opts.delete(:certifier); x.is_a?(::Io::Flow::V0::Models::TradeAgreementCertifier) ? x : ::Io::Flow::V0::Models::TradeAgreementCertifier.new(x))
  @producer = (x = opts.delete(:producer); x.is_a?(::Io::Flow::V0::Models::DutyItemProducer) ? x : ::Io::Flow::V0::Models::DutyItemProducer.new(x))
  @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime)
end

Instance Attribute Details

#certifierObject (readonly)

Returns the value of attribute certifier.



40455
40456
40457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40455

def certifier
  @certifier
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



40455
40456
40457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40455

def effective_at
  @effective_at
end

#producerObject (readonly)

Returns the value of attribute producer.



40455
40456
40457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40455

def producer
  @producer
end

#statusObject (readonly)

Returns the value of attribute status.



40455
40456
40457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40455

def status
  @status
end

#trade_agreementObject (readonly)

Returns the value of attribute trade_agreement.



40455
40456
40457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40455

def trade_agreement
  @trade_agreement
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40471
40472
40473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40471

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

#to_hashObject



40475
40476
40477
40478
40479
40480
40481
40482
40483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40475

def to_hash
  {
    :status => status.value,
    :trade_agreement => trade_agreement.to_hash,
    :certifier => certifier.to_hash,
    :producer => producer.to_hash,
    :effective_at => effective_at
  }
end

#to_jsonObject



40467
40468
40469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40467

def to_json
  JSON.dump(to_hash)
end