Class: DeepL::API

Inherits:
Object
  • Object
show all
Defined in:
lib/deepl/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configurationObject (readonly)

Returns the value of attribute configuration.



8
9
10
# File 'lib/deepl/api.rb', line 8

def configuration
  @configuration
end

#http_clientObject (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