class Pokemon::Card
Attributes
abilities[RW]
ancient_trait[RW]
artist[RW]
attacks[RW]
cardmarket[RW]
converted_retreat_cost[RW]
evolves_from[RW]
evolves_to[RW]
flavor_text[RW]
hp[RW]
id[RW]
images[RW]
legalities[RW]
level[RW]
name[RW]
national_pokedex_numbers[RW]
number[RW]
rarity[RW]
regulation_mark[RW]
resistances[RW]
retreat_cost[RW]
rules[RW]
set[RW]
subtypes[RW]
supertype[RW]
tcgplayer[RW]
types[RW]
weaknesses[RW]
Public Class Methods
Resource()
click to toggle source
Get the resource string
@return [String] The API resource string
# File lib/pokemon_tcg_sdk/card.rb, line 45 def self.Resource "cards" end
all()
click to toggle source
Get all cards from a query by paging through data
@return [Array<Card>] Array of Card
objects
# File lib/pokemon_tcg_sdk/card.rb, line 60 def self.all QueryBuilder.new(Card).all end
find(id)
click to toggle source
Find a single card by the card id
@param id [String] the card id @return [Card] the Card
object response
# File lib/pokemon_tcg_sdk/card.rb, line 53 def self.find(id) QueryBuilder.new(Card).find(ERB::Util.url_encode(id)) end
from_json(json)
click to toggle source
# File lib/pokemon_tcg_sdk/card.rb, line 9 def self.from_json(json) card = Card.new card.id = json['id'] card.name = json['name'] card.supertype = json['supertype'] card.subtypes = json['subtypes'] card.level = json['level'] card.hp = json['hp'] card.types = json['types'] card.evolves_from = json['evolvesFrom'] card.evolves_to = json['evolvesTo'] card.rules = json['rules'] card.ancient_trait = AncientTrait.from_json(json['ancientTrait']) if !json['ancientTrait'].nil? card.abilities = json['abilities'].map {|ability_json| Ability.from_json(ability_json)} if !json['abilities'].nil? card.attacks = json['attacks'].map {|attack_json| Attack.from_json(attack_json)} if !json['attacks'].nil? card.weaknesses = json['weaknesses'].map {|weakness_json| Weakness.from_json(weakness_json)} if !json['weaknesses'].nil? card.resistances = json['resistances'].map {|resistance_json| Resistance.from_json(resistance_json)} if !json['resistances'].nil? card.retreat_cost = json['retreatCost'] card.converted_retreat_cost = json['convertedRetreatCost'] card.set = Set.from_json(json['set']) if !json['set'].nil? card.number = json['number'] card.artist = json['artist'] card.rarity = json['rarity'] card.flavor_text = json['flavorText'] card.national_pokedex_numbers = json['nationalPokedexNumbers'] card.legalities = Legalities.from_json(json['legalities']) if !json['legalities'].nil? card.regulation_mark = json['regulationMark'] card.tcgplayer = Tcgplayer.from_json(json['tcgplayer']) if !json['tcgplayer'].nil? card.cardmarket = Cardmarket.from_json(json['cardmarket']) if !json['cardmarket'].nil? card.images = CardImages.from_json(json['images']) if !json['images'].nil? card end
where(args)
click to toggle source
Adds a parameter to the hash of query parameters
@param args [Hash] the query parameter @return [Array<Card>] Array of Card
objects
# File lib/pokemon_tcg_sdk/card.rb, line 68 def self.where(args) QueryBuilder.new(Card).where(args) end