Sha256: c135425a3c67fb9ea9399ea5428393ca06012507d7faaf59a6871a9e98e25730

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 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
                  
    # 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

1 entries across 1 versions & 1 rubygems

Version Path
pokemon_tcg_sdk-2.1.0 lib/pokemon_tcg_sdk/card.rb