mtg_sdk 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +24 -24
- data/.travis.yml +9 -9
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +175 -174
- data/Rakefile +10 -10
- data/lib/mtg_sdk.rb +32 -32
- data/lib/mtg_sdk/card.rb +43 -43
- data/lib/mtg_sdk/changelog.rb +24 -24
- data/lib/mtg_sdk/configuration.rb +8 -8
- data/lib/mtg_sdk/foreign_name.rb +10 -10
- data/lib/mtg_sdk/legality.rb +10 -10
- data/lib/mtg_sdk/query_builder.rb +65 -65
- data/lib/mtg_sdk/representers/card_representer.rb +55 -55
- data/lib/mtg_sdk/representers/changelog_representer.rb +12 -12
- data/lib/mtg_sdk/representers/foreign_name_representer.rb +11 -11
- data/lib/mtg_sdk/representers/legality_representer.rb +9 -9
- data/lib/mtg_sdk/representers/ruling_representer.rb +11 -11
- data/lib/mtg_sdk/representers/set_representer.rb +21 -21
- data/lib/mtg_sdk/rest_client.rb +31 -31
- data/lib/mtg_sdk/ruling.rb +10 -10
- data/lib/mtg_sdk/set.rb +61 -53
- data/lib/mtg_sdk/subtype.rb +11 -11
- data/lib/mtg_sdk/supertype.rb +11 -11
- data/lib/mtg_sdk/type.rb +11 -11
- data/lib/mtg_sdk/version.rb +3 -3
- data/mtg_sdk.gemspec +36 -36
- data/test/card_test.rb +80 -66
- data/test/changelog_test.rb +11 -11
- data/test/configuration_test.rb +19 -9
- data/test/responses/no_cards.json +1 -0
- data/test/responses/sample_cards.json +1 -0
- data/test/set_test.rb +51 -41
- data/test/subtype_test.rb +11 -11
- data/test/supertype_test.rb +11 -11
- data/test/test_helper.rb +21 -21
- data/test/type_test.rb +11 -11
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36eb4def49749cb31cfaee8680b4aee2903e6a5a
|
4
|
+
data.tar.gz: dac98aa5d3b906792d5adf73999a5bda7e1f8bc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07c395cdb3f9dcb8520e6bbc00738148fe894c34042f49a56a4406adc35ee8df4904d7348dded574b082cc4ca7f99fd128d414f305820894cac50590f4f1bbd
|
7
|
+
data.tar.gz: ca756b6daf91b634091dc5cddd94f386d881ee69404facb2fb0b3ffc9ed3ed74ce7b8f2bdf40048d45507c9b9d063fd6b3cd3d62c1ad4df5e181f804c7b5d88b
|
data/.gitignore
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
test/fixtures
|
18
|
-
coverage
|
19
|
-
tmp
|
20
|
-
*.bundle
|
21
|
-
*.so
|
22
|
-
*.o
|
23
|
-
*.a
|
24
|
-
mkmf.log
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
test/fixtures
|
18
|
+
coverage
|
19
|
+
tmp
|
20
|
+
*.bundle
|
21
|
+
*.so
|
22
|
+
*.o
|
23
|
+
*.a
|
24
|
+
mkmf.log
|
25
25
|
.vscode
|
data/.travis.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install bundler --version '1.12.5'
|
4
|
-
rvm:
|
5
|
-
- 2.1.2
|
6
|
-
|
7
|
-
addons:
|
8
|
-
code_climate:
|
9
|
-
repo_token: 42ac805c08eb080273606ebe764d348c33902f543e22ec8b3f558d595049ec72
|
1
|
+
language: ruby
|
2
|
+
before_install:
|
3
|
+
- gem install bundler --version '1.12.5'
|
4
|
+
rvm:
|
5
|
+
- 2.1.2
|
6
|
+
|
7
|
+
addons:
|
8
|
+
code_climate:
|
9
|
+
repo_token: 42ac805c08eb080273606ebe764d348c33902f543e22ec8b3f558d595049ec72
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in mtg_sdk.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in mtg_sdk.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2016 Andrew Backes
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2016 Andrew Backes
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,174 +1,175 @@
|
|
1
|
-
# Magic: The Gathering SDK
|
2
|
-
|
3
|
-
[![
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
1
|
+
# Magic: The Gathering SDK
|
2
|
+
|
3
|
+
[![mtg-developers on discord](https://img.shields.io/badge/discord-mtg%20developers-738bd7.svg)](https://discord.gg/qwGJNnP)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/mtg_sdk.svg)](https://badge.fury.io/rb/mtg_sdk)
|
5
|
+
[![Build Status](https://travis-ci.org/MagicTheGathering/mtg-sdk-ruby.svg?branch=master)](https://travis-ci.org/MagicTheGathering/mtg-sdk-ruby)
|
6
|
+
[![Dependency Status](https://gemnasium.com/MagicTheGathering/mtg-sdk-ruby.svg)](https://gemnasium.com/MagicTheGathering/mtg-sdk-ruby)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/MagicTheGathering/mtg-sdk-ruby/badges/gpa.svg)](https://codeclimate.com/github/MagicTheGathering/mtg-sdk-ruby)
|
8
|
+
[![Test Coverage](https://codeclimate.com/github/MagicTheGathering/mtg-sdk-ruby/badges/coverage.svg)](https://codeclimate.com/github/MagicTheGathering/mtg-sdk-ruby/coverage)
|
9
|
+
|
10
|
+
This is the Magic: The Gathering SDK Ruby implementation. It is a wrapper around the MTG API of [magicthegathering.io](http://magicthegathering.io/).
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'mtg_sdk'
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install mtg_sdk
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
To change the API version (currently defaults to version 1)
|
29
|
+
|
30
|
+
MTG.configure do |config|
|
31
|
+
config.api_version = 2
|
32
|
+
end
|
33
|
+
|
34
|
+
### Classes
|
35
|
+
|
36
|
+
Card
|
37
|
+
Set
|
38
|
+
ForeignName
|
39
|
+
Ruling
|
40
|
+
Legality
|
41
|
+
Subtype
|
42
|
+
Supertype
|
43
|
+
Type
|
44
|
+
Changelog
|
45
|
+
|
46
|
+
### Properties Per Class
|
47
|
+
|
48
|
+
#### Card
|
49
|
+
|
50
|
+
name
|
51
|
+
multiverse_id
|
52
|
+
layout
|
53
|
+
names
|
54
|
+
mana_cost
|
55
|
+
cmc
|
56
|
+
colors
|
57
|
+
type
|
58
|
+
supertypes
|
59
|
+
subtypes
|
60
|
+
rarity
|
61
|
+
text
|
62
|
+
flavor
|
63
|
+
artist
|
64
|
+
number
|
65
|
+
power
|
66
|
+
toughness
|
67
|
+
loyalty
|
68
|
+
variations
|
69
|
+
watermark
|
70
|
+
border
|
71
|
+
timeshifted
|
72
|
+
hand
|
73
|
+
life
|
74
|
+
reserved
|
75
|
+
release_date
|
76
|
+
starter
|
77
|
+
rulings
|
78
|
+
foreign_names
|
79
|
+
printings
|
80
|
+
original_text
|
81
|
+
original_type
|
82
|
+
legalities
|
83
|
+
source
|
84
|
+
image_url
|
85
|
+
set
|
86
|
+
set_name
|
87
|
+
id
|
88
|
+
|
89
|
+
#### Set
|
90
|
+
|
91
|
+
code
|
92
|
+
name
|
93
|
+
gatherer_code
|
94
|
+
old_code
|
95
|
+
magic_cards_info_code
|
96
|
+
release_date
|
97
|
+
border
|
98
|
+
type
|
99
|
+
block
|
100
|
+
online_only
|
101
|
+
booster
|
102
|
+
mkm_id
|
103
|
+
mkm_name
|
104
|
+
|
105
|
+
#### ForeignName
|
106
|
+
|
107
|
+
language
|
108
|
+
name
|
109
|
+
multiverse_id
|
110
|
+
|
111
|
+
#### Ruling
|
112
|
+
|
113
|
+
date
|
114
|
+
text
|
115
|
+
|
116
|
+
#### Legality
|
117
|
+
|
118
|
+
format
|
119
|
+
legality
|
120
|
+
|
121
|
+
#### Changelog
|
122
|
+
|
123
|
+
version
|
124
|
+
release_date
|
125
|
+
details
|
126
|
+
|
127
|
+
### Functions Available
|
128
|
+
|
129
|
+
#### Find a card by multiverse id
|
130
|
+
|
131
|
+
card = MTG::Card.find(386616)
|
132
|
+
|
133
|
+
#### Filter Cards via query parameters
|
134
|
+
|
135
|
+
cards = MTG::Card.where(set: 'ktk').where(subtypes: 'warrior,human').all
|
136
|
+
|
137
|
+
#### Find all cards (will take awhile)
|
138
|
+
|
139
|
+
cards = MTG::Card.all
|
140
|
+
|
141
|
+
#### Get all cards, but only a specific page of data
|
142
|
+
|
143
|
+
cards = MTG::Card.where(page: 5).where(pageSize: 100).all
|
144
|
+
|
145
|
+
#### Find a set by code
|
146
|
+
|
147
|
+
set = MTG::Set.find('ktk')
|
148
|
+
|
149
|
+
#### Filter sets via query parameters
|
150
|
+
|
151
|
+
sets = MTG::Set.where(name: 'khans').all
|
152
|
+
|
153
|
+
#### Get all Sets
|
154
|
+
|
155
|
+
sets = MTG::Set.all
|
156
|
+
|
157
|
+
#### Get all Types
|
158
|
+
|
159
|
+
types = MTG::Type.all
|
160
|
+
|
161
|
+
#### Get all Subtypes
|
162
|
+
|
163
|
+
subtypes = MTG::Subtype.all
|
164
|
+
|
165
|
+
#### Get all Supertypes
|
166
|
+
|
167
|
+
supertypes = MTG::Supertype.all
|
168
|
+
|
169
|
+
## Contributing
|
170
|
+
|
171
|
+
1. Fork it ( https://github.com/[my-github-username]/mtg-sdk-ruby/fork )
|
172
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
173
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
174
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
175
|
+
5. Create a new Pull Request
|