Sha256: 77ed876985cea379ab69e6c486f5a0e38434e97ad3c9ac8fded89706040f90c7
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# -- Dependencies require 'json' require 'net/http' # -- Exceptions require 'deepl/exceptions/error' require 'deepl/exceptions/request_error' require 'deepl/exceptions/authorization_failed' require 'deepl/exceptions/bad_request' require 'deepl/exceptions/limit_exceeded' # -- Requests require 'deepl/requests/base' require 'deepl/requests/translate' require 'deepl/requests/usage' # -- Responses and resources require 'deepl/resources/base' require 'deepl/resources/text' require 'deepl/resources/usage' # -- Other wrappers require 'deepl/api' require 'deepl/configuration' # -- Gem interface module DeepL extend self ## -- API shortcuts def api @api ||= API.new(configuration) end def translate(text, source_lang, target_lang, options = {}) configure if @configuration.nil? Requests::Translate.new(api, text, source_lang, target_lang, options).request end def usage(options = {}) configure if @configuration.nil? Requests::Usage.new(api, options).request end # -- Configuration def configuration @configuration ||= Configuration.new end def configure yield configuration if block_given? configuration.validate! end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
deepl-rb-2.2.0 | lib/deepl.rb |
deepl-rb-2.1.0 | lib/deepl.rb |
deepl-rb-2.0.0 | lib/deepl.rb |