Class: Gotenberg::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path) ⇒ Client

Returns a new instance of Client.



8
9
10
# File 'lib/gotenberg/client.rb', line 8

def initialize base_path
  @base_path = base_path
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



6
7
8
# File 'lib/gotenberg/client.rb', line 6

def base_path
  @base_path
end

Instance Method Details

#adapterObject



12
13
14
15
16
17
18
19
# File 'lib/gotenberg/client.rb', line 12

def adapter
  @adapter ||= Faraday.new(base_path, headers: default_headers) do |c|
    c.request :multipart
    c.request :url_encoded
    c.adapter :net_http
    c.response :raise_error
  end
end

#default_headersObject



21
22
23
# File 'lib/gotenberg/client.rb', line 21

def default_headers
  {'Content-Type' => 'multipart/form-data'}
end