Sha256: 202a290fe09b686f8dd5792da474190b1a6be40677dd74a24f27455b3d83cc6b

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require_relative 'representers/card_representer'

module Pokemon
  class Card
    include Roar::JSON
    include CardRepresenter
    
    attr_accessor :id, :name, :image_url, :subtype, :supertype, :ability,
                  :hp, :number, :artist, :rarity, :series, :set, :set_code,
                  :retreat_cost, :text, :types, :attacks, :weaknesses, :resistances,
                  :national_pokedex_number, :ancient_trait
                  
    # Get the resource string
    #
    # @return [String] The API resource string
    def self.Resource
      "cards"
    end
    
    # Find a single card by the card id
    #
    # @param id [String] the card id
    # @return [Card] the Card object response
    def self.find(id)
      QueryBuilder.new(Card).find(id)
    end

    # Get all cards from a query by paging through data
    #
    # @return [Array<Card>] Array of Card objects
    def self.all
      QueryBuilder.new(Card).all
    end
    
    # Adds a parameter to the hash of query parameters
    #
    # @param args [Hash] the query parameter
    # @return [QueryBuilder] the QueryBuilder
    def self.where(args)
      QueryBuilder.new(Card).where(args)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pokemon_tcg_sdk-2.2.1 lib/pokemon_tcg_sdk/card.rb
pokemon_tcg_sdk-2.2.0 lib/pokemon_tcg_sdk/card.rb