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)


5650
5651
5652
5653
5654
5655
5656
5657
5658
# File 'lib/apifreaks/client.rb', line 5650

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:



4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
# File 'lib/apifreaks/client.rb', line 4492

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:



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 651

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:



5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
# File 'lib/apifreaks/client.rb', line 5553

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

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

Retrieve sunrise and sunset times, current position of the moon, and other related information (v2.0) 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:



5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
# File 'lib/apifreaks/client.rb', line 5611

def astronomy_lookup_v2(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: "v2.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:



4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
# File 'lib/apifreaks/client.rb', line 4205

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:



1362
1363
1364
1365
1366
1367
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 1362

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:



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

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:



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/apifreaks/client.rb', line 518

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_domain_whois_lookup_v2(request_options: {}, **params) ⇒ Apifreaks::Types::BulkDomainWhoisLookupResponse

Retrieve WHOIS information for 100 Domains per Request (v2.0).

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:



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/apifreaks/client.rb', line 563

def bulk_domain_whois_lookup_v2(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: "v2.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:



1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/apifreaks/client.rb', line 1088

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:



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

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_geolocation_lookup_v2(request_options: {}, **params) ⇒ Array[Apifreaks::Types::BulkGeolocationLookupResponseItem]

Retrieve detailed geolocation data for multiple IP addresses in a single request (v2.0). 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:



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
206
207
208
209
210
211
212
213
# File 'lib/apifreaks/client.rb', line 179

def bulk_geolocation_lookup_v2(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: "v2.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:



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

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:



1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
# File 'lib/apifreaks/client.rb', line 1180

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:



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
2791
2792
2793
2794
2795
# File 'lib/apifreaks/client.rb', line 2765

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:



5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
# File 'lib/apifreaks/client.rb', line 5255

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:



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

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:



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
3899
3900
3901
3902
3903
3904
# File 'lib/apifreaks/client.rb', line 3874

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:



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

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:



3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
# File 'lib/apifreaks/client.rb', line 3310

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:



3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
# File 'lib/apifreaks/client.rb', line 3265

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:



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

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:



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

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:



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

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:



2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
# File 'lib/apifreaks/client.rb', line 2954

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:



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
2935
# File 'lib/apifreaks/client.rb', line 2906

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:



3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
# File 'lib/apifreaks/client.rb', line 3050

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:



3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
# File 'lib/apifreaks/client.rb', line 3222

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:



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
2887
# File 'lib/apifreaks/client.rb', line 2859

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:



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
2839
2840
2841
# File 'lib/apifreaks/client.rb', line 2813

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:



3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
# File 'lib/apifreaks/client.rb', line 3142

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:



3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
# File 'lib/apifreaks/client.rb', line 3182

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:



3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
# File 'lib/apifreaks/client.rb', line 3002

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:



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

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:



1319
1320
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 1319

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:



1413
1414
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
1441
1442
# File 'lib/apifreaks/client.rb', line 1413

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:



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

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:



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

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:



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

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:



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
1301
# File 'lib/apifreaks/client.rb', line 1274

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:



1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
# File 'lib/apifreaks/client.rb', line 1229

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:



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

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:



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/apifreaks/client.rb', line 434

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_lookup_v2(request_options: {}, **params) ⇒ Apifreaks::Types::DomainWhoisLookupResponse

Retrieve live WHOIS information for a single domain name (v2.0), including registration 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:



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/apifreaks/client.rb', line 477

def domain_whois_lookup_v2(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: "v2.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:



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

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:



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
# File 'lib/apifreaks/client.rb', line 1043

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:



4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
# File 'lib/apifreaks/client.rb', line 4550

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:



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/apifreaks/client.rb', line 385

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:



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/apifreaks/client.rb', line 332

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

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

Get detailed geolocation data for an IP address (v2.0) 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:



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

def geolocation_lookup_v2(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: "v2.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:



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

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:



4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
# File 'lib/apifreaks/client.rb', line 4849

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:



4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
# File 'lib/apifreaks/client.rb', line 4805

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:



4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
# File 'lib/apifreaks/client.rb', line 4893

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:



4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
# File 'lib/apifreaks/client.rb', line 4600

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:



4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
# File 'lib/apifreaks/client.rb', line 4641

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)


4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
# File 'lib/apifreaks/client.rb', line 4977

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:



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

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:



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

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:



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

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:



5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
# File 'lib/apifreaks/client.rb', line 5408

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:



5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
# File 'lib/apifreaks/client.rb', line 5364

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:



4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
# File 'lib/apifreaks/client.rb', line 4319

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:



3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
# File 'lib/apifreaks/client.rb', line 3703

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:



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

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:



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/apifreaks/client.rb', line 609

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:



4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
# File 'lib/apifreaks/client.rb', line 4433

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:



5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
# File 'lib/apifreaks/client.rb', line 5315

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:



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

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:



2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
# File 'lib/apifreaks/client.rb', line 2197

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:



2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
# File 'lib/apifreaks/client.rb', line 2247

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:



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
2121
# File 'lib/apifreaks/client.rb', line 2096

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:



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

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:



2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
# File 'lib/apifreaks/client.rb', line 2147

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:



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

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:



2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
# File 'lib/apifreaks/client.rb', line 2543

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)


2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
# File 'lib/apifreaks/client.rb', line 2374

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:



1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
# File 'lib/apifreaks/client.rb', line 1847

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:



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

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:



2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
# File 'lib/apifreaks/client.rb', line 2459

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:



2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
# File 'lib/apifreaks/client.rb', line 2416

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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:



2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
# File 'lib/apifreaks/client.rb', line 2329

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:



2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
# File 'lib/apifreaks/client.rb', line 2288

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:



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/apifreaks/client.rb', line 1134

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:



5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
# File 'lib/apifreaks/client.rb', line 5498

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)


2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
# File 'lib/apifreaks/client.rb', line 2654

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:



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
1489
1490
1491
1492
1493
# File 'lib/apifreaks/client.rb', line 1463

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


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

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:



3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
# File 'lib/apifreaks/client.rb', line 3791

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:



5155
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
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
# File 'lib/apifreaks/client.rb', line 5155

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:



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

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

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

Retrieve current time, date, and timezone-related information (v2.0) 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:



5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
# File 'lib/apifreaks/client.rb', line 5090

def timezone_lookup_v2(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: "v2.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:



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

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:



3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
# File 'lib/apifreaks/client.rb', line 3570

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:



3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
# File 'lib/apifreaks/client.rb', line 3527

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:



3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
# File 'lib/apifreaks/client.rb', line 3485

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:



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

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:



5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
# File 'lib/apifreaks/client.rb', line 5452

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:



4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
# File 'lib/apifreaks/client.rb', line 4262

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:



4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
# File 'lib/apifreaks/client.rb', line 4375

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:



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
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
# File 'lib/apifreaks/client.rb', line 992

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:



4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
# File 'lib/apifreaks/client.rb', line 4061

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:



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

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:



3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
# File 'lib/apifreaks/client.rb', line 3832

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:



3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
# File 'lib/apifreaks/client.rb', line 3921

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:



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
4044
4045
4046
# File 'lib/apifreaks/client.rb', line 4014

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:



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

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