ip_api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbbc27978a4ed8e8866ca398d83743fcac2da2853cd661e53e9c94dcd3215830
4
- data.tar.gz: 8f9bb59e2b7f7ce4f732809799e353040a995cb838a0f773ca57cf60f49b6dfa
3
+ metadata.gz: fe03bdb15570e79b48c1a889a35efcf9040f2c6345280f1af295aa6c8fc630da
4
+ data.tar.gz: 6f830f7a919fb805c6427ff2cab32e1526e60bfd7089d455040d4eb61c004bea
5
5
  SHA512:
6
- metadata.gz: ad4b3ee31b0c4ca1c9518b6cd1db714318732924e77538c2c9331c2a1a1410c37e203a3cf3fc1ad105c27c4e26977da8b82d51b52e106ce22c48550840a908e6
7
- data.tar.gz: aa749e1e6246521be1ffe0058ef3375d824f6dee9c2c19a51662651d8e176ee31d9b4bcc649344c0f29e27bb5a15ee6f14db7534c3c4b5b3088ad489970605ac
6
+ metadata.gz: 12d63f8375a9474e8b0ab551a2608ac20e373594442f5296643f893611a3e9f12ad7aa2364b8be8d2bfe27a4fc6a5a8fce839be3a70c4feb56e0bfed433eb9e2
7
+ data.tar.gz: 88cac2312d6a22a76c38199daaafde8cbaabed3b004c6f3e74357d1fdf7287704c0a5c908cdc70d2ed9616250c0ee6e6197d417359ca3aa1e9bf67eabf1bbbfa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ip_api (0.1.0)
4
+ ip_api (0.1.1)
5
5
  httparty
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # IpApi
1
+ # IP API ruby client
2
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/ip_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
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
- TODO: Write usage instructions here
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/[USERNAME]/ip_api/blob/master/CODE_OF_CONDUCT.md).
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/[USERNAME]/ip_api/blob/master/CODE_OF_CONDUCT.md).
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).
@@ -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/ip_api"
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
- # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
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.
@@ -1,3 +1,3 @@
1
1
  module IpApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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/ip_api
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/ip_api
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: