Sha256: cb541f42a59621e0bf93df0e07b5a16322623fb5c11cada04ab94306d78d7390

Contents?: true

Size: 1.6 KB

Versions: 10

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

module Crowdin
  module ApiResources
    module Languages
      def list_languages(query = {})
        request = Web::Request.new(
          connection,
          :get,
          "#{config.target_api_url}/languages",
          { params: query }
        )
        Web::SendRequest.new(request).perform
      end

      def add_custom_language(query = {})
        request = Web::Request.new(
          connection,
          :post,
          "#{config.target_api_url}/languages",
          { params: query }
        )
        Web::SendRequest.new(request).perform
      end

      def get_language(language_id = nil)
        language_id || raise_parameter_is_required_error(:language_id)

        request = Web::Request.new(
          connection,
          :get,
          "#{config.target_api_url}/languages/#{language_id}"
        )
        Web::SendRequest.new(request).perform
      end

      def delete_custom_language(language_id = nil)
        language_id || raise_parameter_is_required_error(:language_id)

        request = Web::Request.new(
          connection,
          :delete,
          "#{config.target_api_url}/languages/#{language_id}"
        )
        Web::SendRequest.new(request).perform
      end

      def edit_custom_language(language_id = nil, query = {})
        language_id || raise_parameter_is_required_error(:language_id)

        request = Web::Request.new(
          connection,
          :patch,
          "#{config.target_api_url}/languages/#{language_id}",
          { params: query }
        )
        Web::SendRequest.new(request).perform
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
crowdin-api-1.12.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.10.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.9.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.8.1 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.8.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.7.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.6.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.5.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.4.0 lib/crowdin-api/api_resources/languages.rb
crowdin-api-1.3.0 lib/crowdin-api/api_resources/languages.rb