Class: Gotenberg::PdfEngines

Inherits:
Object
  • Object
show all
Includes:
Files, Headers, Metadata, Properties, Tools
Defined in:
lib/gotenberg/pdf_engines.rb,
lib/gotenberg/pdf_engines/tools.rb,
lib/gotenberg/pdf_engines/properties.rb

Defined Under Namespace

Modules: Properties, Tools

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Properties

#pdf_format

Methods included from Headers

#client_extra_http_headers, #trace, #webhook, #webhook_error_method, #webhook_extra_http_headers, #webhook_method

Methods included from Metadata

#meta

Methods included from Tools

#convert, #merge

Constructor Details

#initialize(args) {|_self| ... } ⇒ PdfEngines

Returns a new instance of PdfEngines.

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
24
25
26
# File 'lib/gotenberg/pdf_engines.rb', line 20

def initialize args
  args.each do |key, value|
    public_send(('%s=' % key), value)
  end

  yield self if block_given?
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



13
14
15
# File 'lib/gotenberg/pdf_engines.rb', line 13

def base_path
  @base_path
end

#client_headersObject

Returns the value of attribute client_headers.



13
14
15
# File 'lib/gotenberg/pdf_engines.rb', line 13

def client_headers
  @client_headers
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



14
15
16
# File 'lib/gotenberg/pdf_engines.rb', line 14

def endpoint
  @endpoint
end

#exceptionObject (readonly)

Returns the value of attribute exception.



14
15
16
# File 'lib/gotenberg/pdf_engines.rb', line 14

def exception
  @exception
end

#responseObject (readonly)

Returns the value of attribute response.



14
15
16
# File 'lib/gotenberg/pdf_engines.rb', line 14

def response
  @response
end

Class Method Details

.call(base_path, headers: {}, &block) ⇒ Object



16
17
18
# File 'lib/gotenberg/pdf_engines.rb', line 16

def self.call(base_path, headers: {}, &block)
  new(base_path: base_path, client_headers: headers, &block).call
end

Instance Method Details

#callObject



28
29
30
31
32
# File 'lib/gotenberg/pdf_engines.rb', line 28

def call
  transform

  self
end

#success?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/gotenberg/pdf_engines.rb', line 34

def success?
  exception == nil
end

#to_binaryObject



38
39
40
# File 'lib/gotenberg/pdf_engines.rb', line 38

def to_binary
  response || raise(exception)
end