Module: ZombieBattleground::Api::Extensions::Decks
- Included in:
- ZombieBattleground::Api::Extensions
- Defined in:
- lib/zombie_battleground/api/extensions/decks.rb
Overview
API Extensions for Decks
Instance Method Summary collapse
-
#all_decks(**args) ⇒ Enumerator
Returns an enumerator for all available decks, accepts a block for yields.
Instance Method Details
#all_decks(**args) ⇒ Enumerator
Returns an enumerator for all available decks, accepts a block for yields
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/zombie_battleground/api/extensions/decks.rb', line 35 def all_decks(**args) args.delete(:limit) # query as many as possible return enum_for(:all_decks, args) unless block_given? page = 1 loop do response = @client.decks_request(args.merge(page: page)) response.decks.each { |deck| yield deck } break if response.decks_count < PAGE_MAX # :nocov: page += 1 # :nocov: end end |