Class: Sentiment::Client
- Inherits:
-
Object
- Object
- Sentiment::Client
- Includes:
- HTTParty
- Defined in:
- lib/sentiment/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(api_key = nil) ⇒ Client
constructor
Get a free api_key @ developer.apphera.com.
- #sentiment(body, lang) ⇒ Object
Constructor Details
#initialize(api_key = nil) ⇒ Client
Get a free api_key @ developer.apphera.com
12 13 14 15 16 |
# File 'lib/sentiment/client.rb', line 12 def initialize(api_key=nil) @api_key = api_key @api_key ||= Sentiment.api_key @api_path = '' end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/sentiment/client.rb', line 9 def api_key @api_key end |
Instance Method Details
#sentiment(body, lang) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/sentiment/client.rb', line 18 def sentiment(body, lang) = {:body => {:body => body, :lang => lang}, :query => self.} results = Mash.new(self.class.post('/sentiments', )) sentiment = results.response.polarity end |