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.



35453
35454
35455
35456
35457
35458
35459
35460
35461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35453

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.



35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35451

def certifier
  @certifier
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35451

def effective_at
  @effective_at
end

#producerObject (readonly)

Returns the value of attribute producer.



35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35451

def producer
  @producer
end

#statusObject (readonly)

Returns the value of attribute status.



35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35451

def status
  @status
end

#trade_agreementObject (readonly)

Returns the value of attribute trade_agreement.



35451
35452
35453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35451

def trade_agreement
  @trade_agreement
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35467
35468
35469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35467

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

#to_hashObject



35471
35472
35473
35474
35475
35476
35477
35478
35479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35471

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



35463
35464
35465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35463

def to_json
  JSON.dump(to_hash)
end