Class: EwayRapid::InternalModels::SettlementSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/models/internal_models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#balance_per_card_typeObject

Returns the value of attribute balance_per_card_type.



458
459
460
# File 'lib/eway_rapid/models/internal_models.rb', line 458

def balance_per_card_type
  @balance_per_card_type
end

#currencyObject

Returns the value of attribute currency.



453
454
455
# File 'lib/eway_rapid/models/internal_models.rb', line 453

def currency
  @currency
end

#currency_codeObject

Returns the value of attribute currency_code.



454
455
456
# File 'lib/eway_rapid/models/internal_models.rb', line 454

def currency_code
  @currency_code
end

#settlement_idObject

Returns the value of attribute settlement_id.



452
453
454
# File 'lib/eway_rapid/models/internal_models.rb', line 452

def settlement_id
  @settlement_id
end

#total_balanceObject

Returns the value of attribute total_balance.



457
458
459
# File 'lib/eway_rapid/models/internal_models.rb', line 457

def total_balance
  @total_balance
end

#total_creditObject

Returns the value of attribute total_credit.



455
456
457
# File 'lib/eway_rapid/models/internal_models.rb', line 455

def total_credit
  @total_credit
end

#total_debitObject

Returns the value of attribute total_debit.



456
457
458
# File 'lib/eway_rapid/models/internal_models.rb', line 456

def total_debit
  @total_debit
end

Class Method Details

.from_array(array) ⇒ Object



477
478
479
480
481
482
483
484
# File 'lib/eway_rapid/models/internal_models.rb', line 477

def self.from_array(array)
  summaries = []
  Array(array).each {|summary_hash|
    obj = from_hash(summary_hash)
    summaries.push(obj)
  }
  summaries
end

.from_hash(hash) ⇒ Object



465
466
467
468
469
470
471
472
473
474
475
# File 'lib/eway_rapid/models/internal_models.rb', line 465

def self.from_hash(hash)
  settlement_summary = SettlementSummary.new
  settlement_summary.settlement_id = hash[Constants::SETTLEMENT_ID]
  settlement_summary.currency = hash[Constants::CURRENCY]
  settlement_summary.currency_code = hash[Constants::CURRENCY_CODE]
  settlement_summary.total_credit = hash[Constants::TOTAL_CREDIT]
  settlement_summary.total_debit = hash[Constants::TOTAL_DEBIT]
  settlement_summary.total_balance = hash[Constants::TOTAL_BALANCE]
  settlement_summary.balance_per_card_type = BalancePerCardType.from_array(hash[Constants::BALANCE_PER_CARD_TYPE])
  settlement_summary
end

.from_json(json) ⇒ Object



460
461
462
463
# File 'lib/eway_rapid/models/internal_models.rb', line 460

def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end