mtg_sdk 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36eb4def49749cb31cfaee8680b4aee2903e6a5a
4
- data.tar.gz: dac98aa5d3b906792d5adf73999a5bda7e1f8bc7
3
+ metadata.gz: d745c417f289a4d4458903271132a7aad09bad25
4
+ data.tar.gz: 660ac9d8d6f87ebd5cec4795aae06deb28650351
5
5
  SHA512:
6
- metadata.gz: a07c395cdb3f9dcb8520e6bbc00738148fe894c34042f49a56a4406adc35ee8df4904d7348dded574b082cc4ca7f99fd128d414f305820894cac50590f4f1bbd
7
- data.tar.gz: ca756b6daf91b634091dc5cddd94f386d881ee69404facb2fb0b3ffc9ed3ed74ce7b8f2bdf40048d45507c9b9d063fd6b3cd3d62c1ad4df5e181f804c7b5d88b
6
+ metadata.gz: '05085f8be4b43120c6f6541cb807b9cddb457c58c713902bed246b69287aa67bf51c2d72dc2916599a0040647af3a550a56a127b4fe9a7c46247ed40413f5b91'
7
+ data.tar.gz: 7e15dd23711023b6a890af1c8dd362a073257b28ad34c0fa78e70c76467e9f165a80b1d29c7595fb87cc9669d4105e1f7d0575145b868e49d876e85ca9a439e8
data/README.md CHANGED
@@ -54,6 +54,7 @@ To change the API version (currently defaults to version 1)
54
54
  mana_cost
55
55
  cmc
56
56
  colors
57
+ color_identity
57
58
  type
58
59
  supertypes
59
60
  subtypes
@@ -9,15 +9,15 @@ module MTG
9
9
  :rarity, :text, :flavor, :artist, :number, :power, :toughness, :loyalty, :multiverse_id, :variations,
10
10
  :watermark, :border, :timeshifted, :hand, :life, :reserved, :release_date, :starter,
11
11
  :rulings, :foreign_names, :printings, :original_text, :original_type, :legalities,
12
- :source, :image_url, :set, :id, :set_name
13
-
12
+ :source, :image_url, :set, :id, :set_name, :color_identity
13
+
14
14
  # Get the resource string
15
15
  #
16
16
  # @return [String] The API resource string
17
17
  def self.Resource
18
18
  "cards"
19
19
  end
20
-
20
+
21
21
  # Find a single card by the card multiverse id
22
22
  #
23
23
  # @param id [Integer] the multiverse id
@@ -32,7 +32,7 @@ module MTG
32
32
  def self.all
33
33
  QueryBuilder.new(Card).all
34
34
  end
35
-
35
+
36
36
  # Adds a parameter to the hash of query parameters
37
37
  #
38
38
  # @param args [Hash] the query parameter
@@ -41,4 +41,4 @@ module MTG
41
41
  QueryBuilder.new(Card).where(args)
42
42
  end
43
43
  end
44
- end
44
+ end
@@ -11,7 +11,7 @@ module MTG
11
11
  module CardRepresenter
12
12
  include Roar::JSON
13
13
  include Roar::Coercion
14
-
14
+
15
15
  property :name
16
16
  property :layout
17
17
  property :mana_cost, as: :manaCost
@@ -41,16 +41,17 @@ module MTG
41
41
  property :set_name, as: :setName
42
42
  property :id
43
43
  property :image_url, as: :imageUrl
44
-
44
+
45
45
  collection :names
46
46
  collection :supertypes
47
47
  collection :subtypes
48
48
  collection :types
49
49
  collection :colors
50
+ collection :color_identity, as: :colorIdentity
50
51
  collection :variations
51
52
  collection :printings
52
53
  collection :legalities, extend: LegalityRepresenter, class: Legality
53
54
  collection :rulings, extend: RulingRepresenter, class: Ruling
54
55
  collection :foreign_names, as: :foreignNames, extend: ForeignNameRepresenter, class: ForeignName
55
56
  end
56
- end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module MTG
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
@@ -11,6 +11,7 @@ class CardTest < Minitest::Test
11
11
  assert_equal 6, card.cmc
12
12
  assert_equal 'Sorcery — Arcane', card.type
13
13
  assert card.colors.any?{|color| color == 'Black'}
14
+ assert card.color_identity.any?{|color_id| color_id == 'B'}
14
15
  assert card.types.any?{|type| type == 'Sorcery'}
15
16
  assert card.subtypes.any?{|subtype| subtype == 'Arcane'}
16
17
  assert_equal 'Rare', card.rarity
@@ -32,7 +33,7 @@ class CardTest < Minitest::Test
32
33
  assert_equal '1c4aab072d52d283e902f2302afa255b39e0794b', card.id
33
34
  end
34
35
  end
35
-
36
+
36
37
  def test_find_with_invalid_id_throws_exception
37
38
  VCR.use_cassette('invalid_id') do
38
39
  assert_raises ArgumentError do
@@ -40,7 +41,7 @@ class CardTest < Minitest::Test
40
41
  end
41
42
  end
42
43
  end
43
-
44
+
44
45
  def test_where_with_page_size_and_page_returns_cards
45
46
  VCR.use_cassette('query_cards_pageSize') do
46
47
  cards = MTG::Card.where(pageSize: 10).where(page: 1).all
@@ -64,18 +65,18 @@ class CardTest < Minitest::Test
64
65
  assert first_card.subtypes.include? 'Warrior'
65
66
  end
66
67
  end
67
-
68
+
68
69
  def test_all_returns_all_cards
69
70
  VCR.use_cassette('all_cards') do
70
71
  stub_request(:any, "https://api.magicthegathering.io/v1/cards").
71
72
  to_return(:body => File.new('test/responses/sample_cards.json'), :status => 200, :headers => {"Content-Type"=> "application/json"})
72
-
73
+
73
74
  stub_request(:any, "https://api.magicthegathering.io/v1/cards?page=2").
74
75
  to_return(:body => File.new('test/responses/no_cards.json'), :status => 200, :headers => {"Content-Type"=> "application/json"})
75
-
76
+
76
77
  cards = MTG::Card.all
77
-
78
+
78
79
  assert_equal 2, cards.length
79
80
  end
80
81
  end
81
- end
82
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtg_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Backes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-31 00:00:00.000000000 Z
11
+ date: 2017-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
- rubygems_version: 2.4.5.1
274
+ rubygems_version: 2.6.10
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: 'Magic: The Gathering SDK for magicthegathering.io'