Class: FunTranslations::Client
- Inherits:
-
Object
- Object
- FunTranslations::Client
- Includes:
- Request
- Defined in:
- lib/fun_translations/client.rb
Overview
FunTranslations API client
Constant Summary
Constants included from Connection
FunTranslations::Connection::BASE_URL
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token = nil) ⇒ Client
constructor
A new instance of Client.
-
#translate(endpoint, text, params = {}) ⇒ FunTranslations::Translation
Performs translation.
Methods included from Request
Methods included from Connection
Constructor Details
#initialize(token = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/fun_translations/client.rb', line 10 def initialize(token = nil) @token = token end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/fun_translations/client.rb', line 8 def token @token end |
Instance Method Details
#translate(endpoint, text, params = {}) ⇒ FunTranslations::Translation
Performs translation
19 20 21 22 23 24 25 26 27 |
# File 'lib/fun_translations/client.rb', line 19 def translate(endpoint, text, params = {}) FunTranslations::Translation.new( post( "/translate/#{endpoint}.json", self, {text: text}.merge(params) ) ) end |