scryfall 0.1.8 → 0.2.8

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
  SHA256:
3
- metadata.gz: 13abae40c7e882e8875a38cbd87148cbf62beab005f92a2ff36ff4e040f0ce26
4
- data.tar.gz: cb5d3f78f66eea16fad77f26c21383d9db85c3ad4b410454212db1601ef394ea
3
+ metadata.gz: 2af3560b509abc7263f3352c2a7ed89a0bd9f558a8863d5ef61bcbff93e3097d
4
+ data.tar.gz: 62d5b62b912d831adc186744a3702f38b3bf8c0ef245bf410fb7ed7c4596fe29
5
5
  SHA512:
6
- metadata.gz: b90b6859fb7548b7aee1e694f401ff0f3099af8c8f8da906ea9dee3c13d55e413ed81d6aa5a80656984ecfbf71eb94d123c8c2480bff8cfda77b94e9bcab3f00
7
- data.tar.gz: 39496f61f0327badd1a1e9f9b1eecf28191ae2f52bde95434f7b50ebe70e4c0eb9b48d031ac28a4b4acaba8478e800d6dd3a33c5ccff6da5d4827f69dcdaa722
6
+ metadata.gz: 130020646712432d62154f7c6413ebb1e73be7ec4f22007bb7b006a19fc677eeec1be61dd22ff8c14788e7824db0632a39c317641a893bb2253bcba069461f14
7
+ data.tar.gz: 8b1f2d712985f2e3b588ef758949fbd5ef5492122bc7d086a3f00ba7a972687277e970b61cb41937908f5cf50769483183e0dd1ad5e8ae34700badb1e9f96e0f
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # scryfall-rails
2
2
  [![Gem Version](https://badge.fury.io/rb/scryfall.svg)](https://badge.fury.io/rb/scryfall)
3
+ [![CircleCI](https://circleci.com/gh/jlcarruda/scryfall-rails/tree/master.svg?style=svg)](https://circleci.com/gh/jlcarruda/scryfall-rails/tree/master)
3
4
 
4
5
  A simple gem that utilizes the Scryfall API to get Magic: the Gathering card information.
5
6
 
@@ -24,7 +25,7 @@ The Scryfall module have classes for each query on the Scryfall API. Each class
24
25
 
25
26
  At first, there are only a few methods available:
26
27
 
27
- # Cards
28
+ # ::Cards
28
29
  ### Named (fuzzy and exact)
29
30
 
30
31
  It searches for cards named almost as the string passed (fuzzy), or with the exact name as the string passed (exact)
@@ -49,6 +50,28 @@ Scryfall::Cards.search "f:standard t:land id:UW"
49
50
  Scryfall::Cards.search "f:standard t:creature", page: 2
50
51
  ```
51
52
 
53
+ ### By IDs
54
+
55
+ The `Scryfall::Cards` class has methods to retrieve cards by its identifier in multiple platforms.
56
+
57
+ ```ruby
58
+ # Returning the "Yargle, Glutton of Urborg" card by its IDs
59
+
60
+ # can be fetched by its MTGO id ...
61
+ Scryfall::Cards.with_mtgo_id 67691
62
+
63
+ # ... by its Arena id ...
64
+ Scryfall::Cards.with_arena_id 67330
65
+
66
+ # ... by its TCG Player id ...
67
+ Scryfall::Cards.with_tcgplayer_id 164756
68
+
69
+ # ... or by its unique ID.
70
+ Scryfall::Cards.with_id "645cfc1b-76f2-4823-9fb0-03cb009f8b32"
71
+ ```
72
+
73
+ Cards that are not on those systems can't be retrieved by its ids. For example, the **Austere Command** card can't be fetched by an Arena Id because the card isn't in the game.
74
+
52
75
  # Responses
53
76
 
54
77
  The default response for all calls are JSON. If a `to_struct: true` is passed as argument, the return will be a `OpenStruct` Hash object.
@@ -1,9 +1,9 @@
1
1
  module Scryfall
2
2
  class API
3
- require 'http'
3
+ require "http"
4
4
  require 'ostruct'
5
5
  require 'json'
6
- require 'error_handler'
6
+ require 'scryfall/error_handler'
7
7
  require 'resolv-replace'
8
8
 
9
9
  def initialize(url = 'https://api.scryfall.com');
File without changes
@@ -18,5 +18,21 @@ module Scryfall
18
18
 
19
19
  api.get '/cards/search', params, args
20
20
  end
21
+
22
+ def self.with_mtgo_id(id, **args)
23
+ api.get "/cards/mtgo/#{id}", {}, args
24
+ end
25
+
26
+ def self.with_arena_id(id, **args)
27
+ api.get "/cards/arena/#{id}", {}, args
28
+ end
29
+
30
+ def self.with_tcgplayer_id(id, **args)
31
+ api.get "/cards/tcgplayer/#{id}", {}, args
32
+ end
33
+
34
+ def self.with_id(id, **args)
35
+ api.get "/cards/#{id}", {}, args
36
+ end
21
37
  end
22
38
  end
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scryfall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Lucas
@@ -70,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubyforge_project:
74
- rubygems_version: 2.7.7
73
+ rubygems_version: 3.0.1
75
74
  signing_key:
76
75
  specification_version: 4
77
76
  summary: A gem made to contact Scryfall API