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


229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/selectpdf.rb', line 229

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


202
203
204
# File 'lib/selectpdf.rb', line 202

def api_async_endpoint
  @api_async_endpoint
end

#api_endpointObject

API endpoint


196
197
198
# File 'lib/selectpdf.rb', line 196

def api_endpoint
  @api_endpoint
end

#api_web_elements_endpointObject

API web elements endpoint


208
209
210
# File 'lib/selectpdf.rb', line 208

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.


220
221
222
# File 'lib/selectpdf.rb', line 220

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.


214
215
216
# File 'lib/selectpdf.rb', line 214

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.


226
227
228
# File 'lib/selectpdf.rb', line 226

def number_of_pages
  @number_of_pages
end