internetdata 2.17.0 → 2.18.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -5
  3. data/lib/internetdata/api/database_v2_api.rb +1 -1
  4. data/lib/internetdata/api_client.rb +1 -1
  5. data/lib/internetdata/api_error.rb +1 -1
  6. data/lib/internetdata/api_model_base.rb +1 -1
  7. data/lib/internetdata/client.rb +77 -41
  8. data/lib/internetdata/configuration.rb +1 -1
  9. data/lib/internetdata/middleware/core.rb +61 -5
  10. data/lib/internetdata/models/abuse_contact.rb +8 -8
  11. data/lib/internetdata/models/asn.rb +1 -1
  12. data/lib/internetdata/models/asn_hosted_domains.rb +2 -2
  13. data/lib/internetdata/models/asn_lookup_response.rb +18 -18
  14. data/lib/internetdata/models/asn_prefix.rb +1 -1
  15. data/lib/internetdata/models/batch_lookup_error.rb +1 -1
  16. data/lib/internetdata/models/bit_torrent_detail.rb +1 -1
  17. data/lib/internetdata/models/bot_detail.rb +1 -1
  18. data/lib/internetdata/models/carrier_detail.rb +1 -1
  19. data/lib/internetdata/models/class_detail.rb +1 -1
  20. data/lib/internetdata/models/client_registration.rb +1 -1
  21. data/lib/internetdata/models/cohosted_domains.rb +2 -2
  22. data/lib/internetdata/models/company.rb +3 -3
  23. data/lib/internetdata/models/database.rb +1 -1
  24. data/lib/internetdata/models/database_checksums_response.rb +1 -1
  25. data/lib/internetdata/models/database_format.rb +1 -1
  26. data/lib/internetdata/models/database_list.rb +1 -1
  27. data/lib/internetdata/models/database_metadata.rb +1 -1
  28. data/lib/internetdata/models/database_metadata_column.rb +1 -1
  29. data/lib/internetdata/models/database_version.rb +1 -1
  30. data/lib/internetdata/models/db_checksums.rb +1 -1
  31. data/lib/internetdata/models/device_authorization.rb +1 -1
  32. data/lib/internetdata/models/disposable_detail.rb +1 -1
  33. data/lib/internetdata/models/dns_address_record.rb +1 -1
  34. data/lib/internetdata/models/dns_cname_record.rb +1 -1
  35. data/lib/internetdata/models/dns_mx_record.rb +1 -1
  36. data/lib/internetdata/models/dns_ns_record.rb +1 -1
  37. data/lib/internetdata/models/dns_resolver_detail.rb +1 -1
  38. data/lib/internetdata/models/domain_backlinks.rb +2 -2
  39. data/lib/internetdata/models/domain_dns.rb +2 -2
  40. data/lib/internetdata/models/domain_host.rb +1 -1
  41. data/lib/internetdata/models/domain_ip_range.rb +1 -1
  42. data/lib/internetdata/models/domain_ip_ranges.rb +2 -2
  43. data/lib/internetdata/models/domain_lookup_response.rb +4 -4
  44. data/lib/internetdata/models/domain_redirects.rb +2 -2
  45. data/lib/internetdata/models/domain_web.rb +2 -2
  46. data/lib/internetdata/models/domain_web_links.rb +1 -1
  47. data/lib/internetdata/models/download.rb +1 -1
  48. data/lib/internetdata/models/download_list.rb +1 -1
  49. data/lib/internetdata/models/entitlement.rb +1 -1
  50. data/lib/internetdata/models/entitlement_apikey.rb +1 -1
  51. data/lib/internetdata/models/entitlement_plan.rb +2 -2
  52. data/lib/internetdata/models/entitlement_usage.rb +3 -3
  53. data/lib/internetdata/models/error_envelope.rb +1 -1
  54. data/lib/internetdata/models/hosted_domains.rb +2 -2
  55. data/lib/internetdata/models/location.rb +11 -11
  56. data/lib/internetdata/models/lookup_response.rb +23 -23
  57. data/lib/internetdata/models/oauth_metadata.rb +1 -1
  58. data/lib/internetdata/models/proxy_detail.rb +1 -1
  59. data/lib/internetdata/models/pubproxy_detail.rb +1 -1
  60. data/lib/internetdata/models/rwhois.rb +2 -2
  61. data/lib/internetdata/models/satellite_detail.rb +1 -1
  62. data/lib/internetdata/models/smtp_detail.rb +1 -1
  63. data/lib/internetdata/models/ssh_detail.rb +1 -1
  64. data/lib/internetdata/models/standing.rb +1 -1
  65. data/lib/internetdata/models/token_response.rb +1 -1
  66. data/lib/internetdata/models/user_agent_verdict.rb +1 -1
  67. data/lib/internetdata/models/web_detail.rb +1 -1
  68. data/lib/internetdata/models/whois.rb +2 -2
  69. data/lib/internetdata/result.rb +13 -0
  70. data/lib/internetdata/transport.rb +29 -9
  71. data/lib/internetdata/version.rb +1 -1
  72. metadata +1 -1
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module InternetData
17
- # From IP Hosted Domains: how many registered domains resolve to the address, and the 10 most popular. Its database lists up to 1,000 an address. Paid plans and the trial.
17
+ # From IP Hosted Domains: how many registered domains resolve to the address, and the 10 most popular. Its database lists up to 1,000 an address. On a paid plan or the trial.
18
18
  class HostedDomains < ApiModelBase
19
19
  # How many registered domains resolve to the address.
20
20
  attr_accessor :total
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -46,34 +46,34 @@ module InternetData
46
46
  # Its code points, `U+1F1E6 U+1F1F9`.
47
47
  attr_accessor :flag_unicode
48
48
 
49
- # Region (state or province). Paid plans and the trial.
49
+ # Region (state or province). On a paid plan or the trial.
50
50
  attr_accessor :region
51
51
 
52
- # ISO 3166-2 region code. Paid plans and the trial.
52
+ # ISO 3166-2 region code. On a paid plan or the trial.
53
53
  attr_accessor :region_code
54
54
 
55
- # City. Paid plans and the trial.
55
+ # City. On a paid plan or the trial.
56
56
  attr_accessor :city
57
57
 
58
- # Postal code. Paid plans and the trial.
58
+ # Postal code. On a paid plan or the trial.
59
59
  attr_accessor :postal_code
60
60
 
61
- # Latitude of the city. Paid plans and the trial.
61
+ # Latitude of the city. On a paid plan or the trial.
62
62
  attr_accessor :latitude
63
63
 
64
- # Longitude of the city. Paid plans and the trial.
64
+ # Longitude of the city. On a paid plan or the trial.
65
65
  attr_accessor :longitude
66
66
 
67
- # Radius in km holding the true location with 67% confidence. Paid plans and the trial.
67
+ # Radius in km holding the true location with 67% confidence. On a paid plan or the trial.
68
68
  attr_accessor :accuracy_radius
69
69
 
70
- # GeoNames ID of the city. Paid plans and the trial.
70
+ # GeoNames ID of the city. On a paid plan or the trial.
71
71
  attr_accessor :geoname_id
72
72
 
73
- # US TV market (DMA) code. Paid plans and the trial.
73
+ # US TV market (DMA) code. On a paid plan or the trial.
74
74
  attr_accessor :dma_code
75
75
 
76
- # The day the range's location last changed. Paid plans and the trial.
76
+ # The day the range's location last changed. On a paid plan or the trial.
77
77
  attr_accessor :last_changed
78
78
 
79
79
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -22,7 +22,7 @@ module InternetData
22
22
  # Reserved space, answered from the address alone.
23
23
  attr_accessor :is_bogon
24
24
 
25
- # In VPN IP: a VPN service's server. Paid plans and the trial.
25
+ # In VPN IP: a VPN service's server. On a paid plan or the trial.
26
26
  attr_accessor :is_vpn
27
27
 
28
28
  # In Tor IP: a Tor exit.
@@ -31,22 +31,22 @@ module InternetData
31
31
  # In Relay IP: an anonymizing relay such as iCloud Private Relay.
32
32
  attr_accessor :is_relay
33
33
 
34
- # In Residential Proxy IP's 90-day window: a residential proxy exit. Paid plans and the trial.
34
+ # In Residential Proxy IP's 90-day window: a residential proxy exit. On a paid plan or the trial.
35
35
  attr_accessor :is_resproxy
36
36
 
37
- # In Datacenter Proxy IP's 90-day window. Paid plans and the trial.
37
+ # In Datacenter Proxy IP's 90-day window. On a paid plan or the trial.
38
38
  attr_accessor :is_dcproxy
39
39
 
40
- # In Mobile Proxy IP's 90-day window. Paid plans and the trial.
40
+ # In Mobile Proxy IP's 90-day window. On a paid plan or the trial.
41
41
  attr_accessor :is_mobproxy
42
42
 
43
- # In Public Proxy IP: a public proxy listens here, or its traffic left from here. Paid plans and the trial.
43
+ # In Public Proxy IP: a public proxy listens here, or its traffic left from here. On a paid plan or the trial.
44
44
  attr_accessor :is_pubproxy
45
45
 
46
- # In Hosting IP: a hosting or cloud network. Paid plans and the trial.
46
+ # In Hosting IP: a hosting or cloud network. On a paid plan or the trial.
47
47
  attr_accessor :is_hosting
48
48
 
49
- # In CDN IP: a content delivery network. Paid plans and the trial.
49
+ # In CDN IP: a content delivery network. On a paid plan or the trial.
50
50
  attr_accessor :is_cdn
51
51
 
52
52
  # In Bot IP: an automated client's address, such as a search engine's or an AI company's crawler, an uptime monitor, an internet scanner or a webhook sender. `bot` says whose, what it does and whether its operator vouches for the address.
@@ -76,7 +76,7 @@ module InternetData
76
76
  # In BitTorrent IP: a BitTorrent client was seen here in the last 90 days.
77
77
  attr_accessor :is_bittorrent
78
78
 
79
- # VPN IP's row, `{}` when `is_vpn` is false. Paid plans and the trial.
79
+ # VPN IP's row, `{}` when `is_vpn` is false. On a paid plan or the trial.
80
80
  attr_accessor :vpn
81
81
 
82
82
  # Tor IP's row, `{}` when `is_tor` is false.
@@ -85,46 +85,46 @@ module InternetData
85
85
  # Relay IP's row, `{}` when `is_relay` is false.
86
86
  attr_accessor :relay
87
87
 
88
- # `{}` when `is_resproxy` is false. Paid plans and the trial.
88
+ # `{}` when `is_resproxy` is false. On a paid plan or the trial.
89
89
  attr_accessor :resproxy
90
90
 
91
- # `{}` when `is_dcproxy` is false. Paid plans and the trial.
91
+ # `{}` when `is_dcproxy` is false. On a paid plan or the trial.
92
92
  attr_accessor :dcproxy
93
93
 
94
- # `{}` when `is_mobproxy` is false. Paid plans and the trial.
94
+ # `{}` when `is_mobproxy` is false. On a paid plan or the trial.
95
95
  attr_accessor :mobproxy
96
96
 
97
- # `{}` when `is_pubproxy` is false. Paid plans and the trial.
97
+ # `{}` when `is_pubproxy` is false. On a paid plan or the trial.
98
98
  attr_accessor :pubproxy
99
99
 
100
- # `{}` when `is_hosting` is false. Paid plans and the trial.
100
+ # `{}` when `is_hosting` is false. On a paid plan or the trial.
101
101
  attr_accessor :hosting
102
102
 
103
- # `{}` when `is_cdn` is false. Paid plans and the trial.
103
+ # `{}` when `is_cdn` is false. On a paid plan or the trial.
104
104
  attr_accessor :cdn
105
105
 
106
- # `{}` when `is_bot` is false. Paid plans and the trial.
106
+ # `{}` when `is_bot` is false. On a paid plan or the trial.
107
107
  attr_accessor :bot
108
108
 
109
- # `{}` when `is_carrier` is false. Paid plans and the trial.
109
+ # `{}` when `is_carrier` is false. On a paid plan or the trial.
110
110
  attr_accessor :carrier
111
111
 
112
- # `{}` when `is_satellite` is false. Paid plans and the trial.
112
+ # `{}` when `is_satellite` is false. On a paid plan or the trial.
113
113
  attr_accessor :satellite
114
114
 
115
- # `{}` when `is_ssh` is false. Paid plans and the trial.
115
+ # `{}` when `is_ssh` is false. On a paid plan or the trial.
116
116
  attr_accessor :ssh
117
117
 
118
- # `{}` when `is_smtp` is false. Paid plans and the trial.
118
+ # `{}` when `is_smtp` is false. On a paid plan or the trial.
119
119
  attr_accessor :smtp
120
120
 
121
- # A row per port that answered, lowest first; `[]` when `is_web` is false. Paid plans and the trial.
121
+ # A row per port that answered, lowest first; `[]` when `is_web` is false. On a paid plan or the trial.
122
122
  attr_accessor :web
123
123
 
124
- # `{}` when `is_dns_resolver` is false. Paid plans and the trial.
124
+ # `{}` when `is_dns_resolver` is false. On a paid plan or the trial.
125
125
  attr_accessor :dns_resolver
126
126
 
127
- # `{}` when `is_bittorrent` is false. Paid plans and the trial.
127
+ # `{}` when `is_bittorrent` is false. On a paid plan or the trial.
128
128
  attr_accessor :bittorrent
129
129
 
130
130
  attr_accessor :location
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module InternetData
17
- # IP RWHOIS's most specific network covering the address. Paid plans and the trial.
17
+ # IP RWHOIS's most specific network covering the address. On a paid plan or the trial.
18
18
  class Rwhois < ApiModelBase
19
19
  # The network's identifier on the operator's RWHOIS server.
20
20
  attr_accessor :id
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.23
6
+ The version of the OpenAPI document: 2026.11.25
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module InternetData
17
- # IP Whois's most specific record covering the address. Paid plans and the trial.
17
+ # IP Whois's most specific record covering the address. On a paid plan or the trial.
18
18
  class Whois < ApiModelBase
19
19
  # Network name of the most specific record covering the address.
20
20
  attr_accessor :id
@@ -433,6 +433,19 @@ module InternetData
433
433
  @raw['hosted_domains']
434
434
  end
435
435
 
436
+ # What the API made of the user agent the lookup sent, as a wire hash
437
+ # (`result.user_agent['verdict']`): agent, the agent it names (`Googlebot`,
438
+ # `Chrome`, `Unknown` where it names none); kind, what kind of client it says
439
+ # it is (`browser`, `bot`, `ai-bot` and the rest); and verdict, `verified`
440
+ # where the agent's operator vouches for this address, `spoofed` where it does
441
+ # not, `unverifiable` for a bot nothing published can confirm, or `not_bot`
442
+ # for a browser, an app or a script. Present only when the lookup sent an
443
+ # agent and the answer has every field (a paid plan, or the trial); nil on a
444
+ # bogon, which is answered locally.
445
+ def user_agent
446
+ @raw['user_agent']
447
+ end
448
+
436
449
  # On answers to a key on the free plan only: false while its organization's
437
450
  # trial of every field lasts, true once the answer has Unlimited's; nil on
438
451
  # any other answer.
@@ -203,12 +203,16 @@ module InternetData
203
203
  request
204
204
  end
205
205
 
206
- def lookup_request(ip, timeout: nil)
207
- lookup_get(LOOKUP_PATH.sub('{ip}', CGI.escape(ip.to_s)), timeout)
206
+ # `user_agent` goes as the query parameter only when there is one: nil or
207
+ # empty is none. Built here rather than by a generated client, whose
208
+ # `maxLength` check refuses an agent past the spec's 1024 characters that the
209
+ # API itself cuts there and answers.
210
+ def lookup_request(ip, timeout: nil, user_agent: nil)
211
+ lookup_get(LOOKUP_PATH.sub('{ip}', CGI.escape(ip.to_s)), timeout, user_agent: user_agent)
208
212
  end
209
213
 
210
- def myip_request(timeout: nil)
211
- lookup_get(MYIP_PATH, timeout)
214
+ def myip_request(timeout: nil, user_agent: nil)
215
+ lookup_get(MYIP_PATH, timeout, user_agent: user_agent)
212
216
  end
213
217
 
214
218
  def asn_request(asn, timeout: nil)
@@ -223,17 +227,32 @@ module InternetData
223
227
  lookup_get(ENTITLEMENT_PATH, timeout)
224
228
  end
225
229
 
226
- # The one request with a body: the batch.
227
- def batch_request(ips, timeout: nil)
230
+ # The one request with a body: the batch. `user_agents`, keyed by each
231
+ # address as it is in `ips`, is sent only when it holds an entry, never as
232
+ # `{}`: the spec types it an object, never null or empty.
233
+ def batch_request(ips, timeout: nil, user_agents: nil)
234
+ body = { ips: ips }
235
+ body[:user_agents] = user_agents unless user_agents.nil? || user_agents.empty?
228
236
  build_request(
229
237
  :POST, BATCH_PATH,
230
238
  header_params: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' },
231
- body: { ips: ips },
239
+ body: body,
232
240
  auth_names: LOOKUP_AUTH,
233
241
  timeout: timeout,
234
242
  )
235
243
  end
236
244
 
245
+ # The agent a call sends: nil for none, which an empty one is, as the API
246
+ # reads `user_agent=`. Anything but a String or nil is refused, since its
247
+ # text would be sent as the agent. One past the spec's 1024 characters is
248
+ # sent as it is: the API cuts it there and answers.
249
+ def self.checked_user_agent(user_agent)
250
+ return nil if user_agent.nil?
251
+ raise ArgumentError, "user_agent must be a String, not #{user_agent.inspect}" unless user_agent.is_a?(String)
252
+
253
+ user_agent.empty? ? nil : user_agent
254
+ end
255
+
237
256
  def self.entitlement_result(response)
238
257
  body = answer(response)
239
258
  begin
@@ -484,8 +503,9 @@ module InternetData
484
503
 
485
504
  private
486
505
 
487
- def lookup_get(path, timeout)
488
- build_request(:GET, path, header_params: { 'Accept' => 'application/json' }, auth_names: LOOKUP_AUTH,
506
+ def lookup_get(path, timeout, user_agent: nil)
507
+ build_request(:GET, path, query_params: user_agent ? { user_agent: user_agent } : {},
508
+ header_params: { 'Accept' => 'application/json' }, auth_names: LOOKUP_AUTH,
489
509
  timeout: timeout)
490
510
  end
491
511
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetData
4
- VERSION = '2.17.0'
4
+ VERSION = '2.18.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internetdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.17.0
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mslm Dev