nameday_api 1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e1c389384d260393624ca65aa8faad882ebf99d5959f4fa9ead8ae86c3c68738
4
+ data.tar.gz: 05366d2e56f058b7194947628ac02b870b4b9aca1d8110bd44481549d301702e
5
+ SHA512:
6
+ metadata.gz: e80cafabc6e4a5289155ca3006b7942a2a966218747e8122aa0664bdf8d785e08df8ba3751c6cf98d563e607c4bfd58d652d37a03124cfad5b3dd2a2f1b97fd1
7
+ data.tar.gz: 79947b040c3b4607388a5ea7f14c8cc96837fbea0af08cd14b24a8b3bdf735a1effa2d4c6c1f4517f2bd127318eb3006cf0cefcba82ac115a95687ec33170d2c
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in nameday_api.gemspec
6
+ gemspec
7
+ gem 'rake', '~> 13.0'
8
+ gem 'rspec-rails'
9
+ group :test do
10
+ gem 'webmock'
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,134 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nameday_api (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
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)
15
+ 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)
20
+ 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
27
+ concurrent-ruby (~> 1.0, >= 1.0.2)
28
+ connection_pool (>= 2.2.5)
29
+ drb
30
+ i18n (>= 1.6, < 2)
31
+ minitest (>= 5.1)
32
+ mutex_m
33
+ tzinfo (~> 2.0)
34
+ addressable (2.8.5)
35
+ public_suffix (>= 2.0.2, < 6.0)
36
+ base64 (0.1.1)
37
+ bigdecimal (3.1.4)
38
+ builder (3.2.4)
39
+ concurrent-ruby (1.2.2)
40
+ connection_pool (2.4.1)
41
+ crack (0.4.5)
42
+ rexml
43
+ crass (1.0.6)
44
+ diff-lcs (1.5.0)
45
+ drb (2.1.1)
46
+ ruby2_keywords
47
+ erubi (1.12.0)
48
+ hashdiff (1.0.1)
49
+ i18n (1.14.1)
50
+ concurrent-ruby (~> 1.0)
51
+ io-console (0.6.0)
52
+ irb (1.8.3)
53
+ rdoc
54
+ reline (>= 0.3.8)
55
+ loofah (2.21.4)
56
+ crass (~> 1.0.2)
57
+ nokogiri (>= 1.12.0)
58
+ minitest (5.20.0)
59
+ mutex_m (0.1.2)
60
+ nokogiri (1.15.4-x86_64-darwin)
61
+ racc (~> 1.4)
62
+ psych (5.1.1.1)
63
+ stringio
64
+ public_suffix (5.0.3)
65
+ racc (1.7.1)
66
+ rack (3.0.8)
67
+ rack-session (2.0.0)
68
+ rack (>= 3.0.0)
69
+ rack-test (2.1.0)
70
+ rack (>= 1.3)
71
+ rackup (2.1.0)
72
+ rack (>= 3)
73
+ webrick (~> 1.8)
74
+ rails-dom-testing (2.2.0)
75
+ activesupport (>= 5.0.0)
76
+ minitest
77
+ 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)
86
+ rake (>= 12.2)
87
+ thor (~> 1.0, >= 1.2.2)
88
+ zeitwerk (~> 2.6)
89
+ rake (13.0.6)
90
+ rdoc (6.5.0)
91
+ psych (>= 4.0.0)
92
+ reline (0.3.9)
93
+ io-console (~> 0.5)
94
+ rexml (3.2.6)
95
+ rspec-core (3.12.2)
96
+ rspec-support (~> 3.12.0)
97
+ rspec-expectations (3.12.3)
98
+ diff-lcs (>= 1.2.0, < 2.0)
99
+ rspec-support (~> 3.12.0)
100
+ rspec-mocks (3.12.6)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.12.0)
103
+ rspec-rails (6.0.3)
104
+ actionpack (>= 6.1)
105
+ activesupport (>= 6.1)
106
+ railties (>= 6.1)
107
+ rspec-core (~> 3.12)
108
+ rspec-expectations (~> 3.12)
109
+ rspec-mocks (~> 3.12)
110
+ rspec-support (~> 3.12)
111
+ rspec-support (3.12.1)
112
+ ruby2_keywords (0.0.5)
113
+ stringio (3.0.8)
114
+ thor (1.3.0)
115
+ tzinfo (2.0.6)
116
+ concurrent-ruby (~> 1.0)
117
+ webmock (3.19.1)
118
+ addressable (>= 2.8.0)
119
+ crack (>= 0.3.2)
120
+ hashdiff (>= 0.4.0, < 2.0.0)
121
+ webrick (1.8.1)
122
+ zeitwerk (2.6.12)
123
+
124
+ PLATFORMS
125
+ x86_64-darwin-21
126
+
127
+ DEPENDENCIES
128
+ nameday_api!
129
+ rake (~> 13.0)
130
+ rspec-rails
131
+ webmock
132
+
133
+ BUNDLED WITH
134
+ 2.4.21
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # NamedayApi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nameday_api`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add nameday_api
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install nameday_api
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nameday_api.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NamedayApi
4
+ VERSION = '1.0.0'
5
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ # Module: NamedayApi
7
+ module NamedayApi
8
+ BASE_URL = 'https://nameday.abalin.net/api/V1'
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)
26
+ fetch_data('today', country: country_code, timezone: time_zone)
27
+ end
28
+
29
+ def tomorrow(country_code = nil, time_zone = nil)
30
+ fetch_data('tomorrow', country: country_code, timezone: time_zone)
31
+ end
32
+
33
+ def yesterday(country_code = nil, time_zone = nil)
34
+ fetch_data('yesterday', country: country_code, timezone: time_zone)
35
+ end
36
+
37
+ def specific_day(day, month, country_code = nil)
38
+ options = { day: day, month: month, country: country_code }
39
+ fetch_data('getdate', options)
40
+ end
41
+
42
+ def search_by_name(name, country_code)
43
+ options = { name: name, country: country_code }
44
+ fetch_data('getname', options)
45
+ end
46
+ end
@@ -0,0 +1,4 @@
1
+ module NamedayApi
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nameday_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniyal Qureshi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: NamedayApi is a Ruby gem that provides a simple interface to fetch nameday
14
+ information from the "nameday.abalin.net" API.
15
+ email:
16
+ - daniyalqureshi.cs@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Gemfile
22
+ - Gemfile.lock
23
+ - README.md
24
+ - Rakefile
25
+ - lib/nameday_api.rb
26
+ - lib/nameday_api/version.rb
27
+ - sig/nameday_api.rbs
28
+ homepage: https://github.com/Daniyal-Qureshi/nameday_api_gem
29
+ licenses:
30
+ - MIT
31
+ metadata:
32
+ allowed_push_host: https://rubygems.org
33
+ homepage_uri: https://github.com/Daniyal-Qureshi/nameday_api_gem
34
+ source_code_uri: https://github.com/Daniyal-Qureshi/nameday_api_gem
35
+ changelog_uri: https://github.com/Daniyal-Qureshi/nameday_api_gem/blob/main/CHANGELOG.md
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.6.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.0.1
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: A Ruby gem for fetching nameday information.
55
+ test_files: []