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)


5340
5341
5342
5343
5344
5345
5346
5347
5348
# File 'lib/apifreaks/client.rb', line 5340

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:



4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
# File 'lib/apifreaks/client.rb', line 4299

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:



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'lib/apifreaks/client.rb', line 458

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:



5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
# File 'lib/apifreaks/client.rb', line 5301

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:



4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
# File 'lib/apifreaks/client.rb', line 4012

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:



1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
# File 'lib/apifreaks/client.rb', line 1169

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:



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
671
672
673
674
675
676
677
# File 'lib/apifreaks/client.rb', line 646

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:



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
395
396
397
398
399
400
# File 'lib/apifreaks/client.rb', line 370

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:



895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
# File 'lib/apifreaks/client.rb', line 895

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:



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
107
108
# 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
  if code.between?(200, 299)
    Apifreaks::Types::BulkGeolocationLookupResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



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
202
203
204
205
# File 'lib/apifreaks/client.rb', line 173

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
  if code.between?(200, 299)
    Apifreaks::Types::BulkIPSecurityLookupResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'lib/apifreaks/client.rb', line 987

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
  if code.between?(200, 299)
    Apifreaks::Types::BulkPhoneValidateResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
# File 'lib/apifreaks/client.rb', line 2572

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:



5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
# File 'lib/apifreaks/client.rb', line 5003

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
  if code.between?(200, 299)
    Apifreaks::Types::BulkUserAgentLookupResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
# File 'lib/apifreaks/client.rb', line 3420

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:



3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
# File 'lib/apifreaks/client.rb', line 3681

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:



3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
# File 'lib/apifreaks/client.rb', line 3162

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:



3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
# File 'lib/apifreaks/client.rb', line 3117

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:



3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
# File 'lib/apifreaks/client.rb', line 3072

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:



3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
# File 'lib/apifreaks/client.rb', line 3251

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:



3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
# File 'lib/apifreaks/client.rb', line 3208

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:



2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
# File 'lib/apifreaks/client.rb', line 2905

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:



2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
# File 'lib/apifreaks/client.rb', line 2761

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:



2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
# File 'lib/apifreaks/client.rb', line 2713

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:



2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
# File 'lib/apifreaks/client.rb', line 2857

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:



3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
# File 'lib/apifreaks/client.rb', line 3029

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:



2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
# File 'lib/apifreaks/client.rb', line 2666

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:



2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
# File 'lib/apifreaks/client.rb', line 2620

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:



2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
# File 'lib/apifreaks/client.rb', line 2949

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:



2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
# File 'lib/apifreaks/client.rb', line 2989

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:



2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
# File 'lib/apifreaks/client.rb', line 2809

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:



3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
# File 'lib/apifreaks/client.rb', line 3965

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:



1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
# File 'lib/apifreaks/client.rb', line 1126

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:



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/apifreaks/client.rb', line 1220

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)
  query_params["sug"] = params[:sug] if params.key?(:sug)

  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:



697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# File 'lib/apifreaks/client.rb', line 697

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:



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/apifreaks/client.rb', line 600

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:



746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
# File 'lib/apifreaks/client.rb', line 746

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:



1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
# File 'lib/apifreaks/client.rb', line 1081

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:



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/apifreaks/client.rb', line 1036

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:



501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/apifreaks/client.rb', line 501

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:



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/apifreaks/client.rb', line 329

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:



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
576
577
578
579
580
581
# File 'lib/apifreaks/client.rb', line 549

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:



850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
# File 'lib/apifreaks/client.rb', line 850

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:



4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
# File 'lib/apifreaks/client.rb', line 4357

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:



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
306
307
308
309
310
311
# File 'lib/apifreaks/client.rb', line 280

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:



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
257
258
259
260
261
262
# File 'lib/apifreaks/client.rb', line 227

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
  if code.between?(200, 299)
    Apifreaks::Types::GeocoderSearchResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
# File 'lib/apifreaks/client.rb', line 4568

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:



4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
# File 'lib/apifreaks/client.rb', line 4656

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:



4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
# File 'lib/apifreaks/client.rb', line 4612

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:



4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
# File 'lib/apifreaks/client.rb', line 4700

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:



4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
# File 'lib/apifreaks/client.rb', line 4407

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:



4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
# File 'lib/apifreaks/client.rb', line 4448

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)


4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
# File 'lib/apifreaks/client.rb', line 4784

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
  if code.between?(200, 299)
    response.body
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
# File 'lib/apifreaks/client.rb', line 4487

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:



4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
# File 'lib/apifreaks/client.rb', line 4526

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:



4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
# File 'lib/apifreaks/client.rb', line 4741

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
  if code.between?(200, 299)
    Apifreaks::Types::GetSupportedFlagsResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
# File 'lib/apifreaks/client.rb', line 5156

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:



5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
# File 'lib/apifreaks/client.rb', line 5112

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:



4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
# File 'lib/apifreaks/client.rb', line 4126

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:



3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
# File 'lib/apifreaks/client.rb', line 3510

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:



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
154
155
# File 'lib/apifreaks/client.rb', line 127

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:



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/apifreaks/client.rb', line 416

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:



4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
# File 'lib/apifreaks/client.rb', line 4240

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:



5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
# File 'lib/apifreaks/client.rb', line 5063

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:



1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
# File 'lib/apifreaks/client.rb', line 1510

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:



2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
# File 'lib/apifreaks/client.rb', line 2004

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:



2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
# File 'lib/apifreaks/client.rb', line 2054

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:



1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
# File 'lib/apifreaks/client.rb', line 1903

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:



1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
# File 'lib/apifreaks/client.rb', line 1852

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:



1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
# File 'lib/apifreaks/client.rb', line 1954

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:



1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
# File 'lib/apifreaks/client.rb', line 1701

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:



2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
# File 'lib/apifreaks/client.rb', line 2350

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)


2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
# File 'lib/apifreaks/client.rb', line 2181

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
  if code.between?(200, 299)
    response.body
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
# File 'lib/apifreaks/client.rb', line 1654

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:



1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
# File 'lib/apifreaks/client.rb', line 1558

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:



2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
# File 'lib/apifreaks/client.rb', line 2266

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:



2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
# File 'lib/apifreaks/client.rb', line 2223

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:



1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
# File 'lib/apifreaks/client.rb', line 1605

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:



2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
# File 'lib/apifreaks/client.rb', line 2309

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:



1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
# File 'lib/apifreaks/client.rb', line 1321

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:



1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
# File 'lib/apifreaks/client.rb', line 1368

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:



1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
# File 'lib/apifreaks/client.rb', line 1752

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:



1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
# File 'lib/apifreaks/client.rb', line 1463

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:



1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File 'lib/apifreaks/client.rb', line 1415

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:



1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
# File 'lib/apifreaks/client.rb', line 1802

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:



2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
# File 'lib/apifreaks/client.rb', line 2136

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:



2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
# File 'lib/apifreaks/client.rb', line 2095

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:



941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
# File 'lib/apifreaks/client.rb', line 941

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:



5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
# File 'lib/apifreaks/client.rb', line 5246

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)


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
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
# File 'lib/apifreaks/client.rb', line 2461

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
  if code.between?(200, 299)
    response.body
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# File 'lib/apifreaks/client.rb', line 1270

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])


3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
# File 'lib/apifreaks/client.rb', line 3554

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
  if code.between?(200, 299)
    response.body
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
# File 'lib/apifreaks/client.rb', line 3598

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:



4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
# File 'lib/apifreaks/client.rb', line 4903

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:



4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
# File 'lib/apifreaks/client.rb', line 4838

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:



4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
# File 'lib/apifreaks/client.rb', line 4959

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)

  headers = {}
  headers["User-Agent"] = params[:user_agent] if params[:user_agent]

  request = Apifreaks::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v1.0/user-agent/lookup",
    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::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:



3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
# File 'lib/apifreaks/client.rb', line 3377

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
  if code.between?(200, 299)
    Apifreaks::Types::VatRateByCountryResponseItem.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_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:



3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
# File 'lib/apifreaks/client.rb', line 3334

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
  if code.between?(200, 299)
    Apifreaks::Types::VatRateByIPResponseItem.load(response.body)
  else
    error_class = Apifreaks::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
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:



3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
# File 'lib/apifreaks/client.rb', line 3292

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:



3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
# File 'lib/apifreaks/client.rb', line 3467

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:



5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
# File 'lib/apifreaks/client.rb', line 5200

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:



4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
# File 'lib/apifreaks/client.rb', line 4069

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:



4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
# File 'lib/apifreaks/client.rb', line 4182

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:



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
829
830
831
832
833
834
835
# File 'lib/apifreaks/client.rb', line 799

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:



3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
# File 'lib/apifreaks/client.rb', line 3868

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:



3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
# File 'lib/apifreaks/client.rb', line 3913

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:



3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
# File 'lib/apifreaks/client.rb', line 3639

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:



3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
# File 'lib/apifreaks/client.rb', line 3728

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:



3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
# File 'lib/apifreaks/client.rb', line 3821

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:



3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
# File 'lib/apifreaks/client.rb', line 3773

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