nameday_api 1.0.0 → 2.0.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: e1c389384d260393624ca65aa8faad882ebf99d5959f4fa9ead8ae86c3c68738
4
- data.tar.gz: 05366d2e56f058b7194947628ac02b870b4b9aca1d8110bd44481549d301702e
3
+ metadata.gz: a6a6bdd4ede30386e199c457f454d2a34c33c27f2d26af800978d792d8606419
4
+ data.tar.gz: 2568fb8dbcffcc4ccaff2222aaf2d37095555f72f0a7de77f238ec50641b1f03
5
5
  SHA512:
6
- metadata.gz: e80cafabc6e4a5289155ca3006b7942a2a966218747e8122aa0664bdf8d785e08df8ba3751c6cf98d563e607c4bfd58d652d37a03124cfad5b3dd2a2f1b97fd1
7
- data.tar.gz: 79947b040c3b4607388a5ea7f14c8cc96837fbea0af08cd14b24a8b3bdf735a1effa2d4c6c1f4517f2bd127318eb3006cf0cefcba82ac115a95687ec33170d2c
6
+ metadata.gz: 28d9b6da73ef4a00c8cb67b0934b77d4cb56393490a80350818b7a5ab37866278f6cefac6ade27f4011a969cc14aec6f9cdd52cf409724e8efdd01929d3bead8
7
+ data.tar.gz: abe90f95c360796ab084625a1cff1c82026aeab7db4c3f85d9e13eeb7676d2f5b94b701558b2ca19712be21634d916938874f197626a5079736942c9ec867298
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
  gem 'rake', '~> 13.0'
8
8
  gem 'rspec-rails'
9
+ gem 'rubocop'
9
10
  group :test do
10
11
  gem 'webmock'
11
12
  end
data/Gemfile.lock CHANGED
@@ -1,96 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nameday_api (1.0.0)
4
+ nameday_api (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (7.1.1)
10
- actionview (= 7.1.1)
11
- activesupport (= 7.1.1)
12
- nokogiri (>= 1.8.5)
13
- rack (>= 2.2.4)
14
- rack-session (>= 1.0.1)
9
+ actionpack (6.1.7.6)
10
+ actionview (= 6.1.7.6)
11
+ activesupport (= 6.1.7.6)
12
+ rack (~> 2.0, >= 2.0.9)
15
13
  rack-test (>= 0.6.3)
16
- rails-dom-testing (~> 2.2)
17
- rails-html-sanitizer (~> 1.6)
18
- actionview (7.1.1)
19
- activesupport (= 7.1.1)
14
+ rails-dom-testing (~> 2.0)
15
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
16
+ actionview (6.1.7.6)
17
+ activesupport (= 6.1.7.6)
20
18
  builder (~> 3.1)
21
- erubi (~> 1.11)
22
- rails-dom-testing (~> 2.2)
23
- rails-html-sanitizer (~> 1.6)
24
- activesupport (7.1.1)
25
- base64
26
- bigdecimal
19
+ erubi (~> 1.4)
20
+ rails-dom-testing (~> 2.0)
21
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
22
+ activesupport (6.1.7.6)
27
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
- connection_pool (>= 2.2.5)
29
- drb
30
24
  i18n (>= 1.6, < 2)
31
25
  minitest (>= 5.1)
32
- mutex_m
33
26
  tzinfo (~> 2.0)
27
+ zeitwerk (~> 2.3)
34
28
  addressable (2.8.5)
35
29
  public_suffix (>= 2.0.2, < 6.0)
36
- base64 (0.1.1)
37
- bigdecimal (3.1.4)
30
+ ast (2.4.2)
38
31
  builder (3.2.4)
39
32
  concurrent-ruby (1.2.2)
40
- connection_pool (2.4.1)
41
33
  crack (0.4.5)
42
34
  rexml
43
35
  crass (1.0.6)
44
36
  diff-lcs (1.5.0)
45
- drb (2.1.1)
46
- ruby2_keywords
47
37
  erubi (1.12.0)
48
38
  hashdiff (1.0.1)
49
39
  i18n (1.14.1)
50
40
  concurrent-ruby (~> 1.0)
51
- io-console (0.6.0)
52
- irb (1.8.3)
53
- rdoc
54
- reline (>= 0.3.8)
41
+ json (2.6.3)
55
42
  loofah (2.21.4)
56
43
  crass (~> 1.0.2)
57
44
  nokogiri (>= 1.12.0)
45
+ method_source (1.0.0)
46
+ mini_portile2 (2.8.5)
58
47
  minitest (5.20.0)
59
- mutex_m (0.1.2)
60
- nokogiri (1.15.4-x86_64-darwin)
48
+ nokogiri (1.13.10)
49
+ mini_portile2 (~> 2.8.0)
61
50
  racc (~> 1.4)
62
- psych (5.1.1.1)
63
- stringio
51
+ parallel (1.23.0)
52
+ parser (3.2.2.4)
53
+ ast (~> 2.4.1)
54
+ racc
64
55
  public_suffix (5.0.3)
65
56
  racc (1.7.1)
66
- rack (3.0.8)
67
- rack-session (2.0.0)
68
- rack (>= 3.0.0)
57
+ rack (2.2.8)
69
58
  rack-test (2.1.0)
70
59
  rack (>= 1.3)
71
- rackup (2.1.0)
72
- rack (>= 3)
73
- webrick (~> 1.8)
74
60
  rails-dom-testing (2.2.0)
75
61
  activesupport (>= 5.0.0)
76
62
  minitest
77
63
  nokogiri (>= 1.6)
78
- rails-html-sanitizer (1.6.0)
79
- loofah (~> 2.21)
80
- nokogiri (~> 1.14)
81
- railties (7.1.1)
82
- actionpack (= 7.1.1)
83
- activesupport (= 7.1.1)
84
- irb
85
- rackup (>= 1.0.0)
64
+ rails-html-sanitizer (1.5.0)
65
+ loofah (~> 2.19, >= 2.19.1)
66
+ railties (6.1.7.6)
67
+ actionpack (= 6.1.7.6)
68
+ activesupport (= 6.1.7.6)
69
+ method_source
86
70
  rake (>= 12.2)
87
- thor (~> 1.0, >= 1.2.2)
88
- zeitwerk (~> 2.6)
71
+ thor (~> 1.0)
72
+ rainbow (3.1.1)
89
73
  rake (13.0.6)
90
- rdoc (6.5.0)
91
- psych (>= 4.0.0)
92
- reline (0.3.9)
93
- io-console (~> 0.5)
74
+ regexp_parser (2.8.2)
94
75
  rexml (3.2.6)
95
76
  rspec-core (3.12.2)
96
77
  rspec-support (~> 3.12.0)
@@ -109,26 +90,38 @@ GEM
109
90
  rspec-mocks (~> 3.12)
110
91
  rspec-support (~> 3.12)
111
92
  rspec-support (3.12.1)
112
- ruby2_keywords (0.0.5)
113
- stringio (3.0.8)
93
+ rubocop (1.50.2)
94
+ json (~> 2.3)
95
+ parallel (~> 1.10)
96
+ parser (>= 3.2.0.0)
97
+ rainbow (>= 2.2.2, < 4.0)
98
+ regexp_parser (>= 1.8, < 3.0)
99
+ rexml (>= 3.2.5, < 4.0)
100
+ rubocop-ast (>= 1.28.0, < 2.0)
101
+ ruby-progressbar (~> 1.7)
102
+ unicode-display_width (>= 2.4.0, < 3.0)
103
+ rubocop-ast (1.29.0)
104
+ parser (>= 3.2.1.0)
105
+ ruby-progressbar (1.13.0)
114
106
  thor (1.3.0)
115
107
  tzinfo (2.0.6)
116
108
  concurrent-ruby (~> 1.0)
109
+ unicode-display_width (2.5.0)
117
110
  webmock (3.19.1)
118
111
  addressable (>= 2.8.0)
119
112
  crack (>= 0.3.2)
120
113
  hashdiff (>= 0.4.0, < 2.0.0)
121
- webrick (1.8.1)
122
114
  zeitwerk (2.6.12)
123
115
 
124
116
  PLATFORMS
125
- x86_64-darwin-21
117
+ ruby
126
118
 
127
119
  DEPENDENCIES
128
120
  nameday_api!
129
121
  rake (~> 13.0)
130
122
  rspec-rails
123
+ rubocop
131
124
  webmock
132
125
 
133
126
  BUNDLED WITH
134
- 2.4.21
127
+ 1.17.2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module NamedayApi
4
- VERSION = '1.0.0'
3
+ class NamedayApi
4
+ VERSION = '2.0.0'
5
5
  end
data/lib/nameday_api.rb CHANGED
@@ -3,44 +3,44 @@
3
3
  require 'net/http'
4
4
  require 'json'
5
5
 
6
- # Module: NamedayApi
7
- module NamedayApi
6
+ # Class: NamedayApi
7
+ class NamedayApi
8
8
  BASE_URL = 'https://nameday.abalin.net/api/V1'
9
9
 
10
- def fetch_and_parse(url)
11
- uri = URI(url)
12
- response = Net::HTTP.get(uri)
13
- JSON.parse(response)
14
- end
15
-
16
- def fetch_data(endpoint, options = {})
17
- url = "#{BASE_URL}/#{endpoint}"
18
-
19
- query_params = options.map { |key, value| "#{key}=#{value}" if value }.compact
20
- url += "?#{query_params.join('&')}" unless query_params.empty?
21
-
22
- fetch_and_parse(url)
23
- end
24
-
25
- def today(country_code = nil, time_zone = nil)
10
+ def self.today(country_code = nil, time_zone = nil)
26
11
  fetch_data('today', country: country_code, timezone: time_zone)
27
12
  end
28
13
 
29
- def tomorrow(country_code = nil, time_zone = nil)
14
+ def self.tomorrow(country_code = nil, time_zone = nil)
30
15
  fetch_data('tomorrow', country: country_code, timezone: time_zone)
31
16
  end
32
17
 
33
- def yesterday(country_code = nil, time_zone = nil)
18
+ def self.yesterday(country_code = nil, time_zone = nil)
34
19
  fetch_data('yesterday', country: country_code, timezone: time_zone)
35
20
  end
36
21
 
37
- def specific_day(day, month, country_code = nil)
22
+ def self.specific_day(day, month, country_code = nil)
38
23
  options = { day: day, month: month, country: country_code }
39
24
  fetch_data('getdate', options)
40
25
  end
41
26
 
42
- def search_by_name(name, country_code)
27
+ def self.search_by_name(name, country_code)
43
28
  options = { name: name, country: country_code }
44
29
  fetch_data('getname', options)
45
30
  end
31
+
32
+ def self.fetch_and_parse(url)
33
+ uri = URI(url)
34
+ response = Net::HTTP.get(uri)
35
+ JSON.parse(response)
36
+ end
37
+
38
+ def self.fetch_data(endpoint, options = {})
39
+ url = "#{BASE_URL}/#{endpoint}"
40
+
41
+ query_params = options.map { |key, value| "#{key}=#{value}" if value }.compact
42
+ url += "?#{query_params.join('&')}" unless query_params.empty?
43
+
44
+ fetch_and_parse(url)
45
+ end
46
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nameday_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniyal Qureshi