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.
-
#deck_faction(type) ⇒ String
Return’s the deck overlord (hero) type faction.
-
#deck_strong_against(type) ⇒ String
Return’s the deck overlord (hero) faction weakness.
-
#deck_weak_against(type) ⇒ String
Return’s the deck overlord (hero) faction weakness.
Instance Method Details
#all_decks(**args) ⇒ Enumerator
Returns an enumerator for all available decks, accepts a block for yields
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/zombie_battleground/api/extensions/decks.rb', line 37 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 |
#deck_faction(type) ⇒ String
Return’s the deck overlord (hero) type faction
65 66 67 |
# File 'lib/zombie_battleground/api/extensions/decks.rb', line 65 def deck_faction(type) load_decks_data['overlord_types'][type] end |
#deck_strong_against(type) ⇒ String
Return’s the deck overlord (hero) faction weakness
95 96 97 |
# File 'lib/zombie_battleground/api/extensions/decks.rb', line 95 def deck_strong_against(type) load_decks_data['strong_against'][load_decks_data['overlord_types'][type]] end |
#deck_weak_against(type) ⇒ String
Return’s the deck overlord (hero) faction weakness
80 81 82 |
# File 'lib/zombie_battleground/api/extensions/decks.rb', line 80 def deck_weak_against(type) load_decks_data['weak_against'][load_decks_data['overlord_types'][type]] end |