Sha256: ffeb037a4da450098f7b599f138593334274f5757222ba3ea2145f3d0ce36008
Contents?: true
Size: 621 Bytes
Versions: 2
Compression:
Stored size: 621 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['DEEPL_AUTH_KEY'] @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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deepl-rb-2.5.0 | lib/deepl/configuration.rb |
deepl-rb-2.4.0 | lib/deepl/configuration.rb |