Class: EwayRapid::InternalModels::BalancePerCardType

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

#balanceObject

Returns the value of attribute balance.



472
473
474
# File 'lib/eway_rapid/models/internal_models.rb', line 472

def balance
  @balance
end

#card_typeObject

Returns the value of attribute card_type.



468
469
470
# File 'lib/eway_rapid/models/internal_models.rb', line 468

def card_type
  @card_type
end

#creditObject

Returns the value of attribute credit.



470
471
472
# File 'lib/eway_rapid/models/internal_models.rb', line 470

def credit
  @credit
end

#debitObject

Returns the value of attribute debit.



471
472
473
# File 'lib/eway_rapid/models/internal_models.rb', line 471

def debit
  @debit
end

#number_of_transactionsObject

Returns the value of attribute number_of_transactions.



469
470
471
# File 'lib/eway_rapid/models/internal_models.rb', line 469

def number_of_transactions
  @number_of_transactions
end

Class Method Details

.from_array(array) ⇒ Object



489
490
491
492
493
494
495
496
# File 'lib/eway_rapid/models/internal_models.rb', line 489

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

.from_hash(hash) ⇒ Object



479
480
481
482
483
484
485
486
487
# File 'lib/eway_rapid/models/internal_models.rb', line 479

def self.from_hash(hash)
  balance = BalancePerCardType.new
  balance.card_type = hash[Constants::CARD_TYPE]
  balance.number_of_transactions = hash[Constants::NUMBER_OF_TRANSACTIONS]
  balance.credit = hash[Constants::CREDIT]
  balance.debit = hash[Constants::DEBIT]
  balance.balance = hash[Constants::BALANCE]
  balance
end

.from_json(json) ⇒ Object



474
475
476
477
# File 'lib/eway_rapid/models/internal_models.rb', line 474

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