Class: Apifreaks::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/apifreaks/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url: nil, max_retries: 2) ⇒ void

Parameters:

  • base_url (String, nil) (defaults to: nil)
  • max_retries (Integer) (defaults to: 2)


5307
5308
5309
5310
5311
5312
5313
5314
5315
# File 'lib/apifreaks/client.rb', line 5307

def initialize(base_url: nil, max_retries: 2)
  @raw_client = Apifreaks::Internal::Http::RawClient.new(
    base_url: base_url || Apifreaks::Environment::DEFAULT,
    headers: {
      "X-Fern-Language" => "Ruby"
    },
    max_retries: max_retries
  )
end

Instance Method Details

#air_quality(request_options: {}, **params) ⇒ Apifreaks::Types::AirQualityResponse

Monitor and predict air quality conditions using European and US AQI standards. Track pollutant concentrations including PM10, PM2.5, carbon monoxide, nitrogen dioxide, sulfur dioxide, ozone, and dust particles. Get current readings plus hourly forecasts up to 5 days ahead, complete with UV index and aerosol measurements for comprehensive air quality assessment.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
# File 'lib/apifreaks/client.rb', line 4277

def air_quality(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/air-quality",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::AirQualityResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#asn_whois_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::AsnWhoisLookupResponse

Returns WHOIS registration details for a specified ASN, with or without the ‘as’ prefix.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/apifreaks/client.rb', line 452

def asn_whois_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["asn"] = params[:asn] if params.key?(:asn)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/asn/whois/live",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::AsnWhoisLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#astronomy_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::AstronomyLookupResponse

Retrieve sunrise and sunset times, current position of the moon, and other related information by specifying a location address, location coordinates, IP address, or using the client IP address if no parameter is passed.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::AstronomyLookupRequestFormat, nil)
  • :location (String, nil)
  • :lat (Integer, nil)
  • :long (Integer, nil)
  • :ip (String, nil)
  • :lang (String, nil)
  • :date (String, nil)
  • :elevation (Integer, nil)
  • :time_zone (String, nil)

Returns:



5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
# File 'lib/apifreaks/client.rb', line 5268

def astronomy_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["lang"] = params[:lang] if params.key?(:lang)
  query_params["date"] = params[:date] if params.key?(:date)
  query_params["elevation"] = params[:elevation] if params.key?(:elevation)
  query_params["time_zone"] = params[:time_zone] if params.key?(:time_zone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geolocation/astronomy",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::AstronomyLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_current_weather(request_options: {}, **params) ⇒ Apifreaks::Types::BulkCurrentWeatherResponse

Retrieve current weather conditions for up to ‘50 locations` in a single request. A maximum of 50 locations (city names, IP addresses, or geographic coordinates) can be included in the request body.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
# File 'lib/apifreaks/client.rb', line 3990

def bulk_current_weather(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkCurrentWeatherRequest.new(params).to_h
  non_body_param_names = %w[apiKey format timezone]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/weather/current",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkCurrentWeatherResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_domain_availability_check(request_options: {}, **params) ⇒ Apifreaks::Types::BulkDomainAvailabilityCheckResponse

Perform Bulk Domain Availability checks using a list of domains. Supports upto ‘100 Domains Per Request`.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
# File 'lib/apifreaks/client.rb', line 1160

def bulk_domain_availability_check(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkDomainAvailabilityCheckRequest.new(params).to_h
  non_body_param_names = %w[apiKey format source]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["source"] = params[:source] if params.key?(:source)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/domain/availability",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkDomainAvailabilityCheckResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_domain_dns_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::BulkDomainDNSLookupResponse

Perform DNS lookups for multiple hostnames in a single request. Supports up to ‘100 host-names per request` and returns DNS records including A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'lib/apifreaks/client.rb', line 639

def bulk_domain_dns_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkDomainDNSLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format type]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["type"] = params[:type] if params.key?(:type)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/domain/dns/live",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkDomainDNSLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_domain_whois_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::BulkDomainWhoisLookupResponse

Retrieve WHOIS information for ‘100 Domains per Request`.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/apifreaks/client.rb', line 364

def bulk_domain_whois_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkDomainWhoisLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/domain/whois/live",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkDomainWhoisLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_email_validate(request_options: {}, **params) ⇒ Apifreaks::Types::BulkEmailValidateResponse

Validates a bulk of email addresses and returns result for each. Maximum ‘10` email addresses per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
# File 'lib/apifreaks/client.rb', line 888

def bulk_email_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkEmailValidateRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/email-validation/bulk",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkEmailValidateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_geolocation_lookup(request_options: {}, **params) ⇒ Array[Apifreaks::Types::BulkGeolocationLookupResponseItem]

Retrieve detailed geolocation data for multiple IP addresses in a single request. Supports up to ‘50,000` IP-addresses/host-names per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/apifreaks/client.rb', line 74

def bulk_geolocation_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkGeolocationLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format lang fields excludes include]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["lang"] = params[:lang] if params.key?(:lang)
  query_params["fields"] = params[:fields] if params.key?(:fields)
  query_params["excludes"] = params[:excludes] if params.key?(:excludes)
  query_params["include"] = params[:include] if params.key?(:include)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/geolocation/lookup",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#bulk_ip_security_lookup(request_options: {}, **params) ⇒ Array[Apifreaks::Types::BulkIPSecurityLookupResponseItem]

The Bulk IP Security Lookup API allows you to retrieve security details for up to ‘50,000` IP-addresses in a single request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/apifreaks/client.rb', line 171

def bulk_ip_security_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkIPSecurityLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format fields excludes]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["fields"] = params[:fields] if params.key?(:fields)
  query_params["excludes"] = params[:excludes] if params.key?(:excludes)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/ip/security",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#bulk_phone_validate(request_options: {}, **params) ⇒ Array[Apifreaks::Types::BulkPhoneValidateResponseItem]

Validates up to 100 phone numbers in a single request. Each number is processed independently — invalid entries return per-number errors without affecting the rest of the batch.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
# File 'lib/apifreaks/client.rb', line 980

def bulk_phone_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkPhoneValidateRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/phone/validation/bulk",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#bulk_screenshot_capture(request_options: {}, **params) ⇒ Apifreaks::Types::BulkScreenshotCaptureResponse

Our Bulk Screenshot API allows you to capture screenshots of multiple webpages simultaneously, saving you time and effort. Instead of manually capturing each page one by one, you can batch process URLs and receive high-quality screenshots in the format you choose.

Maximum `50 URLs` per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
# File 'lib/apifreaks/client.rb', line 2556

def bulk_screenshot_capture(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkScreenshotCaptureRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/screenshot",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkScreenshotCaptureResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_user_agent_lookup(request_options: {}, **params) ⇒ Array[Apifreaks::Types::BulkUserAgentLookupResponseItem]

Parse up to ‘50,000 User-Agent strings` at once in a single request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
# File 'lib/apifreaks/client.rb', line 4972

def bulk_user_agent_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkUserAgentLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/user-agent/lookup",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#bulk_vat_rate_by_country(request_options: {}, **params) ⇒ Apifreaks::Types::BulkVatRateByCountryResponse

Retrieves VAT details for multiple countries or country-state combinations in a single request. Maximum of ‘100` entries per request are allowed.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
# File 'lib/apifreaks/client.rb', line 3400

def bulk_vat_rate_by_country(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkVatRateByCountryRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/vat/rates/country",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkVatRateByCountryResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#bulk_zipcode_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::BulkZipcodeLookupResponse

Validates a bulk of ZIP/postal codes and returns result for each. Maximum ‘100` ZIP/postal codes per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
# File 'lib/apifreaks/client.rb', line 3659

def bulk_zipcode_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::BulkZipcodeLookupRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/zipcode/lookup",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::BulkZipcodeLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#commodity_fluctuation(request_options: {}, **params) ⇒ Apifreaks::Types::CommodityFluctuationResponse

Get commodity price fluctuation data for a time period

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
# File 'lib/apifreaks/client.rb', line 3146

def commodity_fluctuation(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/commodity/fluctuation",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CommodityFluctuationResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#commodity_historical_rates(request_options: {}, **params) ⇒ Apifreaks::Types::CommodityHistoricalRatesResponse

Get historical commodity rates for a specific date

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
# File 'lib/apifreaks/client.rb', line 3101

def commodity_historical_rates(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["date"] = params[:date] if params.key?(:date)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/commodity/rates/historical",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CommodityHistoricalRatesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#commodity_latest_rates(request_options: {}, **params) ⇒ Apifreaks::Types::CommodityLatestRatesResponse

Get live commodity rates with customizable update frequency

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
# File 'lib/apifreaks/client.rb', line 3056

def commodity_latest_rates(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)
  query_params["updates"] = params[:updates] if params.key?(:updates)
  query_params["quote"] = params[:quote] if params.key?(:quote)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/commodity/rates/latest",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CommodityLatestRatesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#commodity_symbols(request_options: {}, **params) ⇒ Apifreaks::Types::CommoditySymbolsResponse

Get list of supported commodities

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
# File 'lib/apifreaks/client.rb', line 3235

def commodity_symbols(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/commodity/symbols",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CommoditySymbolsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#commodity_time_series(request_options: {}, **params) ⇒ Apifreaks::Types::CommodityTimeSeriesResponse

Get commodity rates for a time range

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
# File 'lib/apifreaks/client.rb', line 3192

def commodity_time_series(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/commodity/time-series",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CommodityTimeSeriesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_convert_by_ip(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyConvertByIPResponse

Convert amount using user’s location

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
# File 'lib/apifreaks/client.rb', line 2889

def currency_convert_by_ip(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["updates"] = params[:updates] if params.key?(:updates)
  query_params["from"] = params[:from] if params.key?(:from)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["amount"] = params[:amount] if params.key?(:amount)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/converter/ip-to-currency",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyConvertByIPResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_convert_historical(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyConvertHistoricalResponse

Convert amount between currencies using historical rates

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
# File 'lib/apifreaks/client.rb', line 2745

def currency_convert_historical(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["from"] = params[:from] if params.key?(:from)
  query_params["to"] = params[:to] if params.key?(:to)
  query_params["amount"] = params[:amount] if params.key?(:amount)
  query_params["date"] = params[:date] if params.key?(:date)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/converter/historical/prices",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyConvertHistoricalResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_convert_latest(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyConvertLatestResponse

Convert amount between currencies using the latest exchange rates

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
# File 'lib/apifreaks/client.rb', line 2697

def currency_convert_latest(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["from"] = params[:from] if params.key?(:from)
  query_params["to"] = params[:to] if params.key?(:to)
  query_params["amount"] = params[:amount] if params.key?(:amount)
  query_params["updates"] = params[:updates] if params.key?(:updates)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/converter/latest/prices",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyConvertLatestResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_fluctuation(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyFluctuationResponse

Get currency fluctuation data for a time period

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
# File 'lib/apifreaks/client.rb', line 2841

def currency_fluctuation(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["base"] = params[:base] if params.key?(:base)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/fluctuation",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyFluctuationResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_historical_limits(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyHistoricalLimitsResponse

Get information about historical data availability and limits

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
# File 'lib/apifreaks/client.rb', line 3013

def currency_historical_limits(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/historical/data/limits",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyHistoricalLimitsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_historical_rates(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyHistoricalRatesResponse

Get historical exchange rates for any specific date

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
# File 'lib/apifreaks/client.rb', line 2650

def currency_historical_rates(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["base"] = params[:base] if params.key?(:base)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)
  query_params["date"] = params[:date] if params.key?(:date)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/rates/historical",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyHistoricalRatesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_latest_rates(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyLatestRatesResponse

Get live forex rates for all world currencies with customizable update frequency

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
# File 'lib/apifreaks/client.rb', line 2604

def currency_latest_rates(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["base"] = params[:base] if params.key?(:base)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)
  query_params["updates"] = params[:updates] if params.key?(:updates)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/rates/latest",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyLatestRatesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_supported(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencySupportedResponse

Get list of all supported currencies with their metadata

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
# File 'lib/apifreaks/client.rb', line 2933

def currency_supported(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/supported",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencySupportedResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_symbols(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencySymbolsResponse

Get currency symbols and codes

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
# File 'lib/apifreaks/client.rb', line 2973

def currency_symbols(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/symbols",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencySymbolsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#currency_time_series(request_options: {}, **params) ⇒ Apifreaks::Types::CurrencyTimeSeriesResponse

Get exchange rates for a time range

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
# File 'lib/apifreaks/client.rb', line 2793

def currency_time_series(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["base"] = params[:base] if params.key?(:base)
  query_params["symbols"] = params[:symbols] if params.key?(:symbols)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/currency/time-series",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrencyTimeSeriesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#current_weather(request_options: {}, **params) ⇒ Apifreaks::Types::CurrentWeatherResponse

Get current weather data including temperature, humidity, precipitation, wind conditions, atmospheric pressure, and air quality for any location. Accepts city names, coordinates, or IP addresses. Also includes astronomy data and timezone-aware timestamps.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
# File 'lib/apifreaks/client.rb', line 3943

def current_weather(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/current",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::CurrentWeatherResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_availability_check(request_options: {}, **params) ⇒ Apifreaks::Types::DomainAvailabilityCheckResponse

The Domain Search API is designed to simplify the process of finding available domain names across all top-level domains (TLDs) and second-level domains (SLDs).

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
# File 'lib/apifreaks/client.rb', line 1117

def domain_availability_check(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domain"] = params[:domain] if params.key?(:domain)
  query_params["source"] = params[:source] if params.key?(:source)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/availability",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainAvailabilityCheckResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_availability_suggestions(request_options: {}, **params) ⇒ Apifreaks::Types::DomainAvailabilitySuggestionsResponse

The Domain Search API is designed to simplify the process of finding available domain names across all top-level domains (TLDs) and second-level domains (SLDs).

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
# File 'lib/apifreaks/client.rb', line 1210

def domain_availability_suggestions(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domain"] = params[:domain] if params.key?(:domain)
  query_params["source"] = params[:source] if params.key?(:source)
  query_params["count"] = params[:count] if params.key?(:count)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/availability/suggestions",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainAvailabilitySuggestionsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_dns_history(request_options: {}, **params) ⇒ Apifreaks::Types::DomainDNSHistoryResponse

Retrieve historical DNS records for any hostname. Access unique historical data for A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records, including subdomains. Results are paginated with up to 100 unique records per page.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
# File 'lib/apifreaks/client.rb', line 690

def domain_dns_history(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["host-name"] = params[:host_name] if params.key?(:host_name)
  query_params["type"] = params[:type] if params.key?(:type)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/dns/history",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainDNSHistoryResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_dns_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::DomainDNSLookupResponse

Retrieve real-time DNS records for any hostname. Supports multiple record types including A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/apifreaks/client.rb', line 594

def domain_dns_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["host-name"] = params[:host_name] if params.key?(:host_name)
  query_params["ipAddress"] = params[:ip_address] if params.key?(:ip_address)
  query_params["type"] = params[:type] if params.key?(:type)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/dns/live",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainDNSLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_dns_reverse(request_options: {}, **params) ⇒ Apifreaks::Types::DomainDNSReverseResponse

Retrieve all the hostnames associated with any particular A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME DNS records. For instance, you can access all the hostnames hosted on any IP/CIDR notation, all the domain names using Cloudflare name servers, and all the domain names using Google Mailbox

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
# File 'lib/apifreaks/client.rb', line 739

def domain_dns_reverse(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["type"] = params[:type] if params.key?(:type)
  query_params["value"] = params[:value] if params.key?(:value)
  query_params["exact"] = params[:exact] if params.key?(:exact)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/dns/reverse",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainDNSReverseResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_ssl_chain_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::DomainSslChainLookupResponse

Retrieve the complete SSL certificate chain from root Certificate Authority (CA) to end-user certificate. This endpoint provides comprehensive information about each certificate in the chain.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# File 'lib/apifreaks/client.rb', line 1072

def domain_ssl_chain_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domainName"] = params[:domain_name] if params.key?(:domain_name)
  query_params["sslRaw"] = params[:ssl_raw] if params.key?(:ssl_raw)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/ssl/live/chain",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainSslChainLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_ssl_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::DomainSslLookupResponse

Retrieve comprehensive SSL certificate information without the certificate chain. This endpoint provides detailed information about the SSL certificate including expiry dates, issuer details, and encryption methods.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
# File 'lib/apifreaks/client.rb', line 1027

def domain_ssl_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domainName"] = params[:domain_name] if params.key?(:domain_name)
  query_params["sslRaw"] = params[:ssl_raw] if params.key?(:ssl_raw)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/ssl/live",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainSslLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_whois_history(request_options: {}, **params) ⇒ Apifreaks::Types::DomainWhoisHistoryResponse

Retrieve historical WHOIS records for a domain name. This endpoint provides a timeline of all recorded changes in domain registration information.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/apifreaks/client.rb', line 495

def domain_whois_history(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domainName"] = params[:domain_name] if params.key?(:domain_name)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/whois/history",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainWhoisHistoryResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_whois_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::DomainWhoisLookupResponse

Retrieve current WHOIS information for a domain name. This endpoint provides detailed registration information including registrar details, dates, nameservers, and registrant information.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/apifreaks/client.rb', line 323

def domain_whois_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domainName"] = params[:domain_name] if params.key?(:domain_name)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/whois/live",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainWhoisLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#domain_whois_reverse(request_options: {}, **params) ⇒ Apifreaks::Types::DomainWhoisReverseResponse

Performs a reverse WHOIS search using one or more search parameters like keyword, email, owner, or company.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/apifreaks/client.rb', line 543

def domain_whois_reverse(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["keyword"] = params[:keyword] if params.key?(:keyword)
  query_params["email"] = params[:email] if params.key?(:email)
  query_params["owner"] = params[:owner] if params.key?(:owner)
  query_params["company"] = params[:company] if params.key?(:company)
  query_params["exact"] = params[:exact] if params.key?(:exact)
  query_params["mode"] = params[:mode] if params.key?(:mode)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/domain/whois/reverse",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::DomainWhoisReverseResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#email_validate(request_options: {}, **params) ⇒ Apifreaks::Types::EmailValidateResponse

Validates a single email address and returns result.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
# File 'lib/apifreaks/client.rb', line 843

def email_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::EmailValidateRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/email-validation/single",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::EmailValidateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#flood_forecast(request_options: {}, **params) ⇒ Apifreaks::Types::FloodForecastResponse

Provides flood forecast data for a given location, including river discharge metrics such as mean, median, maximum, minimum, and percentile values (p25, p75). Requires a startDate and endDate, with the date range limited to 16 days. Location can be specified using city name, latitude/longitude, or IP address.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
# File 'lib/apifreaks/client.rb', line 4335

def flood_forecast(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/flood",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::FloodForecastResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#geocoder_reverse(request_options: {}, **params) ⇒ Apifreaks::Types::GeocoderReverseResponse

Convert geographic coordinates (latitude and longitude) into a human-readable address or place name.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/apifreaks/client.rb', line 274

def geocoder_reverse(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["lon"] = params[:lon] if params.key?(:lon)

  headers = {}
  headers["Accept-Language"] = params[:accept_language] if params[:accept_language]

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geocoder/reverse",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GeocoderReverseResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#geocoder_search(request_options: {}, **params) ⇒ Array[Apifreaks::Types::GeocoderSearchResponseItem]

Convert a given address or place name into geographic coordinates (latitude and longitude).

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::GeocoderSearchRequestFormat, nil)
  • :query (String)
  • :limit (Integer, nil)
  • :min_lat (Integer, nil)
  • :max_lat (Integer, nil)
  • :min_lon (Integer, nil)
  • :max_lon (Integer, nil)
  • :accept_language (String, nil)

Returns:

Raises:

  • (error_class)


223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/apifreaks/client.rb', line 223

def geocoder_search(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["query"] = params[:query] if params.key?(:query)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["min_lat"] = params[:min_lat] if params.key?(:min_lat)
  query_params["max_lat"] = params[:max_lat] if params.key?(:max_lat)
  query_params["min_lon"] = params[:min_lon] if params.key?(:min_lon)
  query_params["max_lon"] = params[:max_lon] if params.key?(:max_lon)

  headers = {}
  headers["Accept-Language"] = params[:accept_language] if params[:accept_language]

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geocoder/search",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#geolocation_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::GeolocationLookupResponse

Get detailed geolocation data for an IP address including country, city, timezone, currency, and optional security and user-agent information

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/apifreaks/client.rb', line 24

def geolocation_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["lang"] = params[:lang] if params.key?(:lang)
  query_params["fields"] = params[:fields] if params.key?(:fields)
  query_params["excludes"] = params[:excludes] if params.key?(:excludes)
  query_params["include"] = params[:include] if params.key?(:include)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geolocation/lookup",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GeolocationLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_admin_levels(request_options: {}, **params) ⇒ Apifreaks::Types::GetAdminLevelsResponse

Retrieve administrative units based on ISO 3166-1 alpha-2 country code.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
# File 'lib/apifreaks/client.rb', line 4546

def get_admin_levels(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/admin-levels",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetAdminLevelsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_admin_unit_details(request_options: {}, **params) ⇒ Apifreaks::Types::GetAdminUnitDetailsResponse

Retrieve detailed administrative unit information by country and optionally filtered by admin code.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
# File 'lib/apifreaks/client.rb', line 4634

def get_admin_unit_details(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["admin_unit"] = params[:admin_unit] if params.key?(:admin_unit)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/admin-unit/details",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetAdminUnitDetailsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_admin_units(request_options: {}, **params) ⇒ Apifreaks::Types::GetAdminUnitsResponse

Retrieve administrative divisions for a given country using ISO 3166-1 alpha-2 country codes. You can optionally filter by administrative levels.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
# File 'lib/apifreaks/client.rb', line 4590

def get_admin_units(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["adminLevels"] = params[:admin_levels] if params.key?(:admin_levels)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/admin-units",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetAdminUnitsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_cities(request_options: {}, **params) ⇒ Apifreaks::Types::GetCitiesResponse

Retrieve a list of cities within a country, optionally filtered by an administrative unit code.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
# File 'lib/apifreaks/client.rb', line 4678

def get_cities(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["admin_unit"] = params[:admin_unit] if params.key?(:admin_unit)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/cities",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetCitiesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_countries(request_options: {}, **params) ⇒ Apifreaks::Types::GetCountriesResponse

Retrieve countries, optionally filtered by region or subregion.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
# File 'lib/apifreaks/client.rb', line 4385

def get_countries(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["region"] = params[:region] if params.key?(:region)
  query_params["subregion"] = params[:subregion] if params.key?(:subregion)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/countries",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetCountriesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_country_details(request_options: {}, **params) ⇒ Apifreaks::Types::GetCountryDetailsResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
# File 'lib/apifreaks/client.rb', line 4426

def get_country_details(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/country/details",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetCountryDetailsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_flags(request_options: {}, **params) ⇒ untyped

Retrieve the flag for a specific country

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

  • (untyped)

Raises:

  • (error_class)


4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
# File 'lib/apifreaks/client.rb', line 4760

def get_flags(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["name"] = params[:name] if params.key?(:name)
  query_params["shape"] = params[:shape] if params.key?(:shape)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["size"] = params[:size] if params.key?(:size)
  query_params["type"] = params[:type] if params.key?(:type)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/flags",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_regions(request_options: {}, **params) ⇒ Apifreaks::Types::GetRegionsResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
# File 'lib/apifreaks/client.rb', line 4465

def get_regions(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/regions",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetRegionsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_subregions(request_options: {}, **params) ⇒ Apifreaks::Types::GetSubregionsResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
# File 'lib/apifreaks/client.rb', line 4504

def get_subregions(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["region"] = params[:region] if params.key?(:region)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geo/subregions",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GetSubregionsResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_supported_flags(request_options: {}, **params) ⇒ Array[Apifreaks::Types::GetSupportedFlagsResponseItem]

Get list of all supported flags with their metadata

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)

Returns:

Raises:

  • (error_class)


4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
# File 'lib/apifreaks/client.rb', line 4719

def get_supported_flags(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/flags/supported",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#grammar_correct(request_options: {}, **params) ⇒ Apifreaks::Types::GrammarCorrectResponse

Submit text with grammatical issues and receive a clean grammar-corrected result for proofreading and content workflows.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)

Returns:



5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
# File 'lib/apifreaks/client.rb', line 5123

def grammar_correct(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::GrammarCorrectRequest.new(params).to_h
  non_body_param_names = %w[apiKey]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/readability/grammar/correct",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GrammarCorrectResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#grammar_detect(request_options: {}, **params) ⇒ Apifreaks::Types::GrammarDetectResponse

Analyze text for grammar errors and return the exact words flagged as grammatically incorrect with zero-based word positions.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)

Returns:



5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
# File 'lib/apifreaks/client.rb', line 5079

def grammar_detect(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::GrammarDetectRequest.new(params).to_h
  non_body_param_names = %w[apiKey]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/readability/grammar/detect",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::GrammarDetectResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#historical_weather(request_options: {}, **params) ⇒ Apifreaks::Types::HistoricalWeatherResponse

Access past weather conditions for specific dates with records going back to 1940. Retrieve comprehensive historical data with both daily and hourly precision options.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
# File 'lib/apifreaks/client.rb', line 4104

def historical_weather(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["date"] = params[:date] if params.key?(:date)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/historical",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::HistoricalWeatherResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#iban_validate(request_options: {}, **params) ⇒ Apifreaks::Types::IbanValidateResponse

Checks an IBAN for structural validity, checksum accuracy, and bank metadata.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
# File 'lib/apifreaks/client.rb', line 3490

def iban_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["iban"] = params[:iban] if params.key?(:iban)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/iban/validation",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::IbanValidateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#ip_security_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::IPSecurityLookupResponse

Get comprehensive security information for a given IP address. Detects VPNs, proxies, Tor nodes, and other security threats.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/apifreaks/client.rb', line 125

def ip_security_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["fields"] = params[:fields] if params.key?(:fields)
  query_params["excludes"] = params[:excludes] if params.key?(:excludes)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/ip/security",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::IPSecurityLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#ip_whois_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::IPWhoisLookupResponse

Returns WHOIS registration details for a specified IP address (IPv4 or IPv6).

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/apifreaks/client.rb', line 410

def ip_whois_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["ip"] = params[:ip] if params.key?(:ip)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/ip/whois/live",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::IPWhoisLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#marine_weather(request_options: {}, **params) ⇒ Apifreaks::Types::MarineWeatherResponse

Provides hourly forecasts of marine conditions including wave heights, wave directions, wave periods, swell info, sea surface temperatures, and ocean currents. Supports multiple geographical points and returns daily max wave statistics for up to 7 days. Ideal for maritime planning, navigation, and coastal activities.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
# File 'lib/apifreaks/client.rb', line 4218

def marine_weather(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/marine",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::MarineWeatherResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#ocr_predict(request_options: {}, **params) ⇒ Apifreaks::Types::OcrPredictResponse

Perform Optical Character Recognition (OCR) on images, PDFs, or ZIP archives. Supports two models: ‘mini-ocr-v1` for CAPTCHA-optimized OCR and `ocr-v1` for general-purpose document text extraction. Supports zonal OCR to extract text from specific regions of an image.

Notes:

  • The ‘zone` query parameter cannot be given with .pdf and .zip types as it can only be applied to single image

query.

  • The ‘page_range` query parameter cannot be given in any other type except .pdf types.

  • PDFs containing images in them are allowed only for processing.

  • The ‘mini-ocr-v1` model doesn’t support the following query parameters:

    - `page_range` (.pdf types)
    - `zone`
    

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
# File 'lib/apifreaks/client.rb', line 5030

def ocr_predict(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::OcrPredictRequest.new(params).to_h
  non_body_param_names = %w[apiKey url model page_range zone new_line]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["url"] = params[:url] if params.key?(:url)
  query_params["model"] = params[:model] if params.key?(:model)
  query_params["page_range"] = params[:page_range] if params.key?(:page_range)
  query_params["zone"] = params[:zone] if params.key?(:zone)
  query_params["new_line"] = params[:new_line] if params.key?(:new_line)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/ocr/predict",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::OcrPredictResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_compress(request_options: {}, **params) ⇒ Apifreaks::Types::PdfCompressResponse

This API compresses a given PDF file to reduce its file size.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'lib/apifreaks/client.rb', line 1499

def pdf_compress(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/compress",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfCompressResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_convert_to_bmp(request_options: {}, **params) ⇒ Apifreaks::Types::PdfConvertToBmpResponse

Converts a PDF file to a BMP image.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
# File 'lib/apifreaks/client.rb', line 1993

def pdf_convert_to_bmp(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/bmp",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfConvertToBmpResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_convert_to_gif(request_options: {}, **params) ⇒ Apifreaks::Types::PdfConvertToGifResponse

This API converts a given PDF file into a sequence of GIF images.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
# File 'lib/apifreaks/client.rb', line 2043

def pdf_convert_to_gif(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/gif",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfConvertToGifResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_convert_to_jpg(request_options: {}, **params) ⇒ Apifreaks::Types::PdfConvertToJpgResponse

This API converts a given PDF file into a sequence of JPG images.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
# File 'lib/apifreaks/client.rb', line 1892

def pdf_convert_to_jpg(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/jpg",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfConvertToJpgResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_convert_to_png(request_options: {}, **params) ⇒ Apifreaks::Types::PdfConvertToPngResponse

This API converts a given PDF file into a sequence of PNG images.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
# File 'lib/apifreaks/client.rb', line 1841

def pdf_convert_to_png(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/png",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfConvertToPngResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_convert_to_tiff(request_options: {}, **params) ⇒ Apifreaks::Types::PdfConvertToTiffResponse

This API converts a given PDF file into a sequence of TIFF images. The output images can be saved as a single TIFF file, or as a sequence of TIFF files.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
# File 'lib/apifreaks/client.rb', line 1943

def pdf_convert_to_tiff(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/tif",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfConvertToTiffResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_decrypt(request_options: {}, **params) ⇒ Apifreaks::Types::PdfDecryptResponse

This API decrypts PDF files, removing all encryption, including open passwords and permission restrictions.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfDecryptRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :file_password (String)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
# File 'lib/apifreaks/client.rb', line 1690

def pdf_decrypt(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/decrypt",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfDecryptResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_delete_file(request_options: {}, **params) ⇒ Apifreaks::Types::PdfDeleteFileResponse

This API deletes a PDF file using its unique file ID.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
# File 'lib/apifreaks/client.rb', line 2336

def pdf_delete_file(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["file_id"] = params[:file_id] if params.key?(:file_id)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "v1.0/pdf/file",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfDeleteFileResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_download_resource(request_options: {}, **params) ⇒ untyped

This API downloads PDF files or ZIP archives from the server using their unique resource ID.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

  • (untyped)

Raises:

  • (error_class)


2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
# File 'lib/apifreaks/client.rb', line 2169

def pdf_download_resource(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["resource_id"] = params[:resource_id] if params.key?(:resource_id)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/pdf/resource/download",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#pdf_encrypt(request_options: {}, **params) ⇒ Apifreaks::Types::PdfEncryptResponse

This API encrypts a PDF file by setting a password required to open it.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfEncryptRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :file_password (String, nil)
  • :user_password (String)
  • :owner_password (String, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
# File 'lib/apifreaks/client.rb', line 1643

def pdf_encrypt(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/encrypt",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfEncryptResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_extract_pages(request_options: {}, **params) ⇒ Apifreaks::Types::PdfExtractPagesResponse

This API extracts specific pages or page ranges from a PDF file and returns them as a new PDF.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfExtractPagesRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :pages (String)
  • :separated (Boolean, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
# File 'lib/apifreaks/client.rb', line 1547

def pdf_extract_pages(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/extract-pages",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfExtractPagesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_get_file_status(request_options: {}, **params) ⇒ Apifreaks::Types::PdfGetFileStatusResponse

This API checks the status of a PDF file using its unique file ID, providing information about its creation and potential deletion time.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
# File 'lib/apifreaks/client.rb', line 2252

def pdf_get_file_status(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["file_id"] = params[:file_id] if params.key?(:file_id)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/pdf/file-status",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfGetFileStatusResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_get_task_status(request_options: {}, **params) ⇒ Apifreaks::Types::PdfGetTaskStatusResponse

This API checks the status of a previously initiated PDF processing task using its unique task ID.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
# File 'lib/apifreaks/client.rb', line 2209

def pdf_get_task_status(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["task_id"] = params[:task_id] if params.key?(:task_id)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/pdf/task-status",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfGetTaskStatusResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_linearize(request_options: {}, **params) ⇒ Apifreaks::Types::PdfLinearizeResponse

API endpoint that linearizes any given PDF, restructuring it for faster loading and page-by-page viewing in web browsers.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfLinearizeRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
# File 'lib/apifreaks/client.rb', line 1594

def pdf_linearize(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/linearize",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfLinearizeResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_list_files(request_options: {}, **params) ⇒ Apifreaks::Types::PdfListFilesResponse

This API retrieves a list of all PDF files uploaded and generated by a specific user. Please note that if the user is part of an organization, only the Organization Administrator can access this endpoint. Organization Members cannot access this endpoint.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
# File 'lib/apifreaks/client.rb', line 2295

def pdf_list_files(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/pdf/files",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfListFilesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_merge(request_options: {}, **params) ⇒ Apifreaks::Types::PdfMergeResponse

This API merges multiple PDF files into a single PDF, in the order they are provided

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfMergeRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
# File 'lib/apifreaks/client.rb', line 1310

def pdf_merge(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/merge",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfMergeResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_remove_pages(request_options: {}, **params) ⇒ Apifreaks::Types::PdfRemovePagesResponse

This API removes a selection or range of pages from a PDF file.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfRemovePagesRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :pages (String)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
# File 'lib/apifreaks/client.rb', line 1357

def pdf_remove_pages(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/remove-pages",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfRemovePagesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_restrict(request_options: {}, **params) ⇒ Apifreaks::Types::PdfRestrictResponse

This API applies permission restrictions on a PDF file, such as disabling printing, copying, or editing. This can include password protection to enforce restrictions.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
# File 'lib/apifreaks/client.rb', line 1741

def pdf_restrict(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/restrict",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfRestrictResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_rotate(request_options: {}, **params) ⇒ Apifreaks::Types::PdfRotateResponse

This API rotates pages of a PDF by a specified angle (in multiples of 90 degrees).

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfRotateRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :pages (String, nil)
  • :rotate (Integer)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
# File 'lib/apifreaks/client.rb', line 1452

def pdf_rotate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/rotate",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfRotateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_split(request_options: {}, **params) ⇒ Apifreaks::Types::PdfSplitResponse

This API splits a PDF into multiple parts based on specified page numbers or ranges.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfSplitRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :pages (String, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
# File 'lib/apifreaks/client.rb', line 1404

def pdf_split(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/split",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfSplitResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_unrestrict(request_options: {}, **params) ⇒ Apifreaks::Types::PdfUnrestrictResponse

This API removes permission restrictions from a PDF while keeping it encrypted. If you want to remove all security (including encryption), use the ‘/pdf/decrypt` endpoint instead.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::PdfUnrestrictRequestFormat, nil)
  • :file_id (String, nil)
  • :destroy (Boolean, nil)
  • :output (String, nil)
  • :file_password (String)
  • :user_password (String, nil)
  • :owner_password (String, nil)
  • :webhook_url (String, nil)
  • :webhook_failure_notification (Boolean, nil)
  • :webhook_authorization (String, nil)

Returns:



1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
# File 'lib/apifreaks/client.rb', line 1791

def pdf_unrestrict(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/unrestrict",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfUnrestrictResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_upload_binary(request_options: {}, **params) ⇒ Apifreaks::Types::PdfUploadBinaryResponse

This API uploads PDF files to the API Freaks server in binary format.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
# File 'lib/apifreaks/client.rb', line 2124

def pdf_upload_binary(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[api_key format file_name]
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["file_name"] = params[:file_name] if params.key?(:file_name)
  params = params.except(*query_param_names)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/resource/upload-binary",
    query: query_params,
    body: params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfUploadBinaryResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#pdf_upload_resources(request_options: {}, **params) ⇒ Apifreaks::Types::PdfUploadResourcesResponse

This API uploads multiple PDF files to the API Freaks server and generates their unique file IDs.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
# File 'lib/apifreaks/client.rb', line 2083

def pdf_upload_resources(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  request = Apifreaks::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/pdf/resource/upload",
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PdfUploadResourcesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#phone_validate(request_options: {}, **params) ⇒ Apifreaks::Types::PhoneValidateResponse

Validates a single phone number and returns detailed metadata including carrier, line type, geolocation, time zones, and standardized formats.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
# File 'lib/apifreaks/client.rb', line 934

def phone_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::PhoneValidateRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/phone/validation",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::PhoneValidateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#readability_score(request_options: {}, **params) ⇒ Apifreaks::Types::ReadabilityScoreResponse

Analyze text readability using industry-standard formulas including Flesch Reading Ease, Flesch-Kincaid Grade Level, Gunning Fog Index, SMOG Index, Coleman-Liau Index, and Automated Readability Index.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
# File 'lib/apifreaks/client.rb', line 5213

def readability_score(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::ReadabilityScoreRequest.new(params).to_h
  non_body_param_names = %w[apiKey target exclude]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["target"] = params[:target] if params.key?(:target)
  query_params["exclude"] = params[:exclude] if params.key?(:exclude)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/readability/score",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ReadabilityScoreResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#screenshot_capture(request_options: {}, **params) ⇒ untyped

Capture full-page screenshots and videos of websites with advanced options like device simulation, custom code injection, cookie banner blocking, and scrollable content recording. Supports multiple output formats including JSON, image, GIF, MP4, and WebM.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :output (Apifreaks::Types::ScreenshotCaptureRequestOutput, nil)
  • :file_type (Apifreaks::Types::ScreenshotCaptureRequestFileType, nil)
  • :url (String)
  • :width (Integer, nil)
  • :height (Integer, nil)
  • :full_page (Boolean, nil)
  • :fresh (Boolean, nil)
  • :no_cookie_banners (Boolean, nil)
  • :enable_caching (Boolean, nil)
  • :block_ads (Boolean, nil)
  • :block_chat_widgets (Boolean, nil)
  • :extract_text (Boolean, nil)
  • :extract_html (Boolean, nil)
  • :destroy_screenshot (Boolean, nil)
  • :lazy_load (Boolean, nil)
  • :retina (Boolean, nil)
  • :dark_mode (Boolean, nil)
  • :block_tracking (Boolean, nil)
  • :enable_incognito (Boolean, nil)
  • :omit_background (Boolean, nil)
  • :thumbnail_width (Integer, nil)
  • :adjust_top (Integer, nil)
  • :wait_for_event (Apifreaks::Types::ScreenshotCaptureRequestWaitForEvent, nil)
  • :grayscale (Integer, nil)
  • :delay (Integer, nil)
  • :timeout (Integer, nil)
  • :ttl (Integer, nil)
  • :clip_x (Integer, nil)
  • :clip_y (Integer, nil)
  • :clip_width (Integer, nil)
  • :clip_height (Integer, nil)
  • :css_url (String, nil)
  • :css (String, nil)
  • :js_url (String, nil)
  • :js (String, nil)
  • :block_js (Boolean, nil)
  • :block_stylesheets (Boolean, nil)
  • :block_images (Boolean, nil)
  • :block_media (Boolean, nil)
  • :block_font (Boolean, nil)
  • :block_text_track (Boolean, nil)
  • :block_xhr (Boolean, nil)
  • :block_fetch (Boolean, nil)
  • :block_event_source (Boolean, nil)
  • :block_web_socket (Boolean, nil)
  • :block_manifest (Boolean, nil)
  • :block_specific_requests (String, nil)
  • :blur_selector (String, nil)
  • :remove_selector (String, nil)
  • :result_file_name (String, nil)
  • :scrolling_screenshot (Boolean, nil)
  • :scroll_speed (Apifreaks::Types::ScreenshotCaptureRequestScrollSpeed, nil)
  • :scroll_back (Boolean, nil)
  • :start_immediately (Boolean, nil)
  • :multiple_scrolling (Boolean, nil)
  • :sizes (String, nil)
  • :duration (Integer, nil)
  • :fail_on_error (Boolean, nil)
  • :longitude (Integer, nil)
  • :latitude (Integer, nil)
  • :proxy (String, nil)
  • :headers (String, nil)
  • :cookies (String, nil)
  • :scroll_to_element (String, nil)
  • :selector (String, nil)
  • :user_agent (String, nil)
  • :accept_languages (String, nil)
  • :custom_html (String, nil)
  • :image_quality (Integer, nil)

Returns:

  • (untyped)

Raises:

  • (error_class)


2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
# File 'lib/apifreaks/client.rb', line 2447

def screenshot_capture(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["output"] = params[:output] if params.key?(:output)
  query_params["file_type"] = params[:file_type] if params.key?(:file_type)
  query_params["url"] = params[:url] if params.key?(:url)
  query_params["width"] = params[:width] if params.key?(:width)
  query_params["height"] = params[:height] if params.key?(:height)
  query_params["full_page"] = params[:full_page] if params.key?(:full_page)
  query_params["fresh"] = params[:fresh] if params.key?(:fresh)
  query_params["no_cookie_banners"] = params[:no_cookie_banners] if params.key?(:no_cookie_banners)
  query_params["enable_caching"] = params[:enable_caching] if params.key?(:enable_caching)
  query_params["block_ads"] = params[:block_ads] if params.key?(:block_ads)
  query_params["block_chat_widgets"] = params[:block_chat_widgets] if params.key?(:block_chat_widgets)
  query_params["extract_text"] = params[:extract_text] if params.key?(:extract_text)
  query_params["extract_html"] = params[:extract_html] if params.key?(:extract_html)
  query_params["destroy_screenshot"] = params[:destroy_screenshot] if params.key?(:destroy_screenshot)
  query_params["lazy_load"] = params[:lazy_load] if params.key?(:lazy_load)
  query_params["retina"] = params[:retina] if params.key?(:retina)
  query_params["dark_mode"] = params[:dark_mode] if params.key?(:dark_mode)
  query_params["block_tracking"] = params[:block_tracking] if params.key?(:block_tracking)
  query_params["enable_incognito"] = params[:enable_incognito] if params.key?(:enable_incognito)
  query_params["omit_background"] = params[:omit_background] if params.key?(:omit_background)
  query_params["thumbnail_width"] = params[:thumbnail_width] if params.key?(:thumbnail_width)
  query_params["adjust_top"] = params[:adjust_top] if params.key?(:adjust_top)
  query_params["wait_for_event"] = params[:wait_for_event] if params.key?(:wait_for_event)
  query_params["grayscale"] = params[:grayscale] if params.key?(:grayscale)
  query_params["delay"] = params[:delay] if params.key?(:delay)
  query_params["timeout"] = params[:timeout] if params.key?(:timeout)
  query_params["ttl"] = params[:ttl] if params.key?(:ttl)
  query_params["clip[x]"] = params[:clip_x] if params.key?(:clip_x)
  query_params["clip[y]"] = params[:clip_y] if params.key?(:clip_y)
  query_params["clip[width]"] = params[:clip_width] if params.key?(:clip_width)
  query_params["clip[height]"] = params[:clip_height] if params.key?(:clip_height)
  query_params["css_url"] = params[:css_url] if params.key?(:css_url)
  query_params["css"] = params[:css] if params.key?(:css)
  query_params["js_url"] = params[:js_url] if params.key?(:js_url)
  query_params["js"] = params[:js] if params.key?(:js)
  query_params["block_js"] = params[:block_js] if params.key?(:block_js)
  query_params["block_stylesheets"] = params[:block_stylesheets] if params.key?(:block_stylesheets)
  query_params["block_images"] = params[:block_images] if params.key?(:block_images)
  query_params["block_media"] = params[:block_media] if params.key?(:block_media)
  query_params["block_font"] = params[:block_font] if params.key?(:block_font)
  query_params["block_text_track"] = params[:block_text_track] if params.key?(:block_text_track)
  query_params["block_xhr"] = params[:block_xhr] if params.key?(:block_xhr)
  query_params["block_fetch"] = params[:block_fetch] if params.key?(:block_fetch)
  query_params["block_event_source"] = params[:block_event_source] if params.key?(:block_event_source)
  query_params["block_web_socket"] = params[:block_web_socket] if params.key?(:block_web_socket)
  query_params["block_manifest"] = params[:block_manifest] if params.key?(:block_manifest)
  query_params["block_specific_requests"] = params[:block_specific_requests] if params.key?(:block_specific_requests)
  query_params["blur_selector"] = params[:blur_selector] if params.key?(:blur_selector)
  query_params["remove_selector"] = params[:remove_selector] if params.key?(:remove_selector)
  query_params["result_file_name"] = params[:result_file_name] if params.key?(:result_file_name)
  query_params["scrolling_screenshot"] = params[:scrolling_screenshot] if params.key?(:scrolling_screenshot)
  query_params["scroll_speed"] = params[:scroll_speed] if params.key?(:scroll_speed)
  query_params["scroll_back"] = params[:scroll_back] if params.key?(:scroll_back)
  query_params["start_immediately"] = params[:start_immediately] if params.key?(:start_immediately)
  query_params["multiple_scrolling"] = params[:multiple_scrolling] if params.key?(:multiple_scrolling)
  query_params["sizes"] = params[:sizes] if params.key?(:sizes)
  query_params["duration"] = params[:duration] if params.key?(:duration)
  query_params["fail_on_error"] = params[:fail_on_error] if params.key?(:fail_on_error)
  query_params["longitude"] = params[:longitude] if params.key?(:longitude)
  query_params["latitude"] = params[:latitude] if params.key?(:latitude)
  query_params["proxy"] = params[:proxy] if params.key?(:proxy)
  query_params["headers"] = params[:headers] if params.key?(:headers)
  query_params["cookies"] = params[:cookies] if params.key?(:cookies)
  query_params["scroll_to_element"] = params[:scroll_to_element] if params.key?(:scroll_to_element)
  query_params["selector"] = params[:selector] if params.key?(:selector)
  query_params["user_agent"] = params[:user_agent] if params.key?(:user_agent)
  query_params["accept_languages"] = params[:accept_languages] if params.key?(:accept_languages)
  query_params["custom_html"] = params[:custom_html] if params.key?(:custom_html)
  query_params["image_quality"] = params[:image_quality] if params.key?(:image_quality)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/screenshot",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#subdomains_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::SubdomainsLookupResponse

The Subdomain Lookup API is designed to retrieve subdomains related to the given domain name. It helps you explore subdomains that are available for registration or usage.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
# File 'lib/apifreaks/client.rb', line 1259

def subdomains_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["domain"] = params[:domain] if params.key?(:domain)
  query_params["after"] = params[:after] if params.key?(:after)
  query_params["before"] = params[:before] if params.key?(:before)
  query_params["status"] = params[:status] if params.key?(:status)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/subdomains/lookup",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::SubdomainsLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#swift_code_find(request_options: {}, **params) ⇒ Array[String]

Fetches SWIFT codes for a given country, bank, and city.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

  • (Array[String])

Raises:

  • (error_class)


3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
# File 'lib/apifreaks/client.rb', line 3534

def swift_code_find(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["bank"] = params[:bank] if params.key?(:bank)
  query_params["city"] = params[:city] if params.key?(:city)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/swift-code/finder",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#swift_code_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::SwiftCodeLookupResponse

Fetches detailed information about a SWIFT code.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
# File 'lib/apifreaks/client.rb', line 3576

def swift_code_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["swiftCode"] = params[:swift_code] if params.key?(:swift_code)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/swift-code/lookup",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::SwiftCodeLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#timezone_convert(request_options: {}, **params) ⇒ Apifreaks::Types::TimezoneConvertResponse

Converts a given time from one timezone to another using various input types like timezone name, coordinates, location, or codes.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)
  • :format (Apifreaks::Types::TimezoneConvertRequestFormat, nil)
  • :time (String, nil)
  • :tz_from (String, nil)
  • :tz_to (String, nil)
  • :lat_from (Integer, nil)
  • :long_from (Integer, nil)
  • :lat_to (Integer, nil)
  • :long_to (Integer, nil)
  • :location_from (String, nil)
  • :location_to (String, nil)
  • :iata_from (String, nil)
  • :iata_to (String, nil)
  • :icao_from (String, nil)
  • :icao_to (String, nil)
  • :locode_from (String, nil)
  • :locode_to (String, nil)

Returns:



4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
# File 'lib/apifreaks/client.rb', line 4877

def timezone_convert(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["time"] = params[:time] if params.key?(:time)
  query_params["tz_from"] = params[:tz_from] if params.key?(:tz_from)
  query_params["tz_to"] = params[:tz_to] if params.key?(:tz_to)
  query_params["lat_from"] = params[:lat_from] if params.key?(:lat_from)
  query_params["long_from"] = params[:long_from] if params.key?(:long_from)
  query_params["lat_to"] = params[:lat_to] if params.key?(:lat_to)
  query_params["long_to"] = params[:long_to] if params.key?(:long_to)
  query_params["location_from"] = params[:location_from] if params.key?(:location_from)
  query_params["location_to"] = params[:location_to] if params.key?(:location_to)
  query_params["iata_from"] = params[:iata_from] if params.key?(:iata_from)
  query_params["iata_to"] = params[:iata_to] if params.key?(:iata_to)
  query_params["icao_from"] = params[:icao_from] if params.key?(:icao_from)
  query_params["icao_to"] = params[:icao_to] if params.key?(:icao_to)
  query_params["locode_from"] = params[:locode_from] if params.key?(:locode_from)
  query_params["locode_to"] = params[:locode_to] if params.key?(:locode_to)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/timezone/converter",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::TimezoneConvertResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#timezone_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::TimezoneLookupResponse

Retrieve current time, date, and timezone-related information by specifying a timezone name, location address, location coordinates, IP address, or use the client IP address if no parameter is passed.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
# File 'lib/apifreaks/client.rb', line 4812

def timezone_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["tz"] = params[:tz] if params.key?(:tz)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["lang"] = params[:lang] if params.key?(:lang)
  query_params["iata_code"] = params[:iata_code] if params.key?(:iata_code)
  query_params["icao_code"] = params[:icao_code] if params.key?(:icao_code)
  query_params["lo_code"] = params[:lo_code] if params.key?(:lo_code)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/geolocation/timezone",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::TimezoneLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#user_agent_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::UserAgentLookupResponse

Parse User Agent string to get detailed browser, device, and operating system information

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
# File 'lib/apifreaks/client.rb', line 4932

def user_agent_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/user-agent/lookup",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::UserAgentLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#vat_rate_by_country(request_options: {}, **params) ⇒ Array[Apifreaks::Types::VatRateByCountryResponseItem]

Fetches VAT rates for a single country or state provided via query parameters.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
# File 'lib/apifreaks/client.rb', line 3359

def vat_rate_by_country(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["state"] = params[:state] if params.key?(:state)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/vat/rates/country",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#vat_rate_by_ip(request_options: {}, **params) ⇒ Array[Apifreaks::Types::VatRateByIPResponseItem]

Fetches VAT rate based on the specified or originating IP address.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
# File 'lib/apifreaks/client.rb', line 3318

def vat_rate_by_ip(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["ipAddress"] = params[:ip_address] if params.key?(:ip_address)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/vat/rates/ip-address",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#vat_supported_countries(request_options: {}, **params) ⇒ Apifreaks::Types::VatSupportedCountriesResponse

Retrieves a list of supported countries.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
# File 'lib/apifreaks/client.rb', line 3276

def vat_supported_countries(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["type"] = params[:type] if params.key?(:type)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/vat/supported-countries",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::VatSupportedCountriesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#vat_validate(request_options: {}, **params) ⇒ Apifreaks::Types::VatValidateResponse

Validates an EU or UK VAT number and returns registration status details.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
# File 'lib/apifreaks/client.rb', line 3447

def vat_validate(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["vatNumber"] = params[:vat_number] if params.key?(:vat_number)
  query_params["requesterVatNumber"] = params[:requester_vat_number] if params.key?(:requester_vat_number)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/vat/validation",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::VatValidateResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#weak_words_detect(request_options: {}, **params) ⇒ Apifreaks::Types::WeakWordsDetectResponse

Analyze text and return weak, vague, or filler words with zero-based word positions to help writers produce clearer and more concise content.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :api_key (String)

Returns:



5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
# File 'lib/apifreaks/client.rb', line 5167

def weak_words_detect(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::WeakWordsDetectRequest.new(params).to_h
  non_body_param_names = %w[apiKey]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/readability/weak-words",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::WeakWordsDetectResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#weather_forecast(request_options: {}, **params) ⇒ Apifreaks::Types::WeatherForecastResponse

Access comprehensive weather forecasts with customizable precision - choose from daily overviews, hourly breakdowns, or even minute-by-minute data. Configure your date ranges or use the default 7-day forecast for standard weather planning.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
# File 'lib/apifreaks/client.rb', line 4047

def weather_forecast(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["forecastDays"] = params[:forecast_days] if params.key?(:forecast_days)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/forecast",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::WeatherForecastResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#weather_time_series(request_options: {}, **params) ⇒ Apifreaks::Types::WeatherTimeSeriesResponse

Pull historical weather information for date ranges up to 90 days (daily data) or 7 days (hourly data). Get consistent formatting across your specified date range with reliable historical weather patterns.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
# File 'lib/apifreaks/client.rb', line 4160

def weather_time_series(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["startDate"] = params[:start_date] if params.key?(:start_date)
  query_params["endDate"] = params[:end_date] if params.key?(:end_date)
  query_params["location"] = params[:location] if params.key?(:location)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["ip"] = params[:ip] if params.key?(:ip)
  query_params["precision"] = params[:precision] if params.key?(:precision)
  query_params["timezone"] = params[:timezone] if params.key?(:timezone)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/weather/time-series",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::WeatherTimeSeriesResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#web_scrape(request_options: {}, **params) ⇒ Apifreaks::Types::WebScrapeResponse

Execute a series of web scraping instructions on a target URL. Supports various operations like form filling, clicking, data extraction, and CAPTCHA solving.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/apifreaks/client.rb', line 792

def web_scrape(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[api_key format url text js_enabled proxy ssl_ignore window_size ad_block captcha]
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["url"] = params[:url] if params.key?(:url)
  query_params["text"] = params[:text] if params.key?(:text)
  query_params["jsEnabled"] = params[:js_enabled] if params.key?(:js_enabled)
  query_params["proxy"] = params[:proxy] if params.key?(:proxy)
  query_params["sslIgnore"] = params[:ssl_ignore] if params.key?(:ssl_ignore)
  query_params["windowSize"] = params[:window_size] if params.key?(:window_size)
  query_params["adBlock"] = params[:ad_block] if params.key?(:ad_block)
  query_params["captcha"] = params[:captcha] if params.key?(:captcha)
  params = params.except(*query_param_names)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/scraping",
    query: query_params,
    body: Apifreaks::Types::WebScrapeRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::WebScrapeResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_distance(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeDistanceResponse

Get distance between postal codes. Maximum ‘100` postal codes per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
# File 'lib/apifreaks/client.rb', line 3846

def zipcode_distance(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::ZipcodeDistanceRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/zipcode/distance",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeDistanceResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_distance_match(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeDistanceMatchResponse

Get matching ZIP/postal code pairs within a specified distance. Maximum ‘100` postal codes per request.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
# File 'lib/apifreaks/client.rb', line 3891

def zipcode_distance_match(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  request_data = Apifreaks::Types::ZipcodeDistanceMatchRequest.new(params).to_h
  non_body_param_names = %w[apiKey format]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v1.0/zipcode/distance/match",
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeDistanceMatchResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_lookup(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeLookupResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
# File 'lib/apifreaks/client.rb', line 3617

def zipcode_lookup(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["code"] = params[:code] if params.key?(:code)
  query_params["country"] = params[:country] if params.key?(:country)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/zipcode/lookup",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeLookupResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_search_by_city(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeSearchByCityResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
# File 'lib/apifreaks/client.rb', line 3706

def zipcode_search_by_city(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["city"] = params[:city] if params.key?(:city)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["state_name"] = params[:state_name] if params.key?(:state_name)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/zipcode/search/city",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeSearchByCityResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_search_by_radius(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeSearchByRadiusResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
# File 'lib/apifreaks/client.rb', line 3799

def zipcode_search_by_radius(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["code"] = params[:code] if params.key?(:code)
  query_params["lat"] = params[:lat] if params.key?(:lat)
  query_params["long"] = params[:long] if params.key?(:long)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["radius"] = params[:radius] if params.key?(:radius)
  query_params["unit"] = params[:unit] if params.key?(:unit)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/zipcode/search/radius",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeSearchByRadiusResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#zipcode_search_by_region(request_options: {}, **params) ⇒ Apifreaks::Types::ZipcodeSearchByRegionResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
# File 'lib/apifreaks/client.rb', line 3751

def zipcode_search_by_region(request_options: {}, **params)
  params = Apifreaks::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["apiKey"] = params[:api_key] if params.key?(:api_key)
  query_params["format"] = params[:format] if params.key?(:format)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["region"] = params[:region] if params.key?(:region)
  query_params["page"] = params[:page] if params.key?(:page)

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/zipcode/search/region",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @raw_client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Apifreaks::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Apifreaks::Types::ZipcodeSearchByRegionResponse.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end