Class: SelectPdf::ApiClient

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

Overview

Base class for API clients. Do not use this directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApiClient

Class constructor



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

def initialize
  # API endpoint
  @api_endpoint = 'https://selectpdf.com/api2/convert/'

  # API async jobs endpoint
  @api_async_endpoint = 'https://selectpdf.com/api2/asyncjob/'

  # API web elements endpoint
  @api_web_elements_endpoint = 'https://selectpdf.com/api2/webelements/'

  # Parameters that will be sent to the API.
  @parameters = {}

  # HTTP Headers that will be sent to the API.
  @headers = {}

  # Files that will be sent to the API.
  @files = {}

  # Binary data that will be sent to the API.
  @binary_data = {}

  # Number of pages of the pdf document resulted from the conversion.
  @number_of_pages = 0

  # Job ID for asynchronous calls or for calls that require a second request.
  @job_id = ''

  # Ping interval in seconds for asynchronous calls. Default value is 3 seconds.
  @async_calls_ping_interval = 3

  # Maximum number of pings for asynchronous calls. Default value is 1,000 pings.
  @async_calls_max_pings = 1000
end

Instance Attribute Details

#api_async_endpointObject

API async jobs endpoint



46
47
48
# File 'lib/selectpdf.rb', line 46

def api_async_endpoint
  @api_async_endpoint
end

#api_endpointObject

API endpoint



40
41
42
# File 'lib/selectpdf.rb', line 40

def api_endpoint
  @api_endpoint
end

#api_web_elements_endpointObject

API web elements endpoint



52
53
54
# File 'lib/selectpdf.rb', line 52

def api_web_elements_endpoint
  @api_web_elements_endpoint
end

#async_calls_max_pingsObject

Maximum number of pings for asynchronous calls. Default value is 1,000 pings.



64
65
66
# File 'lib/selectpdf.rb', line 64

def async_calls_max_pings
  @async_calls_max_pings
end

#async_calls_ping_intervalObject

Ping interval in seconds for asynchronous calls. Default value is 3 seconds.



58
59
60
# File 'lib/selectpdf.rb', line 58

def async_calls_ping_interval
  @async_calls_ping_interval
end

#number_of_pagesObject (readonly)

Number of pages of the pdf document resulted from the conversion.



70
71
72
# File 'lib/selectpdf.rb', line 70

def number_of_pages
  @number_of_pages
end