Sha256: 28af447c1cba696b800980038ff694248dce44327e683486cd2487d3d33b4f6f

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require_relative 'representers/card_representer'

module MTG
  class Card
    include Roar::JSON
    include CardRepresenter

    attr_accessor :name, :layout, :names, :mana_cost, :cmc, :colors, :type, :supertypes, :subtypes, :types,
                  :rarity, :text, :flavor, :artist, :number, :power, :toughness, :loyalty, :multiverse_id, :variations,
                  :watermark, :border, :timeshifted, :hand, :life, :reserved, :release_date, :starter,
                  :rulings, :foreign_names, :printings, :original_text, :original_type, :legalities,
                  :source, :image_url, :set, :id
    
    # Get the resource string
    #
    # @return [String] The API resource string
    def self.Resource
      "cards"
    end
    
    # Find a single card by the card multiverse id
    #
    # @param id [Integer] the multiverse 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

3 entries across 3 versions & 1 rubygems

Version Path
mtg_sdk-2.1.0 lib/mtg_sdk/card.rb
mtg_sdk-2.0.1 lib/mtg_sdk/card.rb
mtg_sdk-2.0.0 lib/mtg_sdk/card.rb