ygoprodeck 1.0.7 → 1.1.0

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: e53f20b5354b1ac1a2532f84eae83110c4a65ef26dac5c4b9e3412b4c1aeb228
4
- data.tar.gz: 4e03b5f1ef075c30492bcd6d52459a70b0575230707b1706a593ea1b0544d119
3
+ metadata.gz: d7b8e5947a55893879f833bb1c573581a1debaacd252719387115e5e8d80c52c
4
+ data.tar.gz: d5f68bbfccb2a899f822cdf4742db3bbcc3ac80651ebc9c7b56e16483de02a11
5
5
  SHA512:
6
- metadata.gz: aecc0495d0a3ec55e908d394197031a5ce3d3621f36fceb2467cfa77b8b6f18b5baf1a765c586e3b25944e4f1c5dd37dceb97028f5f79cbd9ab77203559d9ca8
7
- data.tar.gz: 3f01529f717c70201c6ba67139f3ad4cd7583537ce4c2f22f12633d992fa2c193cab057bd9d75c4618bee7bea4bac45e378cf62f6b232e5deddda76a763cd5a5
6
+ metadata.gz: 3f5ce7c3509147d7d1eb318449af73ccc5724c9445ddd91c1554d4c56d12a2eab985f318164bc32f9c560ac8846a736e11f12360a32dc6004f036513241b0311
7
+ data.tar.gz: 3e3dcf4a3907d631579aaa30069fef46c0d633012c85ee89e797ad3f9726ba5d1e28d6206c73d469732702af1d6a138ad1240300c66f1e4198e3a1b745deed17
@@ -0,0 +1,29 @@
1
+ name: Ruby Gem CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ matrix:
14
+ ruby-version: [3.3]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: false
24
+
25
+ - name: Install bundler and run tests
26
+ run: |
27
+ gem install bundler -v 2.5.23
28
+ bundle _2.5.23_ install
29
+ bundle _2.5.23_ exec rspec --format documentation
data/.gitignore CHANGED
@@ -6,9 +6,8 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
-
10
- # rspec failure tracking
9
+ node_modules
11
10
  .rspec_status
12
-
13
- # update ignore
14
11
  Gemfile.lock
12
+ package-lock.json
13
+ .rubocop_todo.yml
data/.rubocop.yml CHANGED
@@ -1,40 +1,10 @@
1
- # Disable all metrics.
2
- Metrics/AbcSize:
3
- Enabled: false
4
-
5
- Metrics/BlockNesting:
6
- Enabled: false
7
-
8
- Metrics/BlockLength:
9
- Enabled: false
10
-
11
- Metrics/ClassLength:
12
- Enabled: false
13
-
14
- Metrics/ModuleLength:
15
- Enabled: false
16
-
17
- Metrics/CyclomaticComplexity:
18
- Enabled: false
19
-
20
- Metrics/LineLength:
21
- Enabled: false
22
-
23
- Metrics/MethodLength:
24
- Enabled: false
25
-
26
- Metrics/ParameterLists:
27
- Enabled: false
28
-
29
- Metrics/PerceivedComplexity:
30
- Enabled: false
31
-
32
- Security/Eval:
33
- Enabled: false
34
-
35
- Style/ClassAndModuleChildren:
36
- Enabled: false
37
-
38
- Style/FrozenStringLiteralComment:
39
- Enabled: false
40
-
1
+ inherit_from: .rubocop_todo.yml
2
+ AllCops:
3
+ Include:
4
+ - "**/*.rb"
5
+ - "**/*.rake"
6
+ - "."
7
+ Exclude:
8
+ - "vendor/**/*"
9
+ - "db/schema.rb"
10
+ NewCops: enable
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec name: 'ygoprodeck'
4
+
5
+ gem 'rubocop', '1.80.0'
data/README.md CHANGED
@@ -24,61 +24,98 @@ Or install it yourself as:
24
24
  $ gem install ygoprodeck
25
25
 
26
26
  ## Usage
27
- First :
27
+
28
28
  ```ruby
29
29
  require 'ygoprodeck'
30
30
  ```
31
31
 
32
- Fuzzy search : (RECOMMENDED)
32
+ Search card by id :
33
+
33
34
  ```ruby
34
- Ygoprodeck::Fname.is(name card)
35
+ Ygoprodeck::ID.is(*id)
35
36
  ```
36
37
 
37
- Normal search :
38
+ Search card by name :
39
+
38
40
  ```ruby
39
- Ygoprodeck::Name.is(name card)
41
+ Ygoprodeck::Name.is(*name)
40
42
  ```
41
43
 
42
- Random search :
44
+ search card by name (use method fuzzy) :
45
+
43
46
  ```ruby
44
- Ygoprodeck::Card.random
47
+ Ygoprodeck::Fname.is(*name)
45
48
  ```
46
49
 
47
- List search :
50
+ Search list card by name:
51
+
48
52
  ```ruby
49
- Ygoprodeck::List.is(name card)
53
+ Ygoprodeck::List.is(*name)
50
54
  ```
51
55
 
52
- Archetype search :
56
+ Search Archtype by name:
57
+
53
58
  ```ruby
54
- Ygoprodeck::Archetype.is(name archetype)
59
+ Ygoprodeck::Archetype.is(*name)
60
+ ```
61
+
62
+ Matching card by name :
63
+
64
+ ```ruby
65
+ Ygoprodeck::Match.is(*name)
66
+ ```
67
+
68
+ Random card :
69
+
70
+ ```ruby
71
+ Ygoprodeck::Card.random
55
72
  ```
56
73
 
57
74
  All card sets :
75
+
58
76
  ```ruby
59
77
  Ygoprodeck::Card.sets
60
78
  ```
61
79
 
62
- Banlist (TCG, OCG, GOAT) :
80
+ Banlist (MasterDuel, TCG, OCG, GOAT) :
81
+
63
82
  ```ruby
83
+ Ygoprodeck::Banlist.md
64
84
  Ygoprodeck::Banlist.tcg
65
85
  Ygoprodeck::Banlist.ocg
66
86
  Ygoprodeck::Banlist.goat
67
87
  ```
68
88
 
69
89
  Check Database Version :
90
+
70
91
  ```ruby
71
92
  Ygoprodeck::CheckDbVer.info
72
93
  ```
73
94
 
74
- or look [examples](https://github.com/rokhimin/ygoprodeck/blob/master/examples)
95
+ Image card :
96
+
97
+ ```ruby
98
+ yugi = Ygoprodeck::Fname.is(*name)
99
+ Ygoprodeck::Image.is(yugi['id'])
100
+ ```
101
+
102
+ Cropped Image card (Art) :
103
+
104
+ ```ruby
105
+ yugi = Ygoprodeck::Fname.is(*name)
106
+ Ygoprodeck::Image_small.is(yugi['id'])
107
+ ```
108
+
109
+ or look [examples](https://github.com/whdzera/ygoprodeck/blob/master/examples)
110
+
111
+ #### Noted
75
112
 
76
- #### Noted
77
113
  Rate Limiting on the API is enabled. The rate limit is 20 requests per 1 second
78
114
 
79
115
  #### Response Information
80
116
 
81
117
  ##### Monster Cards
118
+
82
119
  - id - ID or Passocde of the card.
83
120
  - name - Name of the card.
84
121
  - type - The type of card you are viewing (Normal Monster, Effect Monster, Synchro Monster, etc).
@@ -109,15 +146,19 @@ Rate Limiting on the API is enabled. The rate limit is 20 requests per 1 second
109
146
  ## Development
110
147
 
111
148
  #### Unit Test
149
+
112
150
  ```
113
- rspec
151
+ rake spec
114
152
  ```
115
153
 
116
154
  ## Contributing
117
- Fork and Pull Request to contibuting https://github.com/rokhimin/ygoprodeck .
155
+
156
+ Fork and Pull Request to contibuting https://github.com/whdzera/ygoprodeck .
118
157
 
119
158
  ## License
159
+
120
160
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
121
161
 
122
162
  ## Code of Conduct
123
- Everyone interacting in the Ygoprodeck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rokhimin/ygoprodeck/blob/master/CODE_OF_CONDUCT.md).
163
+
164
+ Everyone interacting in the Ygoprodeck project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/whdzera/ygoprodeck/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec) do |t|
5
- t.pattern = 'spec/**/*_spec.rb'
5
+ t.pattern = 'spec/**/*_spec.rb'
6
+ t.rspec_opts = '--format documentation'
6
7
  end
7
8
 
8
9
  task default: :spec
@@ -1,23 +1,23 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
3
  # kaiba is example, you free to change card name
4
- kaiba = Ygoprodeck::Archetype.is('blue-eyes') # example I wanna search 'blue-eyes' archetype
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
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
5
20
 
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
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
22
+ puts "#" * 30
23
+ puts "#{kaiba_listing.join(" \n")}" # each listing
data/examples/banlist.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
3
  puts Ygoprodeck::Banlist.tcg
4
4
  #puts Ygoprodeck::Banlist.ocg
5
- #puts Ygoprodeck::Banlist.goat
5
+ #puts Ygoprodeck::Banlist.goat
data/examples/check_db.rb CHANGED
@@ -1,3 +1,3 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
- puts Ygoprodeck::CheckDbVer.info
3
+ puts Ygoprodeck::CheckDbVer.info
data/examples/id.rb ADDED
@@ -0,0 +1,25 @@
1
+ require "ygoprodeck"
2
+
3
+ yugi = Ygoprodeck::ID.is("46986414")
4
+
5
+ case
6
+ when yugi == nil
7
+ puts "Card not found"
8
+ else
9
+ puts yugi # => get all information of dark magician (name,id,level,attr,atk,def,etc)
10
+
11
+ puts "#" * 10
12
+
13
+ # => get specific information of dark magician
14
+ puts yugi["id"]
15
+ puts yugi["name"]
16
+ puts yugi["attribute"]
17
+ puts yugi["type"]
18
+ puts yugi["race"]
19
+ puts yugi["level"]
20
+ puts yugi["desc"]
21
+ puts yugi["atk"]
22
+ puts yugi["def"]
23
+ puts Ygoprodeck::Image.is(yugi["id"]) # => use id from yugi['id'] to get dark magician image
24
+ puts Ygoprodeck::Image_small.is(yugi["id"]) # => small version
25
+ end
data/examples/match.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'ygoprodeck'
2
+
3
+ yugi = Ygoprodeck::Match.is('bardiche')
4
+
5
+ puts yugi
6
+
data/examples/random.rb CHANGED
@@ -1,18 +1,18 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
3
  yugi = Ygoprodeck::Card.random
4
- puts yugi
4
+ puts yugi
5
5
 
6
- puts '#' *10
6
+ puts "#" * 10
7
7
 
8
- puts yugi['id']
9
- puts yugi['name']
10
- puts yugi['attribute']
11
- puts yugi['type']
12
- puts yugi['race']
13
- puts yugi['level']
14
- puts yugi['desc']
15
- puts yugi['atk']
16
- puts yugi['def']
17
- puts Ygoprodeck::Image.is(yugi['id'])
18
- puts Ygoprodeck::Image_small.is(yugi['id'])
8
+ puts yugi["id"]
9
+ puts yugi["name"]
10
+ puts yugi["attribute"]
11
+ puts yugi["type"]
12
+ puts yugi["race"]
13
+ puts yugi["level"]
14
+ puts yugi["desc"]
15
+ puts yugi["atk"]
16
+ puts yugi["def"]
17
+ puts Ygoprodeck::Image.is(yugi["id"])
18
+ puts Ygoprodeck::Image_small.is(yugi["id"])
data/examples/search.rb CHANGED
@@ -1,27 +1,26 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
3
  # yugi is example, you free to change name card
4
- yugi = Ygoprodeck::Name.is('dark magician') # example I wanna search 'dark magician' using fuzzy search
4
+ yugi = Ygoprodeck::Name.is("dark magician") # example I wanna search 'dark magician' using fuzzy search
5
5
 
6
6
  case
7
- when yugi == nil
8
- puts "Card not found"
9
- else
10
- puts yugi # => get all information of dark magician (name,id,level,attr,atk,def,etc)
7
+ when yugi == nil
8
+ puts "Card not found"
9
+ else
10
+ puts yugi # => get all information of dark magician (name,id,level,attr,atk,def,etc)
11
11
 
12
- puts '#' *10
12
+ puts "#" * 10
13
13
 
14
-
15
- # => get specific information of dark magician
16
- puts yugi['id']
17
- puts yugi['name']
18
- puts yugi['attribute']
19
- puts yugi['type']
20
- puts yugi['race']
21
- puts yugi['level']
22
- puts yugi['desc']
23
- puts yugi['atk']
24
- puts yugi['def']
25
- puts Ygoprodeck::Image.is(yugi['id']) # => use id from yugi['id'] to get dark magician image
26
- puts Ygoprodeck::Image_small.is(yugi['id']) # => small version
14
+ # => get specific information of dark magician
15
+ puts yugi["id"]
16
+ puts yugi["name"]
17
+ puts yugi["attribute"]
18
+ puts yugi["type"]
19
+ puts yugi["race"]
20
+ puts yugi["level"]
21
+ puts yugi["desc"]
22
+ puts yugi["atk"]
23
+ puts yugi["def"]
24
+ puts Ygoprodeck::Image.is(yugi["id"]) # => use id from yugi['id'] to get dark magician image
25
+ puts Ygoprodeck::Image_small.is(yugi["id"]) # => small version
27
26
  end
@@ -1,27 +1,26 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
3
  # yugi is example, you free to change name card
4
- yugi = Ygoprodeck::Fname.is('dark magician') # example I wanna search 'dark magician' using fuzzy search
4
+ yugi = Ygoprodeck::Fname.is("dark magician") # example I wanna search 'dark magician' using fuzzy search
5
5
 
6
6
  case
7
- when yugi == nil
8
- puts "Card not found"
9
- else
10
- puts yugi # => get all information of dark magician (name,id,level,attr,atk,def,etc)
7
+ when yugi == nil
8
+ puts "Card not found"
9
+ else
10
+ puts yugi # => get all information of dark magician (name,id,level,attr,atk,def,etc)
11
11
 
12
- puts '#' *10
12
+ puts "#" * 10
13
13
 
14
-
15
- # => get specific information of dark magician
16
- puts yugi['id']
17
- puts yugi['name']
18
- puts yugi['attribute']
19
- puts yugi['type']
20
- puts yugi['race']
21
- puts yugi['level']
22
- puts yugi['desc']
23
- puts yugi['atk']
24
- puts yugi['def']
25
- puts Ygoprodeck::Image.is(yugi['id']) # => use id from yugi['id'] to get dark magician image
26
- puts Ygoprodeck::Image_small.is(yugi['id']) # => small version
14
+ # => get specific information of dark magician
15
+ puts yugi["id"]
16
+ puts yugi["name"]
17
+ puts yugi["attribute"]
18
+ puts yugi["type"]
19
+ puts yugi["race"]
20
+ puts yugi["level"]
21
+ puts yugi["desc"]
22
+ puts yugi["atk"]
23
+ puts yugi["def"]
24
+ puts Ygoprodeck::Image.is(yugi["id"]) # => use id from yugi['id'] to get dark magician image
25
+ puts Ygoprodeck::Image_small.is(yugi["id"]) # => small version
27
26
  end
data/examples/set.rb CHANGED
@@ -1,3 +1,3 @@
1
- require 'ygoprodeck'
1
+ require "ygoprodeck"
2
2
 
3
- puts Ygoprodeck::Card.sets
3
+ puts Ygoprodeck::Card.sets
@@ -1,28 +1,30 @@
1
1
  module Ygoprodeck
2
2
  class Archetype
3
3
  attr_reader :archetype
4
-
4
+
5
5
  def self.is(archetype)
6
- url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?archetype=#{URI.encode_www_form_component(archetype)}"
6
+ url =
7
+ "#{Ygoprodeck::Endpoint.is}cardinfo.php?archetype=#{URI.encode_www_form_component(archetype)}"
7
8
  uri = URI(url)
8
-
9
+
9
10
  begin
10
11
  response = Net::HTTP.get(uri)
11
12
  load = JSON.parse(response)
12
-
13
- if load['data'].nil? || load['data'].empty?
14
- { 'error' => 'No card matching your query was found in the database.' }
13
+
14
+ if load["data"].nil? || load["data"].empty?
15
+ {
16
+ "error" => "No card matching your query was found in the database."
17
+ }
15
18
  else
16
- load['data']
19
+ load["data"]
17
20
  end
18
-
19
21
  rescue JSON::ParserError => e
20
- { 'error' => 'Failed to parse JSON response' }
22
+ { "error" => "Failed to parse JSON response" }
21
23
  rescue SocketError => e
22
- { 'error' => 'Network connection error' }
24
+ { "error" => "Network connection error" }
23
25
  rescue StandardError => e
24
- { 'error' => "An unexpected error occurred: #{e.message}" }
26
+ { "error" => "An unexpected error occurred: #{e.message}" }
25
27
  end
26
28
  end
27
29
  end
28
- end
30
+ end
@@ -1,5 +1,11 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'uri'
4
+
1
5
  module Ygoprodeck
2
6
  class Banlist
7
+ API_BASE = 'https://ygoprodeck.com/api/banlist'
8
+
3
9
  def self.fetch_banlist(format)
4
10
  url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?banlist=#{format}"
5
11
  uri = URI(url)
@@ -13,16 +19,15 @@ module Ygoprodeck
13
19
  else
14
20
  load
15
21
  end
16
-
17
- rescue JSON::ParserError => e
22
+ rescue JSON::ParserError
18
23
  { 'error' => 'Failed to parse JSON response' }
19
- rescue SocketError => e
24
+ rescue SocketError
20
25
  { 'error' => 'Network connection error' }
21
26
  rescue StandardError => e
22
27
  { 'error' => "An unexpected error occurred: #{e.message}" }
23
28
  end
24
29
  end
25
-
30
+
26
31
  def self.tcg
27
32
  fetch_banlist('tcg')
28
33
  end
@@ -34,5 +39,40 @@ module Ygoprodeck
34
39
  def self.goat
35
40
  fetch_banlist('goat')
36
41
  end
42
+
43
+ def self.md
44
+
45
+ dates_uri = URI("#{API_BASE}/getBanListDates.php")
46
+ dates_res = Net::HTTP.get(dates_uri)
47
+ dates = JSON.parse(dates_res)
48
+
49
+ master_duel_dates = dates.select { |d| d['type'] == 'Master Duel' }
50
+ return { 'error' => 'No Master Duel dates found' } if master_duel_dates.empty?
51
+
52
+ latest_date = master_duel_dates.map { |d| d['date'] }.max
53
+
54
+ list_uri = URI("#{API_BASE}/getBanList.php?list=Master%20Duel&date=#{latest_date}")
55
+ req = Net::HTTP::Get.new(list_uri)
56
+ req['User-Agent'] = 'Mozilla/5.0'
57
+
58
+ res = Net::HTTP.start(list_uri.host, list_uri.port, use_ssl: true) do |http|
59
+ http.request(req)
60
+ end
61
+
62
+ load = JSON.parse(res.body)
63
+
64
+ if load.is_a?(Hash) && load.key?('error')
65
+ { 'error' => load['error'] }
66
+ else
67
+ load
68
+ end
69
+ rescue JSON::ParserError
70
+ { 'error' => 'Failed to parse JSON response' }
71
+ rescue SocketError
72
+ { 'error' => 'Network connection error' }
73
+ rescue StandardError => e
74
+ { 'error' => "An unexpected error occurred: #{e.message}" }
75
+
76
+ end
37
77
  end
38
- end
78
+ end
@@ -0,0 +1,19 @@
1
+ module Ygoprodeck
2
+ class ID
3
+ def self.is(id)
4
+ url = "#{Ygoprodeck::Endpoint.is}cardinfo.php?id=#{(id)}"
5
+ uri = URI(url)
6
+
7
+ begin
8
+ response = Net::HTTP.get(uri)
9
+ load = JSON.parse(response)
10
+
11
+ return nil if load["data"].nil? || load["data"].empty?
12
+
13
+ load["data"][0]
14
+ rescue JSON::ParserError, SocketError, StandardError => e
15
+ nil
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Ygoprodeck
2
- VERSION = "1.0.7"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/ygoprodeck.rb CHANGED
@@ -1,22 +1,10 @@
1
- require 'open-uri'
2
- require 'net/http'
3
- require 'json'
4
- require 'amatch'
5
- require 'ygoprodeck/version'
6
- require 'ygoprodeck/errors'
7
- require 'ygoprodeck/search/client/endpoint'
8
- require 'ygoprodeck/search/client/image_gapis'
9
- require 'ygoprodeck/search/card_sets'
10
- #require 'ygoprodeck/search/all_card' # performance issue
11
- require 'ygoprodeck/search/random'
12
- require 'ygoprodeck/search/name'
13
- require 'ygoprodeck/search/list'
14
- require 'ygoprodeck/search/match'
15
- require 'ygoprodeck/search/fuzzy_name'
16
- require 'ygoprodeck/search/archetype'
17
- require 'ygoprodeck/search/banlist'
18
- require 'ygoprodeck/search/check_db_version'
1
+ require "open-uri"
2
+ require "net/http"
3
+ require "json"
4
+ require "amatch"
19
5
  include Amatch
20
6
 
7
+ Dir[File.join(__dir__, "ygoprodeck/**/*.rb")].sort.each { |f| require f }
8
+
21
9
  module Ygoprodeck
22
10
  end
@@ -1,6 +1,5 @@
1
1
  RSpec.describe Ygoprodeck do
2
- it "check DB Ygoprodeck version" do
3
- expect(Ygoprodeck::CheckDbVer.info).not_to be nil
4
- end
5
-
6
- end
2
+ it "check DB Ygoprodeck version" do
3
+ expect(Ygoprodeck::CheckDbVer.info).not_to be nil
4
+ end
5
+ end
data/spec/id_spec.rb ADDED
@@ -0,0 +1,10 @@
1
+ RSpec.describe Ygoprodeck do
2
+ it "check search by id" do
3
+ expect(Ygoprodeck::ID.is("46986414")).not_to be nil
4
+ end
5
+
6
+ it "check search by id spesific" do
7
+ spec_id = Ygoprodeck::ID.is("46986414")
8
+ expect(spec_id["name"]).to eq("Dark Magician")
9
+ end
10
+ end
@@ -1,11 +1,9 @@
1
-
2
1
  RSpec.describe Ygoprodeck do
3
- it 'Check version gem' do
2
+ it "Check version gem" do
4
3
  expect(Ygoprodeck::VERSION).not_to be nil
5
4
  end
6
-
7
- it 'Check endpoint' do
5
+
6
+ it "Check endpoint" do
8
7
  expect(Ygoprodeck::Endpoint.is).not_to be nil
9
8
  end
10
-
11
- end
9
+ end
data/ygoprodeck.gemspec CHANGED
@@ -1,29 +1,29 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'ygoprodeck/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "ygoprodeck"
7
- spec.version = Ygoprodeck::VERSION
8
- spec.authors = ["Rokhimin Wahid"]
9
- spec.email = ["rokhim.whd@gmail.com"]
10
- spec.summary = "ygoprodeck API wrapper for search yugioh's card"
11
- spec.description = "ygoprodeck API wrapper for search yugioh card"
12
- spec.homepage = "http://github.com/rokhimin/ygoprodeck"
13
- spec.license = "MIT"
14
-
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
- spec.require_paths = ["lib"]
19
-
6
+ spec.name = 'ygoprodeck'
7
+ spec.version = Ygoprodeck::VERSION
8
+ spec.authors = ['Rokhimin Wahid']
9
+ spec.email = ['whdzera@gmail.com']
10
+ spec.summary = "ygoprodeck API wrapper for search yugioh's card"
11
+ spec.description = 'ygoprodeck API wrapper for search yugioh card'
12
+ spec.homepage = 'http://github.com/whdzera/ygoprodeck'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables =
17
+ `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
+ spec.require_paths = ['lib']
19
+
20
20
  spec.required_ruby_version = '>= 2.0.0'
21
21
 
22
- spec.add_dependency "amatch", "~> 0.4.1"
23
- spec.add_development_dependency "bundler", "~> 2.5.23"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
22
+ spec.add_dependency 'amatch', '~> 0.4.1'
23
+ spec.add_development_dependency 'bundler', '~> 2.5.23'
24
+ spec.add_development_dependency 'rake', '~> 13.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
26
  spec.add_development_dependency 'rspec-prof', '~> 0.0.7'
27
- spec.add_development_dependency 'rubocop', '~> 0.68.0'
28
- spec.add_development_dependency 'rubocop-performance', '~> 1.0'
27
+ spec.add_development_dependency 'syntax_tree', '6.2.0'
28
+ spec.metadata['rubygems_mfa_required'] = 'true'
29
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ygoprodeck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rokhimin Wahid
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: amatch
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '10.0'
46
+ version: '13.0'
47
47
  type: :development
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '10.0'
53
+ version: '13.0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -80,42 +80,28 @@ dependencies:
80
80
  - !ruby/object:Gem::Version
81
81
  version: 0.0.7
82
82
  - !ruby/object:Gem::Dependency
83
- name: rubocop
83
+ name: syntax_tree
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.68.0
88
+ version: 6.2.0
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: 0.68.0
96
- - !ruby/object:Gem::Dependency
97
- name: rubocop-performance
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '1.0'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
93
+ - - '='
108
94
  - !ruby/object:Gem::Version
109
- version: '1.0'
95
+ version: 6.2.0
110
96
  description: ygoprodeck API wrapper for search yugioh card
111
97
  email:
112
- - rokhim.whd@gmail.com
98
+ - whdzera@gmail.com
113
99
  executables:
114
- - console
115
100
  - setup
116
101
  extensions: []
117
102
  extra_rdoc_files: []
118
103
  files:
104
+ - ".github/workflows/ruby.yml"
119
105
  - ".gitignore"
120
106
  - ".rspec"
121
107
  - ".rubocop.yml"
@@ -124,12 +110,13 @@ files:
124
110
  - LICENSE.txt
125
111
  - README.md
126
112
  - Rakefile
127
- - bin/console
128
113
  - bin/setup
129
114
  - examples/archetype.rb
130
115
  - examples/banlist.rb
131
116
  - examples/check_db.rb
117
+ - examples/id.rb
132
118
  - examples/list.rb
119
+ - examples/match.rb
133
120
  - examples/random.rb
134
121
  - examples/search.rb
135
122
  - examples/search_fuzzy.rb
@@ -145,6 +132,7 @@ files:
145
132
  - lib/ygoprodeck/search/client/endpoint.rb
146
133
  - lib/ygoprodeck/search/client/image_gapis.rb
147
134
  - lib/ygoprodeck/search/fuzzy_name.rb
135
+ - lib/ygoprodeck/search/id.rb
148
136
  - lib/ygoprodeck/search/list.rb
149
137
  - lib/ygoprodeck/search/match.rb
150
138
  - lib/ygoprodeck/search/name.rb
@@ -155,6 +143,7 @@ files:
155
143
  - spec/cardsets_spec.rb
156
144
  - spec/check_db_spec.rb
157
145
  - spec/fuzzy_name_spec.rb
146
+ - spec/id_spec.rb
158
147
  - spec/image_spec.rb
159
148
  - spec/list_spec.rb
160
149
  - spec/name_spec.rb
@@ -163,10 +152,11 @@ files:
163
152
  - spec/ygoprodeck/response_example.json
164
153
  - spec/ygoprodeck_spec.rb
165
154
  - ygoprodeck.gemspec
166
- homepage: http://github.com/rokhimin/ygoprodeck
155
+ homepage: http://github.com/whdzera/ygoprodeck
167
156
  licenses:
168
157
  - MIT
169
- metadata: {}
158
+ metadata:
159
+ rubygems_mfa_required: 'true'
170
160
  rdoc_options: []
171
161
  require_paths:
172
162
  - lib
@@ -181,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
171
  - !ruby/object:Gem::Version
182
172
  version: '0'
183
173
  requirements: []
184
- rubygems_version: 3.6.3
174
+ rubygems_version: 3.7.1
185
175
  specification_version: 4
186
176
  summary: ygoprodeck API wrapper for search yugioh's card
187
177
  test_files: []
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "ygoprodeck"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)