Sha256: 7e73b8caf2952ad83bf2994eca963bc184be93cccc388500b0dac895bce5adc2

Contents?: true

Size: 638 Bytes

Versions: 5

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

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

      def request
        build_languages(*get)
      end

      private

      def build_languages(request, response)
        data = JSON.parse(response.body)
        data.map do |language|
          Resources::Language.new(language['language'], language['name'],
                                  language['supports_formality'],
                                  request, response)
        end
      end

      def path
        'languages'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deepl-rb-2.5.3 lib/deepl/requests/languages.rb
deepl-rb-2.5.2 lib/deepl/requests/languages.rb
deepl-rb-2.5.1 lib/deepl/requests/languages.rb
deepl-rb-2.5.0 lib/deepl/requests/languages.rb
deepl-rb-2.4.0 lib/deepl/requests/languages.rb