Module: Tags4Free
- Includes:
- HTTParty
- Defined in:
- lib/tags_4_free.rb
Defined Under Namespace
Classes: YahooApiError, YahooApiFormatError
Constant Summary collapse
- VERSION =
'0.1.1'- APPID =
'aPANO7nV34GzXKjOP9KBz8CEyH8UZp5we3NIY.305xTlOT2Pc0f.9BBLFdsTEw--'- SERVICE_URL =
'http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction'
Class Method Summary collapse
-
.for(content) ⇒ Object
Generate tags for a string.
Class Method Details
.for(content) ⇒ Object
Generate tags for a string
tags = Tags4Free.for(‘The content that should be tagged’)
25 26 27 28 29 30 31 32 |
# File 'lib/tags_4_free.rb', line 25 def self.for(content) result_set = get(SERVICE_URL, :query => {:appid => APPID, :context => content}) raise YahooApiError.new(result_set['Error']['Message']) if result_set['Error'] raise YahooApiFormatError.new(content, result_set) unless result_set['ResultSet'] result_set['ResultSet']['Result'] || [] end |