Class: Remitmd::TransactionList

Inherits:
Model
  • Object
show all
Defined in:
lib/remitmd/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#inspect, #to_h

Constructor Details

#initialize(attrs) ⇒ TransactionList

Returns a new instance of TransactionList.



429
430
431
432
433
434
435
436
437
# File 'lib/remitmd/models.rb', line 429

def initialize(attrs)
  h = attrs.transform_keys(&:to_s)
  items_raw = h["items"] || []
  @items    = items_raw.map { |tx| Transaction.new(tx) }
  @total    = h["total"].to_i
  @page     = (h["page"] || 1).to_i
  @per_page = (h["per_page"] || 50).to_i
  @has_more = h["has_more"] == true
end

Instance Attribute Details

#has_moreObject (readonly)

Returns the value of attribute has_more.



439
440
441
# File 'lib/remitmd/models.rb', line 439

def has_more
  @has_more
end

#itemsObject (readonly)

Returns the value of attribute items.



439
440
441
# File 'lib/remitmd/models.rb', line 439

def items
  @items
end

#pageObject (readonly)

Returns the value of attribute page.



439
440
441
# File 'lib/remitmd/models.rb', line 439

def page
  @page
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



439
440
441
# File 'lib/remitmd/models.rb', line 439

def per_page
  @per_page
end

#totalObject (readonly)

Returns the value of attribute total.



439
440
441
# File 'lib/remitmd/models.rb', line 439

def total
  @total
end