apifreaks 1.0.3 → 1.0.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 +4 -4
- data/lib/apifreaks/client.rb +310 -0
- data/lib/apifreaks/version.rb +1 -1
- data/reference.md +779 -115
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32a9d6da3816e2830785311c2f784b7852bd1c0fbceaf4d316cb677adc5d0c71
|
|
4
|
+
data.tar.gz: 3eaf9e81c889241b65bc6d7f42237bc59dabd1d48d0d3e5080db015eec109243
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4d6c4bd6f0720106c69b6e047ee116cc780e9d676e9720ea3d9b731607144707f1a74ca3643ac4c6127962bd55d72810ce4dd0ef2ec89bbe96aecb684640379
|
|
7
|
+
data.tar.gz: ebd9dacecf79c2c401d3cbc8feee725f2aa3ccdc1006f4f2cf19777c11f1e9995523e9eef2235c13ed53196a78ac2ea40c2a47a4ac42abb5270769a42a775044
|
data/lib/apifreaks/client.rb
CHANGED
|
@@ -53,6 +53,57 @@ module Apifreaks
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# Get detailed geolocation data for an IP address (v2.0) including country, city, timezone, currency, and optional
|
|
57
|
+
# security and user-agent information
|
|
58
|
+
#
|
|
59
|
+
# @param request_options [Hash]
|
|
60
|
+
# @param params [Hash]
|
|
61
|
+
# @option request_options [String] :base_url
|
|
62
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
63
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
64
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
65
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
66
|
+
# @option params [String] :api_key
|
|
67
|
+
# @option params [Apifreaks::Types::GeolocationLookupRequestFormat, nil] :format
|
|
68
|
+
# @option params [String, nil] :ip
|
|
69
|
+
# @option params [Apifreaks::Types::GeolocationLookupRequestLang, nil] :lang
|
|
70
|
+
# @option params [String, nil] :fields
|
|
71
|
+
# @option params [String, nil] :excludes
|
|
72
|
+
# @option params [String, nil] :include
|
|
73
|
+
#
|
|
74
|
+
# @return [Apifreaks::Types::GeolocationLookupResponse]
|
|
75
|
+
def geolocation_lookup_v2(request_options: {}, **params)
|
|
76
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
77
|
+
query_params = {}
|
|
78
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
79
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
80
|
+
query_params["ip"] = params[:ip] if params.key?(:ip)
|
|
81
|
+
query_params["lang"] = params[:lang] if params.key?(:lang)
|
|
82
|
+
query_params["fields"] = params[:fields] if params.key?(:fields)
|
|
83
|
+
query_params["excludes"] = params[:excludes] if params.key?(:excludes)
|
|
84
|
+
query_params["include"] = params[:include] if params.key?(:include)
|
|
85
|
+
|
|
86
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
87
|
+
base_url: request_options[:base_url],
|
|
88
|
+
method: "GET",
|
|
89
|
+
path: "v2.0/geolocation/lookup",
|
|
90
|
+
query: query_params,
|
|
91
|
+
request_options: request_options
|
|
92
|
+
)
|
|
93
|
+
begin
|
|
94
|
+
response = @raw_client.send(request)
|
|
95
|
+
rescue Net::HTTPRequestTimeout
|
|
96
|
+
raise Apifreaks::Errors::TimeoutError
|
|
97
|
+
end
|
|
98
|
+
code = response.code.to_i
|
|
99
|
+
if code.between?(200, 299)
|
|
100
|
+
Apifreaks::Types::GeolocationLookupResponse.load(response.body)
|
|
101
|
+
else
|
|
102
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
103
|
+
raise error_class.new(response.body, code: code)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
56
107
|
# Retrieve detailed geolocation data for multiple IP addresses in a single request.
|
|
57
108
|
# Supports up to `50,000` IP-addresses/host-names per request.
|
|
58
109
|
#
|
|
@@ -107,6 +158,60 @@ module Apifreaks
|
|
|
107
158
|
end
|
|
108
159
|
end
|
|
109
160
|
|
|
161
|
+
# Retrieve detailed geolocation data for multiple IP addresses in a single request (v2.0).
|
|
162
|
+
# Supports up to `50,000` IP-addresses/host-names per request.
|
|
163
|
+
#
|
|
164
|
+
# @param request_options [Hash]
|
|
165
|
+
# @param params [Apifreaks::Types::BulkGeolocationLookupRequest]
|
|
166
|
+
# @option request_options [String] :base_url
|
|
167
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
168
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
169
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
170
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
171
|
+
# @option params [String] :api_key
|
|
172
|
+
# @option params [Apifreaks::Types::BulkGeolocationLookupRequestFormat, nil] :format
|
|
173
|
+
# @option params [String, nil] :lang
|
|
174
|
+
# @option params [String, nil] :fields
|
|
175
|
+
# @option params [String, nil] :excludes
|
|
176
|
+
# @option params [String, nil] :include
|
|
177
|
+
#
|
|
178
|
+
# @return [Array[Apifreaks::Types::BulkGeolocationLookupResponseItem]]
|
|
179
|
+
def bulk_geolocation_lookup_v2(request_options: {}, **params)
|
|
180
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
181
|
+
request_data = Apifreaks::Types::BulkGeolocationLookupRequest.new(params).to_h
|
|
182
|
+
non_body_param_names = %w[apiKey format lang fields excludes include]
|
|
183
|
+
body = request_data.except(*non_body_param_names)
|
|
184
|
+
|
|
185
|
+
query_params = {}
|
|
186
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
187
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
188
|
+
query_params["lang"] = params[:lang] if params.key?(:lang)
|
|
189
|
+
query_params["fields"] = params[:fields] if params.key?(:fields)
|
|
190
|
+
query_params["excludes"] = params[:excludes] if params.key?(:excludes)
|
|
191
|
+
query_params["include"] = params[:include] if params.key?(:include)
|
|
192
|
+
|
|
193
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
194
|
+
base_url: request_options[:base_url],
|
|
195
|
+
method: "POST",
|
|
196
|
+
path: "v2.0/geolocation/lookup",
|
|
197
|
+
query: query_params,
|
|
198
|
+
body: body,
|
|
199
|
+
request_options: request_options
|
|
200
|
+
)
|
|
201
|
+
begin
|
|
202
|
+
response = @raw_client.send(request)
|
|
203
|
+
rescue Net::HTTPRequestTimeout
|
|
204
|
+
raise Apifreaks::Errors::TimeoutError
|
|
205
|
+
end
|
|
206
|
+
code = response.code.to_i
|
|
207
|
+
if code.between?(200, 299)
|
|
208
|
+
Apifreaks::Types::BulkGeolocationLookupResponseItem.load(response.body)
|
|
209
|
+
else
|
|
210
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
211
|
+
raise error_class.new(response.body, code: code)
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
110
215
|
# Get comprehensive security information for a given IP address. Detects VPNs, proxies, Tor nodes, and other
|
|
111
216
|
# security threats.
|
|
112
217
|
#
|
|
@@ -354,6 +459,49 @@ module Apifreaks
|
|
|
354
459
|
end
|
|
355
460
|
end
|
|
356
461
|
|
|
462
|
+
# Retrieve live WHOIS information for a single domain name (v2.0), including registration
|
|
463
|
+
# dates, nameservers, and registrant information.
|
|
464
|
+
#
|
|
465
|
+
# @param request_options [Hash]
|
|
466
|
+
# @param params [Hash]
|
|
467
|
+
# @option request_options [String] :base_url
|
|
468
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
469
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
470
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
471
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
472
|
+
# @option params [String] :api_key
|
|
473
|
+
# @option params [Apifreaks::Types::DomainWhoisLookupRequestFormat, nil] :format
|
|
474
|
+
# @option params [String] :domain_name
|
|
475
|
+
#
|
|
476
|
+
# @return [Apifreaks::Types::DomainWhoisLookupResponse]
|
|
477
|
+
def domain_whois_lookup_v2(request_options: {}, **params)
|
|
478
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
479
|
+
query_params = {}
|
|
480
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
481
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
482
|
+
query_params["domainName"] = params[:domain_name] if params.key?(:domain_name)
|
|
483
|
+
|
|
484
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
485
|
+
base_url: request_options[:base_url],
|
|
486
|
+
method: "GET",
|
|
487
|
+
path: "v2.0/domain/whois/live",
|
|
488
|
+
query: query_params,
|
|
489
|
+
request_options: request_options
|
|
490
|
+
)
|
|
491
|
+
begin
|
|
492
|
+
response = @raw_client.send(request)
|
|
493
|
+
rescue Net::HTTPRequestTimeout
|
|
494
|
+
raise Apifreaks::Errors::TimeoutError
|
|
495
|
+
end
|
|
496
|
+
code = response.code.to_i
|
|
497
|
+
if code.between?(200, 299)
|
|
498
|
+
Apifreaks::Types::DomainWhoisLookupResponse.load(response.body)
|
|
499
|
+
else
|
|
500
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
501
|
+
raise error_class.new(response.body, code: code)
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
|
|
357
505
|
# Retrieve WHOIS information for `100 Domains per Request`.
|
|
358
506
|
#
|
|
359
507
|
# @param request_options [Hash]
|
|
@@ -399,6 +547,51 @@ module Apifreaks
|
|
|
399
547
|
end
|
|
400
548
|
end
|
|
401
549
|
|
|
550
|
+
# Retrieve WHOIS information for `100 Domains per Request` (v2.0).
|
|
551
|
+
#
|
|
552
|
+
# @param request_options [Hash]
|
|
553
|
+
# @param params [Apifreaks::Types::BulkDomainWhoisLookupRequest]
|
|
554
|
+
# @option request_options [String] :base_url
|
|
555
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
556
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
557
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
558
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
559
|
+
# @option params [String] :api_key
|
|
560
|
+
# @option params [Apifreaks::Types::BulkDomainWhoisLookupRequestFormat, nil] :format
|
|
561
|
+
#
|
|
562
|
+
# @return [Apifreaks::Types::BulkDomainWhoisLookupResponse]
|
|
563
|
+
def bulk_domain_whois_lookup_v2(request_options: {}, **params)
|
|
564
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
565
|
+
request_data = Apifreaks::Types::BulkDomainWhoisLookupRequest.new(params).to_h
|
|
566
|
+
non_body_param_names = %w[apiKey format]
|
|
567
|
+
body = request_data.except(*non_body_param_names)
|
|
568
|
+
|
|
569
|
+
query_params = {}
|
|
570
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
571
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
572
|
+
|
|
573
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
574
|
+
base_url: request_options[:base_url],
|
|
575
|
+
method: "POST",
|
|
576
|
+
path: "v2.0/domain/whois/live",
|
|
577
|
+
query: query_params,
|
|
578
|
+
body: body,
|
|
579
|
+
request_options: request_options
|
|
580
|
+
)
|
|
581
|
+
begin
|
|
582
|
+
response = @raw_client.send(request)
|
|
583
|
+
rescue Net::HTTPRequestTimeout
|
|
584
|
+
raise Apifreaks::Errors::TimeoutError
|
|
585
|
+
end
|
|
586
|
+
code = response.code.to_i
|
|
587
|
+
if code.between?(200, 299)
|
|
588
|
+
Apifreaks::Types::BulkDomainWhoisLookupResponse.load(response.body)
|
|
589
|
+
else
|
|
590
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
591
|
+
raise error_class.new(response.body, code: code)
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
|
|
402
595
|
# Returns WHOIS registration details for a specified IP address (IPv4 or IPv6).
|
|
403
596
|
#
|
|
404
597
|
# @param request_options [Hash]
|
|
@@ -4871,6 +5064,65 @@ module Apifreaks
|
|
|
4871
5064
|
end
|
|
4872
5065
|
end
|
|
4873
5066
|
|
|
5067
|
+
# Retrieve current time, date, and timezone-related information (v2.0) by specifying a timezone name, location
|
|
5068
|
+
# address, location coordinates, IP address, or use the client IP address if no parameter is passed.
|
|
5069
|
+
#
|
|
5070
|
+
# @param request_options [Hash]
|
|
5071
|
+
# @param params [Hash]
|
|
5072
|
+
# @option request_options [String] :base_url
|
|
5073
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
5074
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
5075
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
5076
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
5077
|
+
# @option params [String] :api_key
|
|
5078
|
+
# @option params [Apifreaks::Types::TimezoneLookupRequestFormat, nil] :format
|
|
5079
|
+
# @option params [String, nil] :ip
|
|
5080
|
+
# @option params [String, nil] :tz
|
|
5081
|
+
# @option params [String, nil] :location
|
|
5082
|
+
# @option params [Integer, nil] :lat
|
|
5083
|
+
# @option params [Integer, nil] :long
|
|
5084
|
+
# @option params [Apifreaks::Types::TimezoneLookupRequestLang, nil] :lang
|
|
5085
|
+
# @option params [String, nil] :iata_code
|
|
5086
|
+
# @option params [String, nil] :icao_code
|
|
5087
|
+
# @option params [String, nil] :lo_code
|
|
5088
|
+
#
|
|
5089
|
+
# @return [Apifreaks::Types::TimezoneLookupResponse]
|
|
5090
|
+
def timezone_lookup_v2(request_options: {}, **params)
|
|
5091
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
5092
|
+
query_params = {}
|
|
5093
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
5094
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
5095
|
+
query_params["ip"] = params[:ip] if params.key?(:ip)
|
|
5096
|
+
query_params["tz"] = params[:tz] if params.key?(:tz)
|
|
5097
|
+
query_params["location"] = params[:location] if params.key?(:location)
|
|
5098
|
+
query_params["lat"] = params[:lat] if params.key?(:lat)
|
|
5099
|
+
query_params["long"] = params[:long] if params.key?(:long)
|
|
5100
|
+
query_params["lang"] = params[:lang] if params.key?(:lang)
|
|
5101
|
+
query_params["iata_code"] = params[:iata_code] if params.key?(:iata_code)
|
|
5102
|
+
query_params["icao_code"] = params[:icao_code] if params.key?(:icao_code)
|
|
5103
|
+
query_params["lo_code"] = params[:lo_code] if params.key?(:lo_code)
|
|
5104
|
+
|
|
5105
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
5106
|
+
base_url: request_options[:base_url],
|
|
5107
|
+
method: "GET",
|
|
5108
|
+
path: "v2.0/geolocation/timezone",
|
|
5109
|
+
query: query_params,
|
|
5110
|
+
request_options: request_options
|
|
5111
|
+
)
|
|
5112
|
+
begin
|
|
5113
|
+
response = @raw_client.send(request)
|
|
5114
|
+
rescue Net::HTTPRequestTimeout
|
|
5115
|
+
raise Apifreaks::Errors::TimeoutError
|
|
5116
|
+
end
|
|
5117
|
+
code = response.code.to_i
|
|
5118
|
+
if code.between?(200, 299)
|
|
5119
|
+
Apifreaks::Types::TimezoneLookupResponse.load(response.body)
|
|
5120
|
+
else
|
|
5121
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
5122
|
+
raise error_class.new(response.body, code: code)
|
|
5123
|
+
end
|
|
5124
|
+
end
|
|
5125
|
+
|
|
4874
5126
|
# Converts a given time from one timezone to another using various input types like timezone name, coordinates,
|
|
4875
5127
|
# location, or codes.
|
|
4876
5128
|
#
|
|
@@ -5333,6 +5585,64 @@ module Apifreaks
|
|
|
5333
5585
|
end
|
|
5334
5586
|
end
|
|
5335
5587
|
|
|
5588
|
+
# Retrieve sunrise and sunset times, current position of the moon, and other related information (v2.0) by
|
|
5589
|
+
# specifying a location address, location coordinates, IP address, or using the client IP address if no parameter
|
|
5590
|
+
# is passed.
|
|
5591
|
+
#
|
|
5592
|
+
# @param request_options [Hash]
|
|
5593
|
+
# @param params [Hash]
|
|
5594
|
+
# @option request_options [String] :base_url
|
|
5595
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
5596
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
5597
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
5598
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
5599
|
+
# @option params [String] :api_key
|
|
5600
|
+
# @option params [Apifreaks::Types::AstronomyLookupRequestFormat, nil] :format
|
|
5601
|
+
# @option params [String, nil] :location
|
|
5602
|
+
# @option params [Integer, nil] :lat
|
|
5603
|
+
# @option params [Integer, nil] :long
|
|
5604
|
+
# @option params [String, nil] :ip
|
|
5605
|
+
# @option params [String, nil] :lang
|
|
5606
|
+
# @option params [String, nil] :date
|
|
5607
|
+
# @option params [Integer, nil] :elevation
|
|
5608
|
+
# @option params [String, nil] :time_zone
|
|
5609
|
+
#
|
|
5610
|
+
# @return [Apifreaks::Types::AstronomyLookupResponse]
|
|
5611
|
+
def astronomy_lookup_v2(request_options: {}, **params)
|
|
5612
|
+
params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
|
|
5613
|
+
query_params = {}
|
|
5614
|
+
query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
|
|
5615
|
+
query_params["format"] = params[:format] if params.key?(:format)
|
|
5616
|
+
query_params["location"] = params[:location] if params.key?(:location)
|
|
5617
|
+
query_params["lat"] = params[:lat] if params.key?(:lat)
|
|
5618
|
+
query_params["long"] = params[:long] if params.key?(:long)
|
|
5619
|
+
query_params["ip"] = params[:ip] if params.key?(:ip)
|
|
5620
|
+
query_params["lang"] = params[:lang] if params.key?(:lang)
|
|
5621
|
+
query_params["date"] = params[:date] if params.key?(:date)
|
|
5622
|
+
query_params["elevation"] = params[:elevation] if params.key?(:elevation)
|
|
5623
|
+
query_params["time_zone"] = params[:time_zone] if params.key?(:time_zone)
|
|
5624
|
+
|
|
5625
|
+
request = Apifreaks::Internal::JSON::Request.new(
|
|
5626
|
+
base_url: request_options[:base_url],
|
|
5627
|
+
method: "GET",
|
|
5628
|
+
path: "v2.0/geolocation/astronomy",
|
|
5629
|
+
query: query_params,
|
|
5630
|
+
request_options: request_options
|
|
5631
|
+
)
|
|
5632
|
+
begin
|
|
5633
|
+
response = @raw_client.send(request)
|
|
5634
|
+
rescue Net::HTTPRequestTimeout
|
|
5635
|
+
raise Apifreaks::Errors::TimeoutError
|
|
5636
|
+
end
|
|
5637
|
+
code = response.code.to_i
|
|
5638
|
+
if code.between?(200, 299)
|
|
5639
|
+
Apifreaks::Types::AstronomyLookupResponse.load(response.body)
|
|
5640
|
+
else
|
|
5641
|
+
error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
|
|
5642
|
+
raise error_class.new(response.body, code: code)
|
|
5643
|
+
end
|
|
5644
|
+
end
|
|
5645
|
+
|
|
5336
5646
|
# @param base_url [String, nil]
|
|
5337
5647
|
# @param max_retries [Integer]
|
|
5338
5648
|
#
|
data/lib/apifreaks/version.rb
CHANGED