Class: ZombieBattleground::Api

Inherits:
Object
  • Object
show all
Extended by:
Extensions
Defined in:
lib/zombie_battleground/api.rb,
lib/zombie_battleground/api/client.rb,
lib/zombie_battleground/api/errors.rb,
lib/zombie_battleground/api/version.rb,
lib/zombie_battleground/api/constants.rb,
lib/zombie_battleground/api/extensions.rb,
lib/zombie_battleground/api/models/card.rb,
lib/zombie_battleground/api/models/deck.rb,
lib/zombie_battleground/api/models/match.rb,
lib/zombie_battleground/api/extensions/cards.rb,
lib/zombie_battleground/api/extensions/decks.rb,
lib/zombie_battleground/api/validation_helper.rb,
lib/zombie_battleground/api/models/simple_card.rb,
lib/zombie_battleground/api/requests/request_helper.rb,
lib/zombie_battleground/api/requests/get_card_request.rb,
lib/zombie_battleground/api/requests/get_deck_request.rb,
lib/zombie_battleground/api/responses/response_helper.rb,
lib/zombie_battleground/api/requests/get_cards_request.rb,
lib/zombie_battleground/api/requests/get_decks_request.rb,
lib/zombie_battleground/api/requests/get_match_request.rb,
lib/zombie_battleground/api/responses/get_card_response.rb,
lib/zombie_battleground/api/responses/get_deck_response.rb,
lib/zombie_battleground/api/requests/get_matches_request.rb,
lib/zombie_battleground/api/responses/get_cards_response.rb,
lib/zombie_battleground/api/responses/get_decks_response.rb,
lib/zombie_battleground/api/responses/get_match_response.rb,
lib/zombie_battleground/api/responses/get_matches_response.rb

Overview

API for Zombie Battleground

Defined Under Namespace

Modules: Extensions, ValidationHelper Classes: Client, Errors, Models, Requests, Responses

Constant Summary collapse

VERSION =

Verion of the Gem

'0.5.2'
PAGE_MAX =

Max items per page

100
DECK_REQUIRED_CARDS_COUNT =

Required amount of cards in deck

30

Class Method Summary collapse

Methods included from Extensions::Decks

#all_decks

Methods included from Extensions::Cards

#all_cards, #card_factions, #card_kinds, #card_ranks, #card_rarities, #card_sets, #card_types, #cards_by_faction, #cards_by_kind, #cards_by_rank, #cards_by_rarity, #cards_by_set, #cards_by_type

Class Method Details

.card(**args) ⇒ ZombieBattleground::Api::Models::Card

Queries for a Card and returns the card in the response

Examples:

card = ZombieBattleground::Api.card(mould_id: 2, version: 'v3')
# => ZombieBattleground::Api::Models::Card

Parameters:

  • mould_id (String)

    Optionally filter on Card mould_id

  • version (String)

    Optionally filter on Card version

Returns:



263
264
265
# File 'lib/zombie_battleground/api.rb', line 263

def card(**args)
  card_request(**args).card
end

.card_request(**args) ⇒ ZombieBattleground::Api::Responses::GetCardResponse

Queries for a Card and returns the response

Examples:

response = ZombieBattleground::Api.card(mould_id: 2, version: 'v3')
# => ZombieBattleground::Api::Responses::GetCardResponse

Parameters:

  • mould_id (String)

    Optionally filter on Card mould_id

  • version (String)

    Optionally filter on Card version

Returns:



246
247
248
# File 'lib/zombie_battleground/api.rb', line 246

def card_request(**args)
  @client.card_request(**args)
end

.cards(**args) ⇒ Array<ZombieBattleground::Api::Models::Card>

Queries for Cards and returns the cards in the response

Examples:

cards = ZombieBattleground::Api.cards(limit: 1)
# => [ZombieBattleground::Api::Models::Card]

Parameters:

  • id (Integer)

    Optionally filter on Card id

  • mould_id (String)

    Optionally filter on Card mould_id

  • version (String)

    Optionally filter on Card version

  • kind (String)

    Optionally filter on Card kind

  • set (String)

    Optionally filter on Card set

  • name (String)

    Optionally filter on Card name

  • rank (String)

    Optionally filter on Card rank

  • type (String)

    Optionally filter on Card type

  • rarity (String)

    Optionally filter on Card rarity

  • damage (Integer)

    Optionally filter on Card damage

  • health (Integer)

    Optionally filter on Card health

  • cost (Integer)

    Optionally filter on Card cost

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



229
230
231
# File 'lib/zombie_battleground/api.rb', line 229

def cards(**args)
  cards_request(**args).cards
end

.cards_request(**args) ⇒ ZombieBattleground::Api::Responses::GetCardsResponse

Queries for Cards and returns the response

Examples:

response = ZombieBattleground::Api.cards_request(limit: 1)
# => ZombieBattleground::Api::Responses::GetCardsResponse

Parameters:

  • id (Integer)

    Optionally filter on Card id

  • mould_id (String)

    Optionally filter on Card mould_id

  • version (String)

    Optionally filter on Card version

  • kind (String)

    Optionally filter on Card kind

  • set (String)

    Optionally filter on Card set

  • name (String)

    Optionally filter on Card name

  • rank (String)

    Optionally filter on Card rank

  • type (String)

    Optionally filter on Card type

  • rarity (String)

    Optionally filter on Card rarity

  • damage (Integer)

    Optionally filter on Card damage

  • health (Integer)

    Optionally filter on Card health

  • cost (Integer)

    Optionally filter on Card cost

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



200
201
202
# File 'lib/zombie_battleground/api.rb', line 200

def cards_request(**args)
  @client.cards_request(**args)
end

.deck(**args) ⇒ ZombieBattleground::Api::Models::Deck

Queries for a Deck and returns deck in the response

Examples:

deck = ZombieBattleground::Api.deck(id: 1813)
# => ZombieBattleground::Api::Models::Deck

Parameters:

  • id (Integer)

    Deck id to request

Returns:



93
94
95
# File 'lib/zombie_battleground/api.rb', line 93

def deck(**args)
  deck_request(**args).deck
end

.deck_request(**args) ⇒ ZombieBattleground::Api::Responses::GetDeckResponse

Queries for a Deck and returns the response

Examples:

response = ZombieBattleground::Api.deck_request(id: 1813)
# => ZombieBattleground::Api::Responses::GetDeckResponse

Parameters:

  • id (Integer)

    Deck id to request

Returns:



77
78
79
# File 'lib/zombie_battleground/api.rb', line 77

def deck_request(**args)
  @client.deck_request(**args)
end

.decks(**args) ⇒ Array<ZombieBattleground::Api::Models::Deck>

Queries for Decks and returns the decks in the response

Examples:

decks = ZombieBattleground::Api.decks(limit: 1)
# => [ZombieBattleground::Api::Models::Deck]

Parameters:

  • id (Integer)

    Optionally filter on Deck id

  • user_id (String)

    Optionally filter on Deck user_id

  • deck_id (Integer)

    Optionally filter on Deck deck_id

  • name (String)

    Optionally filter on Deck name

  • hero_id (Integer)

    Optionally filter on Deck hero_id

  • primary_skill_id (Integer)

    Optionally filter on Deck primary_skill_id

  • secondary_skill_id (Integer)

    Optionally filter on Deck secondary_skill_id

  • version (String)

    Optionally filter on Deck version

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



61
62
63
# File 'lib/zombie_battleground/api.rb', line 61

def decks(**args)
  decks_request(**args).decks
end

.decks_request(**args) ⇒ ZombieBattleground::Api::Responses::GetDecksResponse

Queries for Decks and returns a modeled response

Examples:

response = ZombieBattleground::Api.decks_request(limit: 1)
# => ZombieBattleground::Api::Responses::GetDecksResponse

Parameters:

  • id (Integer)

    Optionally filter on Deck id

  • user_id (String)

    Optionally filter on Deck user_id

  • deck_id (Integer)

    Optionally filter on Deck deck_id

  • name (String)

    Optionally filter on Deck name

  • hero_id (Integer)

    Optionally filter on Deck hero_id

  • primary_skill_id (Integer)

    Optionally filter on Deck primary_skill_id

  • secondary_skill_id (Integer)

    Optionally filter on Deck secondary_skill_id

  • version (String)

    Optionally filter on Deck version

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



36
37
38
# File 'lib/zombie_battleground/api.rb', line 36

def decks_request(**args)
  @client.decks_request(**args)
end

.match(**args) ⇒ ZombieBattleground::Api::Models::Match

Queries for a Match and returns the match in the response

Examples:

match = ZombieBattleground::Api.match(id: 1454)
# => ZombieBattleground::Api::Models::Match

Parameters:

  • id (Integer)

    Match id to request

Returns:



171
172
173
# File 'lib/zombie_battleground/api.rb', line 171

def match(**args)
  match_request(**args).match
end

.match_request(**args) ⇒ ZombieBattleground::Api::Responses::GetMatchResponse

Queries for a Match and returns the response

Examples:

response = ZombieBattleground::Api.match_request(id: 1454)
response # => ZombieBattleground::Api::Responses::GetMatchResponse

Parameters:

  • id (Integer)

    Match id to request

Returns:



155
156
157
# File 'lib/zombie_battleground/api.rb', line 155

def match_request(**args)
  @client.match_request(**args)
end

.matches(**args) ⇒ Array<ZombieBattleground::Api::Models::Match>

Queries for Matches and returns the matches in the response

Examples:

matches = ZombieBattleground::Api.matches(limit: 1)
# => ZombieBattleground::Api::Models::Match

Parameters:

  • id (Integer)

    Optionally filter on Match id

  • player1_id (String)

    Optionally filter on Match player1_id

  • player2_id (String)

    Optionally filter on Match player2_id

  • status (String)

    Optionally filter on Match status

  • version (String)

    Optionally filter on Match version

  • winner_id (String)

    Optionally filter on Match winner_id

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



139
140
141
# File 'lib/zombie_battleground/api.rb', line 139

def matches(**args)
  matches_request(**args).matches
end

.matches_request(**args) ⇒ ZombieBattleground::Api::Responses::GetMatchesResponse

Queries for Matches and returns the response

Examples:

response = ZombieBattleground::Api.matches_request(limit: 1)
# => ZombieBattleground::Api::Responses::GetMatchesResponse

Parameters:

  • id (Integer)

    Optionally filter on Match id

  • player1_id (String)

    Optionally filter on Match player1_id

  • player2_id (String)

    Optionally filter on Match player2_id

  • status (String)

    Optionally filter on Match status

  • version (String)

    Optionally filter on Match version

  • winner_id (String)

    Optionally filter on Match winner_id

  • page (Integer)

    Used for pagination of query results

  • limit (Integer)

    Used for pagination of query results. Max 100

Returns:



116
117
118
# File 'lib/zombie_battleground/api.rb', line 116

def matches_request(**args)
  @client.matches_request(**args)
end