ip_api 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/README.md +110 -7
- data/ip_api.gemspec +2 -2
- data/lib/ip_api/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe03bdb15570e79b48c1a889a35efcf9040f2c6345280f1af295aa6c8fc630da
|
4
|
+
data.tar.gz: 6f830f7a919fb805c6427ff2cab32e1526e60bfd7089d455040d4eb61c004bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12d63f8375a9474e8b0ab551a2608ac20e373594442f5296643f893611a3e9f12ad7aa2364b8be8d2bfe27a4fc6a5a8fce839be3a70c4feb56e0bfed433eb9e2
|
7
|
+
data.tar.gz: 88cac2312d6a22a76c38199daaafde8cbaabed3b004c6f3e74357d1fdf7287704c0a5c908cdc70d2ed9616250c0ee6e6197d417359ca3aa1e9bf67eabf1bbbfa
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# IP API ruby client
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This is `ip_api` gem, a ruby client for the IP API from https://ip-api.com. IP-API offers fast and secure IP geolocation data free for non-commercial use. No API key required.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,112 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
The easiest way to use it is by calling the `info` method on the main module
|
24
|
+
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'ip_api'
|
28
|
+
|
29
|
+
IpApi.info('8.8.8.8')
|
30
|
+
=> {
|
31
|
+
"status"=>"success",
|
32
|
+
"country"=>"United States",
|
33
|
+
"countryCode"=>"US",
|
34
|
+
"region"=>"VA",
|
35
|
+
"regionName"=>"Virginia",
|
36
|
+
"city"=>"Ashburn",
|
37
|
+
"zip"=>"20149",
|
38
|
+
"lat"=>39.03,
|
39
|
+
"lon"=>-77.5,
|
40
|
+
"timezone"=>"America/New_York",
|
41
|
+
"isp"=>"Google LLC",
|
42
|
+
"org"=>"Google Public DNS",
|
43
|
+
"as"=>"AS15169 Google LLC",
|
44
|
+
"query"=>"8.8.8.8"
|
45
|
+
}
|
46
|
+
```
|
47
|
+
|
48
|
+
You can also request information for multiple IPs (100 max per request).
|
49
|
+
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
require 'ip_api'
|
53
|
+
|
54
|
+
IpApi.info(['8.8.8.8', '1.1.1.1'])
|
55
|
+
=> [
|
56
|
+
{
|
57
|
+
"status"=>"success",
|
58
|
+
"country"=>"United States",
|
59
|
+
"countryCode"=>"US",
|
60
|
+
"region"=>"VA",
|
61
|
+
"regionName"=>"Virginia",
|
62
|
+
"city"=>"Ashburn",
|
63
|
+
"zip"=>"20149",
|
64
|
+
"lat"=>39.03,
|
65
|
+
"lon"=>-77.5,
|
66
|
+
"timezone"=>"America/New_York",
|
67
|
+
"isp"=>"Google LLC",
|
68
|
+
"org"=>"Google Public DNS",
|
69
|
+
"as"=>"AS15169 Google LLC",
|
70
|
+
"query"=>"8.8.8.8"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"status"=>"success",
|
74
|
+
"country"=>"Australia",
|
75
|
+
"countryCode"=>"AU",
|
76
|
+
"region"=>"QLD",
|
77
|
+
"regionName"=>"Queensland",
|
78
|
+
"city"=>"South Brisbane",
|
79
|
+
"zip"=>"4101",
|
80
|
+
"lat"=>-27.4766,
|
81
|
+
"lon"=>153.0166,
|
82
|
+
"timezone"=>"Australia/Brisbane",
|
83
|
+
"isp"=>"Cloudflare, Inc",
|
84
|
+
"org"=>"APNIC and Cloudflare DNS Resolver project",
|
85
|
+
"as"=>"AS13335 Cloudflare, Inc.",
|
86
|
+
"query"=>"1.1.1.1"
|
87
|
+
}
|
88
|
+
]
|
89
|
+
```
|
90
|
+
|
91
|
+
### Response fields
|
92
|
+
|
93
|
+
ip-api.com allows specifying response fields, the complete list of possible fields can be found at https://ip-api.com/docs/api:json#fieldsTable
|
94
|
+
|
95
|
+
This gem automatically calculates a numeric value for the requested fields to save bandwidth.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
IpApi.info('1.1.1.1', fields: ['country', 'proxy', 'hosting'])
|
99
|
+
=> {
|
100
|
+
"country"=>"Australia",
|
101
|
+
"proxy"=>false,
|
102
|
+
"hosting"=>true
|
103
|
+
}
|
104
|
+
```
|
105
|
+
|
106
|
+
### Localization
|
107
|
+
|
108
|
+
Localized city, regionName and country can be requested by setting the `lang` option.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
IpApi.info('1.1.1.1', lang: 'ru')
|
112
|
+
=> {
|
113
|
+
"status"=>"success",
|
114
|
+
"country"=>"Австралия",
|
115
|
+
"countryCode"=>"AU",
|
116
|
+
"region"=>"QLD",
|
117
|
+
"regionName"=>"Штат Квинсленд",
|
118
|
+
"city"=>"South Brisbane",
|
119
|
+
"zip"=>"4101",
|
120
|
+
"lat"=>-27.4766,
|
121
|
+
"lon"=>153.0166,
|
122
|
+
"timezone"=>"Australia/Brisbane",
|
123
|
+
"isp"=>"Cloudflare, Inc",
|
124
|
+
"org"=>"APNIC and Cloudflare DNS Resolver project",
|
125
|
+
"as"=>"AS13335 Cloudflare, Inc.",
|
126
|
+
"query"=>"1.1.1.1"
|
127
|
+
}
|
128
|
+
```
|
26
129
|
|
27
130
|
## Development
|
28
131
|
|
@@ -32,7 +135,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
135
|
|
33
136
|
## Contributing
|
34
137
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ip_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/
|
138
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ip_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/calas/ip-api-ruby/blob/main/CODE_OF_CONDUCT.md).
|
36
139
|
|
37
140
|
|
38
141
|
## License
|
@@ -41,4 +144,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
144
|
|
42
145
|
## Code of Conduct
|
43
146
|
|
44
|
-
Everyone interacting in the IpApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
147
|
+
Everyone interacting in the IpApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/calas/ip-api-ruby/blob/main/CODE_OF_CONDUCT.md).
|
data/ip_api.gemspec
CHANGED
@@ -8,14 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = %q{Ruby client for the https://ip-api.com API}
|
10
10
|
spec.description = %q{Ruby client for the https://ip-api.com API}
|
11
|
-
spec.homepage = "https://github.com/calas/
|
11
|
+
spec.homepage = "https://github.com/calas/ip-api-ruby"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
14
|
|
15
15
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/calas/ip-api-ruby"
|
19
19
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
data/lib/ip_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ip_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Calás
|
@@ -49,11 +49,12 @@ files:
|
|
49
49
|
- lib/ip_api/client.rb
|
50
50
|
- lib/ip_api/fields.rb
|
51
51
|
- lib/ip_api/version.rb
|
52
|
-
homepage: https://github.com/calas/
|
52
|
+
homepage: https://github.com/calas/ip-api-ruby
|
53
53
|
licenses:
|
54
54
|
- MIT
|
55
55
|
metadata:
|
56
|
-
homepage_uri: https://github.com/calas/
|
56
|
+
homepage_uri: https://github.com/calas/ip-api-ruby
|
57
|
+
source_code_uri: https://github.com/calas/ip-api-ruby
|
57
58
|
post_install_message:
|
58
59
|
rdoc_options: []
|
59
60
|
require_paths:
|