Class: FluvPay::Resources::OffsetList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/fluvpay/resources/list_objects.rb

Overview

Página baseada em limit/offset (usada por withdrawals.list e internal_transfers.list). Expõe #data e os metadados limit, offset e total, exatamente como o backend retorna. Também é iterável.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ OffsetList

Returns a new instance of OffsetList.



52
53
54
55
56
57
58
# File 'lib/fluvpay/resources/list_objects.rb', line 52

def initialize(payload)
  payload ||= {}
  @data = payload["data"] || []
  @limit = payload["limit"]
  @offset = payload["offset"]
  @total = payload["total"]
end

Instance Attribute Details

#dataArray<Hash> (readonly)

Returns itens da página.

Returns:

  • (Array<Hash>)

    itens da página.



49
50
51
# File 'lib/fluvpay/resources/list_objects.rb', line 49

def data
  @data
end

#limitObject (readonly)

Returns the value of attribute limit.



50
51
52
# File 'lib/fluvpay/resources/list_objects.rb', line 50

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



50
51
52
# File 'lib/fluvpay/resources/list_objects.rb', line 50

def offset
  @offset
end

#totalObject (readonly)

Returns the value of attribute total.



50
51
52
# File 'lib/fluvpay/resources/list_objects.rb', line 50

def total
  @total
end

Instance Method Details

#each(&block) ⇒ Object



60
61
62
# File 'lib/fluvpay/resources/list_objects.rb', line 60

def each(&block)
  @data.each(&block)
end