Class: Pokemon::Card
- Inherits:
-
Object
- Object
- Pokemon::Card
- Defined in:
- lib/pokemon_tcg_sdk/card.rb
Instance Attribute Summary collapse
-
#abilities ⇒ Object
Returns the value of attribute abilities.
-
#ancient_trait ⇒ Object
Returns the value of attribute ancient_trait.
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#attacks ⇒ Object
Returns the value of attribute attacks.
-
#cardmarket ⇒ Object
Returns the value of attribute cardmarket.
-
#converted_retreat_cost ⇒ Object
Returns the value of attribute converted_retreat_cost.
-
#evolves_from ⇒ Object
Returns the value of attribute evolves_from.
-
#evolves_to ⇒ Object
Returns the value of attribute evolves_to.
-
#flavor_text ⇒ Object
Returns the value of attribute flavor_text.
-
#hp ⇒ Object
Returns the value of attribute hp.
-
#id ⇒ Object
Returns the value of attribute id.
-
#images ⇒ Object
Returns the value of attribute images.
-
#legalities ⇒ Object
Returns the value of attribute legalities.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#national_pokedex_numbers ⇒ Object
Returns the value of attribute national_pokedex_numbers.
-
#number ⇒ Object
Returns the value of attribute number.
-
#rarity ⇒ Object
Returns the value of attribute rarity.
-
#regulation_mark ⇒ Object
Returns the value of attribute regulation_mark.
-
#resistances ⇒ Object
Returns the value of attribute resistances.
-
#retreat_cost ⇒ Object
Returns the value of attribute retreat_cost.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#set ⇒ Object
Returns the value of attribute set.
-
#subtypes ⇒ Object
Returns the value of attribute subtypes.
-
#supertype ⇒ Object
Returns the value of attribute supertype.
-
#tcgplayer ⇒ Object
Returns the value of attribute tcgplayer.
-
#types ⇒ Object
Returns the value of attribute types.
-
#weaknesses ⇒ Object
Returns the value of attribute weaknesses.
Class Method Summary collapse
-
.all ⇒ Array<Card>
Get all cards from a query by paging through data.
-
.find(id) ⇒ Card
Find a single card by the card id.
- .from_json(json) ⇒ Object
-
.Resource ⇒ String
Get the resource string.
-
.where(args) ⇒ Array<Card>
Adds a parameter to the hash of query parameters.
Instance Attribute Details
#abilities ⇒ Object
Returns the value of attribute abilities.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def abilities @abilities end |
#ancient_trait ⇒ Object
Returns the value of attribute ancient_trait.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def ancient_trait @ancient_trait end |
#artist ⇒ Object
Returns the value of attribute artist.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def artist @artist end |
#attacks ⇒ Object
Returns the value of attribute attacks.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def attacks @attacks end |
#cardmarket ⇒ Object
Returns the value of attribute cardmarket.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def cardmarket @cardmarket end |
#converted_retreat_cost ⇒ Object
Returns the value of attribute converted_retreat_cost.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def converted_retreat_cost @converted_retreat_cost end |
#evolves_from ⇒ Object
Returns the value of attribute evolves_from.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def evolves_from @evolves_from end |
#evolves_to ⇒ Object
Returns the value of attribute evolves_to.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def evolves_to @evolves_to end |
#flavor_text ⇒ Object
Returns the value of attribute flavor_text.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def flavor_text @flavor_text end |
#hp ⇒ Object
Returns the value of attribute hp.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def hp @hp end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def id @id end |
#images ⇒ Object
Returns the value of attribute images.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def images @images end |
#legalities ⇒ Object
Returns the value of attribute legalities.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def legalities @legalities end |
#level ⇒ Object
Returns the value of attribute level.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def name @name end |
#national_pokedex_numbers ⇒ Object
Returns the value of attribute national_pokedex_numbers.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def national_pokedex_numbers @national_pokedex_numbers end |
#number ⇒ Object
Returns the value of attribute number.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def number @number end |
#rarity ⇒ Object
Returns the value of attribute rarity.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def rarity @rarity end |
#regulation_mark ⇒ Object
Returns the value of attribute regulation_mark.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def regulation_mark @regulation_mark end |
#resistances ⇒ Object
Returns the value of attribute resistances.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def resistances @resistances end |
#retreat_cost ⇒ Object
Returns the value of attribute retreat_cost.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def retreat_cost @retreat_cost end |
#rules ⇒ Object
Returns the value of attribute rules.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def rules @rules end |
#set ⇒ Object
Returns the value of attribute set.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def set @set end |
#subtypes ⇒ Object
Returns the value of attribute subtypes.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def subtypes @subtypes end |
#supertype ⇒ Object
Returns the value of attribute supertype.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def supertype @supertype end |
#tcgplayer ⇒ Object
Returns the value of attribute tcgplayer.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def tcgplayer @tcgplayer end |
#types ⇒ Object
Returns the value of attribute types.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def types @types end |
#weaknesses ⇒ Object
Returns the value of attribute weaknesses.
5 6 7 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 5 def weaknesses @weaknesses end |
Class Method Details
.all ⇒ Array<Card>
Get all cards from a query by paging through data
60 61 62 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 60 def self.all QueryBuilder.new(Card).all end |
.find(id) ⇒ Card
Find a single card by the card id
53 54 55 |
# 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) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 |
.Resource ⇒ String
Get the resource string
45 46 47 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 45 def self.Resource "cards" end |
.where(args) ⇒ Array<Card>
Adds a parameter to the hash of query parameters
68 69 70 |
# File 'lib/pokemon_tcg_sdk/card.rb', line 68 def self.where(args) QueryBuilder.new(Card).where(args) end |