class MtgDbClient::Card

Attributes

artist[RW]
card_set_id[RW]
card_set_name[RW]
colors[RW]
converted_mana_cost[RW]
description[RW]
flavor[RW]
formats[RW]
id[RW]
loyalty[RW]
mana_cost[RW]
name[RW]
power[RW]
promo[RW]
rarity[RW]
released_at[RW]
rulings[RW]
search_name[RW]
set_number[RW]
sub_type[RW]
token[RW]
toughness[RW]
type[RW]

Public Class Methods

new(response) click to toggle source
# File lib/MtgDbClient/card.rb, line 8
def initialize(response)
        self.id = response["id"]
        self.related_card_id = response["relatedCardId"]
        self.set_number = response["setNumber"]
        self.name = response["name"]
        self.search_name=response["searchName"]
        self.description=response["description"]
        self.flavor = response["flavor"]
        self.colors = response["colors"]
        self.mana_cost = response["manacost"]
        self.converted_mana_cost = response["convertedManaCost"]
        self.card_set_name = response["cardSetName"]
        self.type = response["type"]
        self.sub_type = response["subType"]
        self.power = response["power"]
        self.toughness = response["toughness"]
        self.loyalty = response["loyalty"]
        self.rarity = response["rarity"]
        self.artist = response["artist"]
        self.card_set_id = response["cardSetId"]
        self.token = response["token"]
        self.promo = response["promo"]
        self.rulings = response["rulings"].map{|r| Ruling.new(r)}
        self.formats = response["formats"].map{|f| Format.new(f)}
        self.released_at = Date.parse(response["releasedAt"]) unless response["releasedAt"].nil?
end

Public Instance Methods

image_high() click to toggle source
# File lib/MtgDbClient/card.rb, line 40
def image_high
        sub_path = ['api.mtgdb.info/content/high_res_card_images', self.id].join("/")
        get_path + sub_path
end
image_low() click to toggle source
# File lib/MtgDbClient/card.rb, line 35
def image_low
        sub_path = ['api.mtgdb.info/content/card_images', self.id].join("/")
        get_path + sub_path
end

Private Instance Methods

get_path() click to toggle source
# File lib/MtgDbClient/card.rb, line 47
def get_path
        "http://"
end