Class: OpenAmplify::Client
- Inherits:
-
Object
- Object
- OpenAmplify::Client
- Includes:
- Connection, Request
- Defined in:
- lib/openamplify/client.rb
Overview
Provides access to the OpenAmplify API portaltnx20.openamplify.com/AmplifyWeb_v20/
Basic usage of the library is to call supported methods via the Client class.
text = "After getting the MX1000 laser mouse and the Z-5500 speakers i fell in love with logitech"
OpenAmplify::Client.new.amplify(text)
Instance Method Summary collapse
- #amplify(input, options = {}) ⇒ Object
- #analysis_options ⇒ Object
-
#analyze_text(input) ⇒ Object
deprecated
Deprecated.
Please use #amplify instead
-
#base_url=(url) ⇒ Object
deprecated
Deprecated.
Please use #endpoint instead
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #request_analysis(options) ⇒ Object
Methods included from Request
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
19 20 21 22 23 24 |
# File 'lib/openamplify/client.rb', line 19 def initialize(={}) = OpenAmplify..merge() Configuration::VALID_CONFIG_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#amplify(input, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/openamplify/client.rb', line 26 def amplify(input, ={}) = .merge() Analysis::Context.new(self, input, ) end |
#analysis_options ⇒ Object
31 32 33 |
# File 'lib/openamplify/client.rb', line 31 def Hash[ *Configuration::VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#analyze_text(input) ⇒ Object
Deprecated.
Please use #amplify instead
47 48 49 50 |
# File 'lib/openamplify/client.rb', line 47 def analyze_text(input) warn "[DEPRECATION] `analyze_text` is deprecated. Please use `amplify` instead." amplify input end |
#base_url=(url) ⇒ Object
Deprecated.
Please use #endpoint instead
53 54 55 56 |
# File 'lib/openamplify/client.rb', line 53 def base_url=(url) warn "[DEPRECATION] `base_url` is deprecated. Please use `endpoint` instead." self.endpoint = url end |
#request_analysis(options) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/openamplify/client.rb', line 35 def request_analysis() params = prepare_request_params() case self.method when :post post(self.endpoint, params) else get(self.endpoint, params) end end |