Sha256: 6b29ea8580b102d2e9825e9cc42090e4ffd3cce19cebf1df1b76c1e4dd8ef464
Contents?: true
Size: 632 Bytes
Versions: 3
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true module DeepL class Configuration ATTRIBUTES = %i[auth_key host version].freeze attr_accessor(*ATTRIBUTES) def initialize(data = {}) data.each { |key, value| send("#{key}=", value) } @auth_key ||= ENV.fetch('DEEPL_AUTH_KEY', nil) @host ||= 'https://api.deepl.com' @version ||= 'v2' end def validate! raise Exceptions::Error, 'auth_key not provided' if auth_key.nil? || auth_key.empty? end def attributes ATTRIBUTES.to_h { |attr| [attr, send(attr)] } end def ==(other) attributes == other.attributes end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
deepl-rb-2.5.3 | lib/deepl/configuration.rb |
deepl-rb-2.5.2 | lib/deepl/configuration.rb |
deepl-rb-2.5.1 | lib/deepl/configuration.rb |