Class: Gotenberg::Client
- Inherits:
-
Object
- Object
- Gotenberg::Client
- Defined in:
- lib/gotenberg/client.rb
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Returns the value of attribute base_path.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #adapter ⇒ Object
- #default_headers ⇒ Object
-
#initialize(base_path, headers: {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(base_path, headers: {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/gotenberg/client.rb', line 8 def initialize base_path, headers: {} @base_path = base_path @headers = headers end |
Instance Attribute Details
#base_path ⇒ Object (readonly)
Returns the value of attribute base_path.
6 7 8 |
# File 'lib/gotenberg/client.rb', line 6 def base_path @base_path end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/gotenberg/client.rb', line 6 def headers @headers end |
Instance Method Details
#adapter ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/gotenberg/client.rb', line 13 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_headers ⇒ Object
22 23 24 |
# File 'lib/gotenberg/client.rb', line 22 def default_headers {'Content-Type' => 'multipart/form-data'}.merge(headers) end |