mtg_sdk 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +24 -24
- data/.travis.yml +9 -9
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +176 -176
- data/Rakefile +10 -10
- data/lib/mtg_sdk.rb +32 -32
- data/lib/mtg_sdk/card.rb +44 -44
- 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 +75 -66
- data/lib/mtg_sdk/representers/card_representer.rb +57 -57
- 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 -61
- 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 +82 -82
- data/test/changelog_test.rb +11 -11
- data/test/configuration_test.rb +19 -19
- data/test/set_test.rb +64 -52
- 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 +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a849e72b54ba4a3e10eba2cbdb7588c27c94577652ff852117f084b4836e6e59
|
4
|
+
data.tar.gz: 105c5688ec35e702a5dfa7928c0c5f8e2da2e2afbc05f7fe8b1b9ddb320e109a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b617b011fc0345c7d52d1a782c1a0f6eedaaca1422a0e47bf6c071400e492bc543dd2d27fcca231addf799ecc538db50f3f278cd8a09d3a85d478532473cf942
|
7
|
+
data.tar.gz: b6ce60c8b1a6232d132c9714a54a29ab1de13af9e32d55c789b524dc9083b5e00028177d39049a81430a45c8d1bd873ac5883c949208a01d474d08cc09a9f212
|
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,176 +1,176 @@
|
|
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
|
-
color_identity
|
58
|
-
type
|
59
|
-
supertypes
|
60
|
-
subtypes
|
61
|
-
rarity
|
62
|
-
text
|
63
|
-
flavor
|
64
|
-
artist
|
65
|
-
number
|
66
|
-
power
|
67
|
-
toughness
|
68
|
-
loyalty
|
69
|
-
variations
|
70
|
-
watermark
|
71
|
-
border
|
72
|
-
timeshifted
|
73
|
-
hand
|
74
|
-
life
|
75
|
-
reserved
|
76
|
-
release_date
|
77
|
-
starter
|
78
|
-
rulings
|
79
|
-
foreign_names
|
80
|
-
printings
|
81
|
-
original_text
|
82
|
-
original_type
|
83
|
-
legalities
|
84
|
-
source
|
85
|
-
image_url
|
86
|
-
set
|
87
|
-
set_name
|
88
|
-
id
|
89
|
-
|
90
|
-
#### Set
|
91
|
-
|
92
|
-
code
|
93
|
-
name
|
94
|
-
gatherer_code
|
95
|
-
old_code
|
96
|
-
magic_cards_info_code
|
97
|
-
release_date
|
98
|
-
border
|
99
|
-
type
|
100
|
-
block
|
101
|
-
online_only
|
102
|
-
booster
|
103
|
-
mkm_id
|
104
|
-
mkm_name
|
105
|
-
|
106
|
-
#### ForeignName
|
107
|
-
|
108
|
-
language
|
109
|
-
name
|
110
|
-
multiverse_id
|
111
|
-
|
112
|
-
#### Ruling
|
113
|
-
|
114
|
-
date
|
115
|
-
text
|
116
|
-
|
117
|
-
#### Legality
|
118
|
-
|
119
|
-
format
|
120
|
-
legality
|
121
|
-
|
122
|
-
#### Changelog
|
123
|
-
|
124
|
-
version
|
125
|
-
release_date
|
126
|
-
details
|
127
|
-
|
128
|
-
### Functions Available
|
129
|
-
|
130
|
-
#### Find a card by multiverse id
|
131
|
-
|
132
|
-
card = MTG::Card.find(386616)
|
133
|
-
|
134
|
-
#### Filter Cards via query parameters
|
135
|
-
|
136
|
-
cards = MTG::Card.where(set: 'ktk').where(subtypes: 'warrior,human').all
|
137
|
-
|
138
|
-
#### Find all cards (will take awhile)
|
139
|
-
|
140
|
-
cards = MTG::Card.all
|
141
|
-
|
142
|
-
#### Get all cards, but only a specific page of data
|
143
|
-
|
144
|
-
cards = MTG::Card.where(page: 5).where(pageSize: 100).all
|
145
|
-
|
146
|
-
#### Find a set by code
|
147
|
-
|
148
|
-
set = MTG::Set.find('ktk')
|
149
|
-
|
150
|
-
#### Filter sets via query parameters
|
151
|
-
|
152
|
-
sets = MTG::Set.where(name: 'khans').all
|
153
|
-
|
154
|
-
#### Get all Sets
|
155
|
-
|
156
|
-
sets = MTG::Set.all
|
157
|
-
|
158
|
-
#### Get all Types
|
159
|
-
|
160
|
-
types = MTG::Type.all
|
161
|
-
|
162
|
-
#### Get all Subtypes
|
163
|
-
|
164
|
-
subtypes = MTG::Subtype.all
|
165
|
-
|
166
|
-
#### Get all Supertypes
|
167
|
-
|
168
|
-
supertypes = MTG::Supertype.all
|
169
|
-
|
170
|
-
## Contributing
|
171
|
-
|
172
|
-
1. Fork it ( https://github.com/[my-github-username]/mtg-sdk-ruby/fork )
|
173
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
174
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
175
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
176
|
-
5. Create a new Pull Request
|
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
|
+
color_identity
|
58
|
+
type
|
59
|
+
supertypes
|
60
|
+
subtypes
|
61
|
+
rarity
|
62
|
+
text
|
63
|
+
flavor
|
64
|
+
artist
|
65
|
+
number
|
66
|
+
power
|
67
|
+
toughness
|
68
|
+
loyalty
|
69
|
+
variations
|
70
|
+
watermark
|
71
|
+
border
|
72
|
+
timeshifted
|
73
|
+
hand
|
74
|
+
life
|
75
|
+
reserved
|
76
|
+
release_date
|
77
|
+
starter
|
78
|
+
rulings
|
79
|
+
foreign_names
|
80
|
+
printings
|
81
|
+
original_text
|
82
|
+
original_type
|
83
|
+
legalities
|
84
|
+
source
|
85
|
+
image_url
|
86
|
+
set
|
87
|
+
set_name
|
88
|
+
id
|
89
|
+
|
90
|
+
#### Set
|
91
|
+
|
92
|
+
code
|
93
|
+
name
|
94
|
+
gatherer_code
|
95
|
+
old_code
|
96
|
+
magic_cards_info_code
|
97
|
+
release_date
|
98
|
+
border
|
99
|
+
type
|
100
|
+
block
|
101
|
+
online_only
|
102
|
+
booster
|
103
|
+
mkm_id
|
104
|
+
mkm_name
|
105
|
+
|
106
|
+
#### ForeignName
|
107
|
+
|
108
|
+
language
|
109
|
+
name
|
110
|
+
multiverse_id
|
111
|
+
|
112
|
+
#### Ruling
|
113
|
+
|
114
|
+
date
|
115
|
+
text
|
116
|
+
|
117
|
+
#### Legality
|
118
|
+
|
119
|
+
format
|
120
|
+
legality
|
121
|
+
|
122
|
+
#### Changelog
|
123
|
+
|
124
|
+
version
|
125
|
+
release_date
|
126
|
+
details
|
127
|
+
|
128
|
+
### Functions Available
|
129
|
+
|
130
|
+
#### Find a card by multiverse id
|
131
|
+
|
132
|
+
card = MTG::Card.find(386616)
|
133
|
+
|
134
|
+
#### Filter Cards via query parameters
|
135
|
+
|
136
|
+
cards = MTG::Card.where(set: 'ktk').where(subtypes: 'warrior,human').all
|
137
|
+
|
138
|
+
#### Find all cards (will take awhile)
|
139
|
+
|
140
|
+
cards = MTG::Card.all
|
141
|
+
|
142
|
+
#### Get all cards, but only a specific page of data
|
143
|
+
|
144
|
+
cards = MTG::Card.where(page: 5).where(pageSize: 100).all
|
145
|
+
|
146
|
+
#### Find a set by code
|
147
|
+
|
148
|
+
set = MTG::Set.find('ktk')
|
149
|
+
|
150
|
+
#### Filter sets via query parameters
|
151
|
+
|
152
|
+
sets = MTG::Set.where(name: 'khans').all
|
153
|
+
|
154
|
+
#### Get all Sets
|
155
|
+
|
156
|
+
sets = MTG::Set.all
|
157
|
+
|
158
|
+
#### Get all Types
|
159
|
+
|
160
|
+
types = MTG::Type.all
|
161
|
+
|
162
|
+
#### Get all Subtypes
|
163
|
+
|
164
|
+
subtypes = MTG::Subtype.all
|
165
|
+
|
166
|
+
#### Get all Supertypes
|
167
|
+
|
168
|
+
supertypes = MTG::Supertype.all
|
169
|
+
|
170
|
+
## Contributing
|
171
|
+
|
172
|
+
1. Fork it ( https://github.com/[my-github-username]/mtg-sdk-ruby/fork )
|
173
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
174
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
175
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
176
|
+
5. Create a new Pull Request
|