Class: DeepL::API
- Inherits:
-
Object
- Object
- DeepL::API
- Defined in:
- lib/deepl/api.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ API
constructor
A new instance of API.
- #update_http_client(client) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ API
Returns a new instance of API.
10 11 12 13 14 15 16 |
# File 'lib/deepl/api.rb', line 10 def initialize(configuration) @configuration = configuration configuration.validate! uri = URI(configuration.host) @http_client = Net::HTTP.new(uri.host, uri.port) @http_client.use_ssl = uri.scheme == 'https' end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
8 9 10 |
# File 'lib/deepl/api.rb', line 8 def configuration @configuration end |
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
8 9 10 |
# File 'lib/deepl/api.rb', line 8 def http_client @http_client end |
Instance Method Details
#update_http_client(client) ⇒ Object
18 19 20 |
# File 'lib/deepl/api.rb', line 18 def update_http_client(client) @http_client = client end |