class DeepL::Configuration

Constants

ATTRIBUTES

Public Class Methods

new(data = {}) click to toggle source
# File lib/deepl/configuration.rb, line 9
def initialize(data = {})
  data.each { |key, value| send("#{key}=", value) }
  @auth_key ||= ENV['DEEPL_AUTH_KEY']
  @host ||= 'https://api.deepl.com'
  @version ||= 'v2'
end

Public Instance Methods

==(other) click to toggle source
# File lib/deepl/configuration.rb, line 24
def ==(other)
  attributes == other.attributes
end
attributes() click to toggle source
# File lib/deepl/configuration.rb, line 20
def attributes
  ATTRIBUTES.map { |attr| [attr, send(attr)] }.to_h
end
validate!() click to toggle source
# File lib/deepl/configuration.rb, line 16
def validate!
  raise Exceptions::Error, 'auth_key not provided' if auth_key.nil? || auth_key.empty?
end