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.



37238
37239
37240
37241
37242
37243
37244
37245
37246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37238

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.



37236
37237
37238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37236

def certifier
  @certifier
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



37236
37237
37238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37236

def effective_at
  @effective_at
end

#producerObject (readonly)

Returns the value of attribute producer.



37236
37237
37238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37236

def producer
  @producer
end

#statusObject (readonly)

Returns the value of attribute status.



37236
37237
37238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37236

def status
  @status
end

#trade_agreementObject (readonly)

Returns the value of attribute trade_agreement.



37236
37237
37238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37236

def trade_agreement
  @trade_agreement
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37252
37253
37254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37252

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

#to_hashObject



37256
37257
37258
37259
37260
37261
37262
37263
37264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37256

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



37248
37249
37250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37248

def to_json
  JSON.dump(to_hash)
end