ygoprodeck 1.0.2 → 1.0.4
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/.gitignore +14 -15
- data/.rspec +1 -1
- data/.rubocop.yml +40 -7
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +3 -3
- data/LICENSE.txt +21 -21
- data/README.md +118 -118
- data/Rakefile +5 -5
- data/bin/console +14 -14
- data/bin/setup +6 -6
- data/examples/a.rb +22 -0
- data/examples/{search.rb → try.rb} +21 -21
- data/examples/try_archetype.rb +23 -0
- data/lib/ygoprodeck/errors.rb +2 -2
- data/lib/ygoprodeck/search/all_card.rb +1 -1
- data/lib/ygoprodeck/search/archetype.rb +21 -21
- data/lib/ygoprodeck/search/banlist.rb +25 -25
- data/lib/ygoprodeck/search/card_sets.rb +11 -11
- data/lib/ygoprodeck/search/client/endpoint.rb +7 -7
- data/lib/ygoprodeck/search/client/image_gapis.rb +15 -15
- data/lib/ygoprodeck/search/fuzzy_name.rb +21 -21
- data/lib/ygoprodeck/search/list.rb +21 -21
- data/lib/ygoprodeck/search/name.rb +21 -21
- data/lib/ygoprodeck/search/random.rb +11 -11
- data/lib/ygoprodeck/version.rb +3 -3
- data/lib/ygoprodeck.rb +18 -18
- data/spec/archetype_spec.rb +18 -18
- data/spec/banlist_spec.rb +12 -12
- data/spec/cardsets_spec.rb +6 -6
- data/spec/fuzzy_name_spec.rb +10 -10
- data/spec/image_spec.rb +10 -10
- data/spec/list_spec.rb +18 -18
- data/spec/name_spec.rb +9 -9
- data/spec/random_spec.rb +6 -6
- data/spec/spec_helper.rb +14 -14
- data/spec/ygoprodeck_spec.rb +10 -10
- data/ygoprodeck.gemspec +28 -27
- metadata +12 -20
- data/.travis.yml +0 -7
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'ygoprodeck'
|
2
|
+
|
3
|
+
# kaiba is example, you free to change variable name
|
4
|
+
kaiba = Ygoprodeck::Archetype.is('blue-eyes') # example I wanna search 'blue-eyes' archetype
|
5
|
+
|
6
|
+
# make for looping for listing archetype
|
7
|
+
kaiba_listing = [] # save listing here
|
8
|
+
count = 50 # count max listing . example 50
|
9
|
+
num_default = 0 # number default
|
10
|
+
|
11
|
+
# looping logic
|
12
|
+
for logic_search in 1..50 do
|
13
|
+
if kaiba[num_default] == nil
|
14
|
+
else
|
15
|
+
kaiba_listing << kaiba[num_default]["name"]
|
16
|
+
num_default += 1
|
17
|
+
count -= 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
puts "#{kaiba_listing.length} card matches for blue-eyes archetype" #length blue-eyes archetype
|
22
|
+
puts "#" *30
|
23
|
+
puts "#{kaiba_listing.join(" \n")}" # each listing
|
data/lib/ygoprodeck/errors.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Ygoprodeck
|
2
|
-
class Error < StandardError; end
|
1
|
+
module Ygoprodeck
|
2
|
+
class Error < StandardError; end
|
3
3
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# sorry I did't created get all card, because you need 2 days to get all card
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Archetype
|
4
|
-
attr_reader :archetype
|
5
|
-
def self.is(archetype)
|
6
|
-
url = "#{Ygoprodeck::Endpoint.is}?archetype=#{archetype}"
|
7
|
-
uri = URI(url)
|
8
|
-
response = Net::HTTP.get(uri)
|
9
|
-
load = JSON.parse(response)
|
10
|
-
|
11
|
-
if load[0] == nil
|
12
|
-
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
-
else
|
14
|
-
load
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Archetype
|
4
|
+
attr_reader :archetype
|
5
|
+
def self.is(archetype)
|
6
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?archetype=#{archetype}"
|
7
|
+
uri = URI(url)
|
8
|
+
response = Net::HTTP.get(uri)
|
9
|
+
load = JSON.parse(response)
|
10
|
+
|
11
|
+
if load[0] == nil
|
12
|
+
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
+
else
|
14
|
+
load
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -1,26 +1,26 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Banlist
|
4
|
-
def self.tcg
|
5
|
-
url = "#{Ygoprodeck::Endpoint.is}?banlist=tcg"
|
6
|
-
uri = URI(url)
|
7
|
-
response = Net::HTTP.get(uri)
|
8
|
-
load = JSON.parse(response)
|
9
|
-
load
|
10
|
-
end
|
11
|
-
def self.ocg
|
12
|
-
url = "#{Ygoprodeck::Endpoint.is}?banlist=ocg"
|
13
|
-
uri = URI(url)
|
14
|
-
response = Net::HTTP.get(uri)
|
15
|
-
load = JSON.parse(response)
|
16
|
-
load
|
17
|
-
end
|
18
|
-
def self.goat
|
19
|
-
url = "#{Ygoprodeck::Endpoint.is}?banlist=goat"
|
20
|
-
uri = URI(url)
|
21
|
-
response = Net::HTTP.get(uri)
|
22
|
-
load = JSON.parse(response)
|
23
|
-
load
|
24
|
-
end
|
25
|
-
end
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Banlist
|
4
|
+
def self.tcg
|
5
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?banlist=tcg"
|
6
|
+
uri = URI(url)
|
7
|
+
response = Net::HTTP.get(uri)
|
8
|
+
load = JSON.parse(response)
|
9
|
+
load
|
10
|
+
end
|
11
|
+
def self.ocg
|
12
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?banlist=ocg"
|
13
|
+
uri = URI(url)
|
14
|
+
response = Net::HTTP.get(uri)
|
15
|
+
load = JSON.parse(response)
|
16
|
+
load
|
17
|
+
end
|
18
|
+
def self.goat
|
19
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?banlist=goat"
|
20
|
+
uri = URI(url)
|
21
|
+
response = Net::HTTP.get(uri)
|
22
|
+
load = JSON.parse(response)
|
23
|
+
load
|
24
|
+
end
|
25
|
+
end
|
26
26
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Card
|
4
|
-
def self.sets
|
5
|
-
url = "https://db.ygoprodeck.com/api/
|
6
|
-
uri = URI(url)
|
7
|
-
response = Net::HTTP.get(uri)
|
8
|
-
load = JSON.parse(response)
|
9
|
-
load
|
10
|
-
end
|
11
|
-
end
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Card
|
4
|
+
def self.sets
|
5
|
+
url = "https://db.ygoprodeck.com/api/v7/cardsets.php"
|
6
|
+
uri = URI(url)
|
7
|
+
response = Net::HTTP.get(uri)
|
8
|
+
load = JSON.parse(response)
|
9
|
+
load
|
10
|
+
end
|
11
|
+
end
|
12
12
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Endpoint
|
4
|
-
def self.is
|
5
|
-
"https://db.ygoprodeck.com/api/
|
6
|
-
end
|
7
|
-
end
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Endpoint
|
4
|
+
def self.is
|
5
|
+
"https://db.ygoprodeck.com/api/v7/"
|
6
|
+
end
|
7
|
+
end
|
8
8
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Image
|
4
|
-
attr_reader :image_by_id
|
5
|
-
def self.is(image_by_id)
|
6
|
-
"https://storage.googleapis.com/ygoprodeck.com/pics/#{image_by_id}.jpg"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class Image_small
|
11
|
-
attr_reader :image_small_by_id
|
12
|
-
def self.is(image_small_by_id)
|
13
|
-
"https://storage.googleapis.com/ygoprodeck.com/pics_small/#{image_small_by_id}.jpg"
|
14
|
-
end
|
15
|
-
end
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Image
|
4
|
+
attr_reader :image_by_id
|
5
|
+
def self.is(image_by_id)
|
6
|
+
"https://storage.googleapis.com/ygoprodeck.com/pics/#{image_by_id}.jpg"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Image_small
|
11
|
+
attr_reader :image_small_by_id
|
12
|
+
def self.is(image_small_by_id)
|
13
|
+
"https://storage.googleapis.com/ygoprodeck.com/pics_small/#{image_small_by_id}.jpg"
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Fname
|
4
|
-
attr_reader :f_name
|
5
|
-
def self.is(f_name)
|
6
|
-
url = "#{Ygoprodeck::Endpoint.is}?fname=#{f_name}"
|
7
|
-
uri = URI(url)
|
8
|
-
response = Net::HTTP.get(uri)
|
9
|
-
load = JSON.parse(response)
|
10
|
-
|
11
|
-
if load[0] == nil
|
12
|
-
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
-
else
|
14
|
-
load[0]
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Fname
|
4
|
+
attr_reader :f_name
|
5
|
+
def self.is(f_name)
|
6
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?fname=#{f_name}"
|
7
|
+
uri = URI(url)
|
8
|
+
response = Net::HTTP.get(uri)
|
9
|
+
load = JSON.parse(response)
|
10
|
+
|
11
|
+
if load['data'][0] == nil
|
12
|
+
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
+
else
|
14
|
+
load['data'][0]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class List
|
4
|
-
attr_reader :list
|
5
|
-
def self.is(list)
|
6
|
-
url = "#{Ygoprodeck::Endpoint.is}?fname=#{list}"
|
7
|
-
uri = URI(url)
|
8
|
-
response = Net::HTTP.get(uri)
|
9
|
-
load = JSON.parse(response)
|
10
|
-
|
11
|
-
if load[0] == nil
|
12
|
-
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
-
else
|
14
|
-
load
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class List
|
4
|
+
attr_reader :list
|
5
|
+
def self.is(list)
|
6
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?fname=#{list}"
|
7
|
+
uri = URI(url)
|
8
|
+
response = Net::HTTP.get(uri)
|
9
|
+
load = JSON.parse(response)
|
10
|
+
|
11
|
+
if load[0] == nil
|
12
|
+
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
+
else
|
14
|
+
load
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Name
|
4
|
-
attr_reader :name
|
5
|
-
def self.is(name)
|
6
|
-
url = "#{Ygoprodeck::Endpoint.is}?name=#{name}"
|
7
|
-
uri = URI(url)
|
8
|
-
response = Net::HTTP.get(uri)
|
9
|
-
load = JSON.parse(response)
|
10
|
-
|
11
|
-
if load[0] == nil
|
12
|
-
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
-
else
|
14
|
-
load[0]
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Name
|
4
|
+
attr_reader :name
|
5
|
+
def self.is(name)
|
6
|
+
url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?name=#{name}"
|
7
|
+
uri = URI(url)
|
8
|
+
response = Net::HTTP.get(uri)
|
9
|
+
load = JSON.parse(response)
|
10
|
+
|
11
|
+
if load['data'][0] == nil
|
12
|
+
'{"error"=>"No card matching your query was found in the database."}'
|
13
|
+
else
|
14
|
+
load['data'][0]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
module Ygoprodeck
|
3
|
-
class Card
|
4
|
-
def self.random
|
5
|
-
url = "https://db.ygoprodeck.com/api/
|
6
|
-
uri = URI(url)
|
7
|
-
response = Net::HTTP.get(uri)
|
8
|
-
load = JSON.parse(response)
|
9
|
-
load[0]
|
10
|
-
end
|
11
|
-
end
|
1
|
+
|
2
|
+
module Ygoprodeck
|
3
|
+
class Card
|
4
|
+
def self.random
|
5
|
+
url = "https://db.ygoprodeck.com/api/v7/cardinfo.php?num=1&offset=0&sort=random&cachebust"
|
6
|
+
uri = URI(url)
|
7
|
+
response = Net::HTTP.get(uri)
|
8
|
+
load = JSON.parse(response)
|
9
|
+
load['data'][0]
|
10
|
+
end
|
11
|
+
end
|
12
12
|
end
|
data/lib/ygoprodeck/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Ygoprodeck
|
2
|
-
VERSION = "1.0.
|
3
|
-
end
|
1
|
+
module Ygoprodeck
|
2
|
+
VERSION = "1.0.4"
|
3
|
+
end
|
data/lib/ygoprodeck.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
require 'net/http'
|
3
|
-
require 'json'
|
4
|
-
require 'ygoprodeck/version'
|
5
|
-
require 'ygoprodeck/errors'
|
6
|
-
require 'ygoprodeck/search/client/endpoint'
|
7
|
-
require 'ygoprodeck/search/client/image_gapis'
|
8
|
-
require 'ygoprodeck/search/card_sets'
|
9
|
-
#require 'ygoprodeck/search/all_card' # performance issue
|
10
|
-
require 'ygoprodeck/search/random'
|
11
|
-
require 'ygoprodeck/search/name'
|
12
|
-
require 'ygoprodeck/search/list'
|
13
|
-
require 'ygoprodeck/search/fuzzy_name'
|
14
|
-
require 'ygoprodeck/search/archetype'
|
15
|
-
require 'ygoprodeck/search/banlist'
|
16
|
-
|
17
|
-
module Ygoprodeck
|
18
|
-
end
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
4
|
+
require 'ygoprodeck/version'
|
5
|
+
require 'ygoprodeck/errors'
|
6
|
+
require 'ygoprodeck/search/client/endpoint'
|
7
|
+
require 'ygoprodeck/search/client/image_gapis'
|
8
|
+
require 'ygoprodeck/search/card_sets'
|
9
|
+
#require 'ygoprodeck/search/all_card' # performance issue
|
10
|
+
require 'ygoprodeck/search/random'
|
11
|
+
require 'ygoprodeck/search/name'
|
12
|
+
require 'ygoprodeck/search/list'
|
13
|
+
require 'ygoprodeck/search/fuzzy_name'
|
14
|
+
require 'ygoprodeck/search/archetype'
|
15
|
+
require 'ygoprodeck/search/banlist'
|
16
|
+
|
17
|
+
module Ygoprodeck
|
18
|
+
end
|
data/spec/archetype_spec.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
RSpec.describe Ygoprodeck do
|
2
|
-
|
3
|
-
test_spec = Ygoprodeck::Archetype.is('blue-eyes')
|
4
|
-
|
5
|
-
it "check Archetype search by name" do
|
6
|
-
expect(test_spec).not_to be nil
|
7
|
-
end
|
8
|
-
|
9
|
-
it "check Archetype search by name (index 0)" do
|
10
|
-
expect(test_spec[0]).not_to be nil
|
11
|
-
end
|
12
|
-
it "check Archetype search by name (index 1)" do
|
13
|
-
expect(test_spec[1]).not_to be nil
|
14
|
-
end
|
15
|
-
it "check Archetype search by name (index 2)" do
|
16
|
-
expect(test_spec[2]).not_to be nil
|
17
|
-
end
|
18
|
-
|
1
|
+
RSpec.describe Ygoprodeck do
|
2
|
+
|
3
|
+
test_spec = Ygoprodeck::Archetype.is('blue-eyes')
|
4
|
+
|
5
|
+
it "check Archetype search by name" do
|
6
|
+
expect(test_spec).not_to be nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "check Archetype search by name (index 0)" do
|
10
|
+
expect(test_spec[0]).not_to be nil
|
11
|
+
end
|
12
|
+
it "check Archetype search by name (index 1)" do
|
13
|
+
expect(test_spec[1]).not_to be nil
|
14
|
+
end
|
15
|
+
it "check Archetype search by name (index 2)" do
|
16
|
+
expect(test_spec[2]).not_to be nil
|
17
|
+
end
|
18
|
+
|
19
19
|
end
|
data/spec/banlist_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
RSpec.describe Ygoprodeck do
|
2
|
-
|
3
|
-
it "check Banlist TCG" do
|
4
|
-
expect(Ygoprodeck::Banlist.tcg).not_to be nil
|
5
|
-
end
|
6
|
-
it "check Banlist OCG" do
|
7
|
-
expect(Ygoprodeck::Banlist.ocg).not_to be nil
|
8
|
-
end
|
9
|
-
it "check Banlist GOAT" do
|
10
|
-
expect(Ygoprodeck::Banlist.goat).not_to be nil
|
11
|
-
end
|
12
|
-
|
1
|
+
RSpec.describe Ygoprodeck do
|
2
|
+
|
3
|
+
it "check Banlist TCG" do
|
4
|
+
expect(Ygoprodeck::Banlist.tcg).not_to be nil
|
5
|
+
end
|
6
|
+
it "check Banlist OCG" do
|
7
|
+
expect(Ygoprodeck::Banlist.ocg).not_to be nil
|
8
|
+
end
|
9
|
+
it "check Banlist GOAT" do
|
10
|
+
expect(Ygoprodeck::Banlist.goat).not_to be nil
|
11
|
+
end
|
12
|
+
|
13
13
|
end
|
data/spec/cardsets_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
RSpec.describe Ygoprodeck do
|
3
|
-
it "Check Card sets" do
|
4
|
-
expect(Ygoprodeck::Card.sets).not_to be nil
|
5
|
-
end
|
6
|
-
|
1
|
+
|
2
|
+
RSpec.describe Ygoprodeck do
|
3
|
+
it "Check Card sets" do
|
4
|
+
expect(Ygoprodeck::Card.sets).not_to be nil
|
5
|
+
end
|
6
|
+
|
7
7
|
end
|
data/spec/fuzzy_name_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
RSpec.describe Ygoprodeck do
|
2
|
-
it "check search by fuzzy name" do
|
3
|
-
expect(Ygoprodeck::Fname.is('dark magician')).not_to be nil
|
4
|
-
end
|
5
|
-
|
6
|
-
it "check search by fuzzy name spesific" do
|
7
|
-
spec_name = Ygoprodeck::Fname.is('dark magician')
|
8
|
-
expect(spec_name['id']).to eq(
|
9
|
-
end
|
10
|
-
end
|
1
|
+
RSpec.describe Ygoprodeck do
|
2
|
+
it "check search by fuzzy name" do
|
3
|
+
expect(Ygoprodeck::Fname.is('dark magician')).not_to be nil
|
4
|
+
end
|
5
|
+
|
6
|
+
it "check search by fuzzy name spesific" do
|
7
|
+
spec_name = Ygoprodeck::Fname.is('dark magician')
|
8
|
+
expect(spec_name['id']).to eq(46986414)
|
9
|
+
end
|
10
|
+
end
|
data/spec/image_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
RSpec.describe Ygoprodeck do
|
3
|
-
it "Check image" do
|
4
|
-
expect(Ygoprodeck::Image.is('46986414')).not_to be nil
|
5
|
-
end
|
6
|
-
|
7
|
-
it "Check image small" do
|
8
|
-
expect(Ygoprodeck::Image_small.is('46986414')).not_to be nil
|
9
|
-
end
|
10
|
-
|
1
|
+
|
2
|
+
RSpec.describe Ygoprodeck do
|
3
|
+
it "Check image" do
|
4
|
+
expect(Ygoprodeck::Image.is('46986414')).not_to be nil
|
5
|
+
end
|
6
|
+
|
7
|
+
it "Check image small" do
|
8
|
+
expect(Ygoprodeck::Image_small.is('46986414')).not_to be nil
|
9
|
+
end
|
10
|
+
|
11
11
|
end
|
data/spec/list_spec.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
RSpec.describe Ygoprodeck do
|
2
|
-
|
3
|
-
test_spec = Ygoprodeck::List.is('karakuri')
|
4
|
-
|
5
|
-
it "check list search by name" do
|
6
|
-
expect(test_spec).not_to be nil
|
7
|
-
end
|
8
|
-
|
9
|
-
it "check list search by name (index 0)" do
|
10
|
-
expect(test_spec[0]).not_to be nil
|
11
|
-
end
|
12
|
-
it "check list search by name (index 1)" do
|
13
|
-
expect(test_spec[1]).not_to be nil
|
14
|
-
end
|
15
|
-
it "check list search by name (index 2)" do
|
16
|
-
expect(test_spec[2]).not_to be nil
|
17
|
-
end
|
18
|
-
|
1
|
+
RSpec.describe Ygoprodeck do
|
2
|
+
|
3
|
+
test_spec = Ygoprodeck::List.is('karakuri')
|
4
|
+
|
5
|
+
it "check list search by name" do
|
6
|
+
expect(test_spec).not_to be nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "check list search by name (index 0)" do
|
10
|
+
expect(test_spec[0]).not_to be nil
|
11
|
+
end
|
12
|
+
it "check list search by name (index 1)" do
|
13
|
+
expect(test_spec[1]).not_to be nil
|
14
|
+
end
|
15
|
+
it "check list search by name (index 2)" do
|
16
|
+
expect(test_spec[2]).not_to be nil
|
17
|
+
end
|
18
|
+
|
19
19
|
end
|
data/spec/name_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
RSpec.describe Ygoprodeck do
|
2
|
-
it "check search by name" do
|
3
|
-
expect(Ygoprodeck::Name.is('dark magician')).not_to be nil
|
4
|
-
end
|
5
|
-
|
6
|
-
it "check search by name spesific" do
|
7
|
-
spec_name = Ygoprodeck::Name.is('dark magician')
|
8
|
-
expect(spec_name['name']).to eq('Dark Magician')
|
9
|
-
end
|
1
|
+
RSpec.describe Ygoprodeck do
|
2
|
+
it "check search by name" do
|
3
|
+
expect(Ygoprodeck::Name.is('dark magician')).not_to be nil
|
4
|
+
end
|
5
|
+
|
6
|
+
it "check search by name spesific" do
|
7
|
+
spec_name = Ygoprodeck::Name.is('dark magician')
|
8
|
+
expect(spec_name['name']).to eq('Dark Magician')
|
9
|
+
end
|
10
10
|
end
|
data/spec/random_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
RSpec.describe Ygoprodeck do
|
3
|
-
it
|
4
|
-
expect(Ygoprodeck::Card.random).not_to be nil
|
5
|
-
end
|
6
|
-
|
1
|
+
|
2
|
+
RSpec.describe Ygoprodeck do
|
3
|
+
it 'Check random search' do
|
4
|
+
expect(Ygoprodeck::Card.random).not_to be nil
|
5
|
+
end
|
6
|
+
|
7
7
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "ygoprodeck"
|
3
|
-
|
4
|
-
RSpec.configure do |config|
|
5
|
-
# Enable flags like --only-failures and --next-failure
|
6
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
-
|
8
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
-
config.disable_monkey_patching!
|
10
|
-
|
11
|
-
config.expect_with :rspec do |c|
|
12
|
-
c.syntax = :expect
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require "bundler/setup"
|
2
|
+
require "ygoprodeck"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
data/spec/ygoprodeck_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
RSpec.describe Ygoprodeck do
|
3
|
-
it
|
4
|
-
expect(Ygoprodeck::VERSION).not_to be nil
|
5
|
-
end
|
6
|
-
|
7
|
-
it
|
8
|
-
expect(Ygoprodeck::Endpoint.is).not_to be nil
|
9
|
-
end
|
10
|
-
|
1
|
+
|
2
|
+
RSpec.describe Ygoprodeck do
|
3
|
+
it 'Check version gem' do
|
4
|
+
expect(Ygoprodeck::VERSION).not_to be nil
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'Check endpoint' do
|
8
|
+
expect(Ygoprodeck::Endpoint.is).not_to be nil
|
9
|
+
end
|
10
|
+
|
11
11
|
end
|