scryfall 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +49 -0
- data/lib/scryfall.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf32af09b3026944696a91897c7653f7f1bb74c7d2bfa7463f72aceb0797fc08
|
4
|
+
data.tar.gz: 671b861417f508c6ce0d71acc45118c58d28c8e70705bde612705806adedd4d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f23d7118d4cc14573b3a9ca5fdbb43f26de2968744f7379155ba4792b607a6c00ebe0fe407b54ff29b67614b130b10c6d042f18e024886b6f3faee369ffa5d08
|
7
|
+
data.tar.gz: 9519a9e4b18ecb194031e325203d43a551affd3aabfcd55843dde379f5d0d807c666808a4fbd9ab8777a7f75bf6a10438e33bf024839105e831f518c8ba0f350
|
data/README.md
CHANGED
@@ -2,3 +2,52 @@
|
|
2
2
|
[](https://badge.fury.io/rb/scryfall)
|
3
3
|
|
4
4
|
A simple gem that utilizes the Scryfall API to get Magic: the Gathering card information.
|
5
|
+
|
6
|
+
|
7
|
+
## Instalation
|
8
|
+
|
9
|
+
It will only be needed to specify it on your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'scryfall'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then run the Bundler
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
# Usage
|
22
|
+
|
23
|
+
The Scryfall class will have class methods for each query on the Scryfall API. The methods will reflect their path on the official Scryfall API, following the logic of `Scryfall::<HTTP METHOD>_<PATH IN SNAKE CASE>_<VARIATION>`
|
24
|
+
|
25
|
+
At first, there are only a few methods available:
|
26
|
+
|
27
|
+
## Cards Named (fuzzy and exact)
|
28
|
+
|
29
|
+
It searches for cards named almost as the string passed (fuzzy), or with the exact name as the string passed (exact)
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Fuzzy
|
33
|
+
Scryfall::get_cards_named_fuzzy "aust commd"
|
34
|
+
|
35
|
+
# Exact
|
36
|
+
Scryfall::get_cards_named_exact "Counterspell"
|
37
|
+
```
|
38
|
+
|
39
|
+
## Search Query
|
40
|
+
|
41
|
+
It can search a list of cards using the Scryfall syntax
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# The search will return all the cards that fits on the query parameters
|
45
|
+
Scryfall::get_cards_search "f:standard t:land id:UW"
|
46
|
+
|
47
|
+
# It can be passed the page of the search. Each page of data has a maximum of 175 cards
|
48
|
+
Scryfall::get_cards_search "f:standard t:creature", page: 2
|
49
|
+
```
|
50
|
+
|
51
|
+
# Response
|
52
|
+
|
53
|
+
The default response for all calls are JSON. If a `is_struct: true` is passed as argument, the return will be a `OpenStruct` Hash object.
|
data/lib/scryfall.rb
CHANGED
@@ -19,12 +19,12 @@ class Scryfall
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.get_cards_named_fuzy(cardname)
|
23
|
-
get '/cards/named', { fuzzy: cardname }
|
22
|
+
def self.get_cards_named_fuzy(cardname, **args)
|
23
|
+
get '/cards/named', { fuzzy: cardname }, args
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.get_cards_named_exact(cardname)
|
27
|
-
get '/cards/named', { exact: cardname }
|
26
|
+
def self.get_cards_named_exact(cardname, **args)
|
27
|
+
get '/cards/named', { exact: cardname }, args
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.get_cards_search(query, **args)
|