Class: ZombieBattleground::Api::Responses::GetCardResponse

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, ResponseHelper, ValidationHelper
Defined in:
lib/zombie_battleground/api/responses/get_card_response.rb

Overview

Response validator for GetCard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ZombieBattleground::Api::GetCardResponse

Creates a new GetCardResponse

Examples:

response = ZombieBattleground::Api::GetCardResponse.new(faraday_response)
# => ZombieBattleground::Api::GetCardResponse

Parameters:

  • response (Faraday::Response)

    Faraday response from endpoint



48
49
50
51
52
# File 'lib/zombie_battleground/api/responses/get_card_response.rb', line 48

def initialize(response)
  handle_errors(response)

  @card = ZombieBattleground::Api::Models::Card.new(JSON.parse(response.body))
end

Instance Attribute Details

#cardZombieBattleground::Api::Deck (readonly)

the card

Examples:

response.card #=> ZombieBattleground::Api::Deck

Returns:

  • (ZombieBattleground::Api::Deck)


32
33
34
# File 'lib/zombie_battleground/api/responses/get_card_response.rb', line 32

def card
  @card
end