Class: XpensifySDK::Invoices::Result

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/xpensify_sdk/invoices/result.rb

Constant Summary collapse

BATCH_SIZE =
40

Instance Method Summary collapse

Constructor Details

#initialize(options, api_key, client) ⇒ Result

Returns a new instance of Result.



10
11
12
13
14
15
# File 'lib/xpensify_sdk/invoices/result.rb', line 10

def initialize(options, api_key, client)
  @options = options
  @api_key = api_key
  @client = client
  reset_cursors!
end

Instance Method Details

#eachObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/xpensify_sdk/invoices/result.rb', line 17

def each
  if block_given?
    while (element = read_from_page_or_fetch)
      yield element
    end
    reset_cursors!
  else
    to_enum(:each)
  end
end