Class: AlchemyAPI::Base
- Inherits:
-
Object
- Object
- AlchemyAPI::Base
- Defined in:
- lib/alchemy-api/base.rb
Direct Known Subclasses
AuthorExtraction, ConceptTagging, EntityExtraction, ImageTagging, KeywordExtraction, LanguageDetection, RelationExtraction, SentimentAnalysis, TargetedSentimentAnalysis, Taxonomy, TextCategorization, TextExtraction, TitleExtraction
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/alchemy-api/base.rb', line 6 def @options end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/alchemy-api/base.rb', line 6 def response @response end |
Instance Method Details
#merged_options(opts) ⇒ Object
27 28 29 |
# File 'lib/alchemy-api/base.rb', line 27 def (opts) opts.merge(Config.) end |
#parsed_response ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/alchemy-api/base.rb', line 16 def parsed_response case Config.output_mode when :json parsed = JSON.parse(@response.body) indexer ? parsed[indexer] : parsed when :xml when :rdf fail NotImplementedError end end |
#search(opts) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/alchemy-api/base.rb', line 8 def search(opts) (opts) @response = connection.post(path, construct_body) parsed_response end |