velnod 0.1.3 β†’ 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21680c98a0d0c31c80dd38da08e11ff1acaa5d86a037732bdc05014c750f177c
4
- data.tar.gz: '0910b1ab17541b6a4787cdcfc1f81ed7ea2b3f7b1da9a6a9842e0510352c331d'
3
+ metadata.gz: 6ed881c7a3d6fefb3522f6ba98530e893ae4e5ba96ed1d108c14a3eb9062982e
4
+ data.tar.gz: bb94614f83e18bb9ea05432b21a48a5b3e1942c742ecdd744ac1db7ab2032dfa
5
5
  SHA512:
6
- metadata.gz: ea507b75a94f11687bc995f8a394250d472aff14864b8e7835e0b60ff9ef4d34fb83eb81f1fc33c3b75be0dcba01b1ea4bd55e67cb8c245ae590fcdfe3dcc52e
7
- data.tar.gz: eeff55d5490f400d293de578909b6173c36a9f19ac451551d479e03622514929dc4bf5bf1c0d4af2c4941c9df390460d222621949abfb23340ee57c659bc84ad
6
+ metadata.gz: a8859be7474f90711bec28d122d7a9eec8deb782d84f496afe687a0cd369e1023a32ba0d8c7828313a1f697b527e230da71d2497b12dd0d88cc029087c578a97
7
+ data.tar.gz: f3043ba2caa200294bb70cfb4ec7e1de82ab4ba855571495bfa6955f154e505a4eb1ecab3372c0aacd923eb00710c3b320d95d17837e5e64bbca273590415738
data/README.md CHANGED
@@ -48,3 +48,45 @@ Returns a hash with the results:
48
48
  }
49
49
  ```
50
50
 
51
+ ## Countries
52
+
53
+ ```ruby
54
+ # Get all countries
55
+ Velnod.countries.all
56
+
57
+ # Find a country by alpha2, alpha3, or ID
58
+ Velnod.countries.find("US")
59
+ Velnod.countries.find("USA")
60
+ Velnod.countries.find("1234567890")
61
+
62
+ # Filter by region
63
+ Velnod.countries.by_region("Europe")
64
+
65
+ # Search by name
66
+ Velnod.countries.search("united")
67
+
68
+ # Combine filters
69
+ Velnod.countries.all(region: "Europe", subregion: "Western Europe", q: "germany")
70
+ ```
71
+
72
+ Returns country data:
73
+
74
+ ```ruby
75
+ {
76
+ "id" => "1234567890",
77
+ "common_name" => "United States",
78
+ "iso_short_name" => "United States of America",
79
+ "iso_long_name" => "The United States of America",
80
+ "iso_alpha2" => "US",
81
+ "iso_alpha3" => "USA",
82
+ "phone_code" => "1",
83
+ "currency_code" => "USD",
84
+ "currency_symbol" => "$",
85
+ "region" => "Americas",
86
+ "subregion" => "Northern America",
87
+ "flag_emoji" => "πŸ‡ΊπŸ‡Έ",
88
+ "languages" => ["en"],
89
+ "timezones" => ["America/New_York", "America/Los_Angeles", ...]
90
+ }
91
+ ```
92
+
data/lib/velnod/client.rb CHANGED
@@ -17,6 +17,20 @@ module Velnod
17
17
  @check ||= Resources::Check.new(self)
18
18
  end
19
19
 
20
+ def countries
21
+ @countries ||= Resources::Countries.new(self)
22
+ end
23
+
24
+ def get(path, params = {})
25
+ uri = URI("#{@base_url}#{path}")
26
+ uri.query = URI.encode_www_form(params) if params.any?
27
+
28
+ request = Net::HTTP::Get.new(uri)
29
+ request["Authorization"] = "Bearer #{@api_key}"
30
+
31
+ make_request(uri, request)
32
+ end
33
+
20
34
  def post(path, body = {})
21
35
  uri = URI("#{@base_url}#{path}")
22
36
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Velnod
4
+ module Resources
5
+ class Countries
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ def all(region: nil, subregion: nil, independent: nil, q: nil)
11
+ params = {}
12
+ params[:region] = region if region
13
+ params[:subregion] = subregion if subregion
14
+ params[:independent] = independent unless independent.nil?
15
+ params[:q] = q if q
16
+
17
+ @client.get("/countries", params)
18
+ end
19
+
20
+ def find(code)
21
+ @client.get("/countries/#{code}")
22
+ end
23
+
24
+ def by_region(region)
25
+ all(region: region)
26
+ end
27
+
28
+ def search(query)
29
+ all(q: query)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Velnod
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/velnod.rb CHANGED
@@ -4,6 +4,7 @@ require_relative "velnod/version"
4
4
  require_relative "velnod/configuration"
5
5
  require_relative "velnod/client"
6
6
  require_relative "velnod/resources/check"
7
+ require_relative "velnod/resources/countries"
7
8
 
8
9
  module Velnod
9
10
  class Error < StandardError; end
@@ -16,5 +17,9 @@ module Velnod
16
17
  def check(email: nil, domain: nil, name: nil)
17
18
  client.check.call(email: email, domain: domain, name: name)
18
19
  end
20
+
21
+ def countries
22
+ client.countries
23
+ end
19
24
  end
20
25
  end
data/velnod-0.1.3.gem ADDED
Binary file
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: velnod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - samuenti
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-24 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: Simple Ruby client to check emails, domains, and names against the Velnod
13
14
  API
@@ -24,17 +25,20 @@ files:
24
25
  - lib/velnod/client.rb
25
26
  - lib/velnod/configuration.rb
26
27
  - lib/velnod/resources/check.rb
28
+ - lib/velnod/resources/countries.rb
27
29
  - lib/velnod/version.rb
28
30
  - sig/velnod.rbs
29
31
  - velnod-0.1.0.gem
30
32
  - velnod-0.1.1.gem
31
33
  - velnod-0.1.2.gem
34
+ - velnod-0.1.3.gem
32
35
  homepage: https://velnod.com
33
36
  licenses:
34
37
  - MIT
35
38
  metadata:
36
39
  allowed_push_host: https://rubygems.org
37
40
  homepage_uri: https://velnod.com
41
+ post_install_message:
38
42
  rdoc_options: []
39
43
  require_paths:
40
44
  - lib
@@ -49,7 +53,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
53
  - !ruby/object:Gem::Version
50
54
  version: '0'
51
55
  requirements: []
52
- rubygems_version: 3.6.9
56
+ rubygems_version: 3.4.19
57
+ signing_key:
53
58
  specification_version: 4
54
59
  summary: Ruby client for the Velnod API
55
60
  test_files: []