Skip to content

Commit

Permalink
Adding set_name and foreign card image_url properties
Browse files Browse the repository at this point in the history
  • Loading branch information
adback03 committed May 24, 2016
1 parent f54259a commit f7b214d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/mtg_sdk/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Card
: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
:source, :image_url, :set, :id, :set_name

# Get the resource string
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mtg_sdk/foreign_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ class ForeignName
include Roar::JSON
include LegalityRepresenter

attr_accessor :language, :name, :multiverse_id
attr_accessor :language, :name, :multiverse_id, :image_url
end
end
1 change: 1 addition & 0 deletions lib/mtg_sdk/representers/card_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module CardRepresenter
property :original_type, as: :originalType
property :source
property :set
property :set_name, as: :setName
property :id
property :image_url, as: :imageUrl

Expand Down
1 change: 1 addition & 0 deletions lib/mtg_sdk/representers/foreign_name_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ module ForeignNameRepresenter
property :name
property :language
property :multiverse_id, as: :multiverseid
property :image_url, as: :imageUrl
end
end
2 changes: 1 addition & 1 deletion lib/mtg_sdk/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MTG
VERSION = "2.1.0"
VERSION = "2.2.0"
end
3 changes: 2 additions & 1 deletion test/card_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_find_returns_one_card
assert card.subtypes.any?{|subtype| subtype == 'Arcane'}
assert_equal 'Rare', card.rarity
assert_equal 'SOK', card.set
assert_equal 'Saviors of Kamigawa', card.set_name
assert_equal "Target opponent chooses a number. You may have that player lose that much life. If you don't, that player sacrifices all but that many permanents.", card.text
assert_equal "\"Life is a series of choices between bad and worse.\"\n—Toshiro Umezawa", card.flavor
assert_equal 'Tim Hildebrandt', card.artist
Expand All @@ -23,7 +24,7 @@ def test_find_returns_one_card
assert_equal 88803, card.multiverse_id
assert_equal 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=88803&type=card', card.image_url
assert card.rulings.any?{|ruling| ruling.date == Date.parse('2005-06-01')}
assert card.foreign_names.any?{|foreign_name| foreign_name.name == '破灭抉择'}
assert card.foreign_names.any?{|foreign_name| foreign_name.name == '破灭抉择' && foreign_name.image_url == 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=104898&type=card'}
assert card.printings.any?{|printing| printing == 'SOK'}
assert_equal "Target opponent chooses a number. You may have that player lose that much life. If you don't, that player sacrifices all but that many permanents.", card.original_text
assert_equal 'Sorcery — Arcane', card.original_type
Expand Down

0 comments on commit f7b214d

Please sign in to comment.