Sha256: ca10e6a4822b496a6d6f08a8fef6a1b9586e4e452d4a10d21ef7f5af3218ab50

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

module FunTranslations
  # FunTranslations API client
  class Client
    include FunTranslations::Request

    attr_accessor :token

    def initialize(token = nil)
      @token = token
    end

    # Performs translation
    # @return [FunTranslations::Translation]
    # @param endpoint [String, Symbol]
    # @param text [String]
    # @param params [Hash]
    def translate(endpoint, text, params = {})
      FunTranslations::Translation.new(
        post(
          "/translate/#{endpoint}.json",
          self,
          {text: text}.merge(params)
        )
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fun_translations-0.0.1 lib/fun_translations/client.rb
fun_translations-0.0.1.rc1 lib/fun_translations/client.rb