Sha256: 7586210a0a85a019bf01c79cc9bb22a89a840b6bfc6b34963f7fa52f37a3f92c

Contents?: true

Size: 950 Bytes

Versions: 4

Compression:

Stored size: 950 Bytes

Contents

# Copyright 2022 Daniel Herzog
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE.md file.
# frozen_string_literal: true

module DeepL
  module Requests
    module Glossary
      class LanguagePairs < Base
        def initialize(api, options = {})
          super
        end

        def request
          build_language_pair_list(*execute_request_with_retries(get_request))
        end

        def to_s
          "GET #{uri.request_uri}"
        end

        private

        def build_language_pair_list(request, response)
          data = JSON.parse(response.body)
          data['supported_languages'].map do |language_pair|
            Resources::LanguagePair.new(language_pair['source_lang'], language_pair['target_lang'],
                                        request, response)
          end
        end

        def path
          'glossary-language-pairs'
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deepl-rb-3.1.0 lib/deepl/requests/glossary/language_pairs.rb
deepl-rb-3.0.2 lib/deepl/requests/glossary/language_pairs.rb
deepl-rb-3.0.1 lib/deepl/requests/glossary/language_pairs.rb
deepl-rb-3.0.0 lib/deepl/requests/glossary/language_pairs.rb