Module: AlchemyAPI

Defined in:
lib/alchemy_api.rb,
lib/alchemy-api/base.rb,
lib/alchemy-api/config.rb,
lib/alchemy-api/version.rb,
lib/alchemy-api/taxonomy.rb,
lib/alchemy-api/combined_call.rb,
lib/alchemy-api/image_tagging.rb,
lib/alchemy-api/face_detection.rb,
lib/alchemy-api/concept_tagging.rb,
lib/alchemy-api/text_extraction.rb,
lib/alchemy-api/emotion_analysis.rb,
lib/alchemy-api/image_scene_text.rb,
lib/alchemy-api/title_extraction.rb,
lib/alchemy-api/author_extraction.rb,
lib/alchemy-api/entity_extraction.rb,
lib/alchemy-api/keyword_extraction.rb,
lib/alchemy-api/language_detection.rb,
lib/alchemy-api/sentiment_analysis.rb,
lib/alchemy-api/relation_extraction.rb,
lib/alchemy-api/text_categorization.rb,
lib/alchemy-api/targeted_sentiment_analysis.rb

Defined Under Namespace

Classes: AuthorExtraction, Base, CombinedCall, ConceptTagging, Config, EmotionAnalysis, EntityExtraction, FaceDetection, ImageSceneText, ImageTagging, InvalidAPIKey, InvalidOutputMode, InvalidSearchMode, KeywordExtraction, LanguageDetection, MissingOptionsError, RelationExtraction, SentimentAnalysis, TargetedSentimentAnalysis, Taxonomy, TextCategorization, TextExtraction, TitleExtraction, UnknownError

Constant Summary collapse

BASE_URL =
'https://access.alchemyapi.com/calls/'.freeze
VERSION =
'0.8.0'.freeze

Class Method Summary collapse

Class Method Details

.configObject


25
26
27
# File 'lib/alchemy_api.rb', line 25

def self.config
  Config
end

.configureObject


29
30
31
# File 'lib/alchemy_api.rb', line 29

def self.configure
  block_given? ? yield(Config) : Config
end

.keyObject


33
34
35
# File 'lib/alchemy_api.rb', line 33

def self.key
  Config.apikey
end

.key=(value) ⇒ Object


37
38
39
# File 'lib/alchemy_api.rb', line 37

def self.key=(value)
  Config.apikey = value
end

.search(mode, opts) ⇒ Object

Raises:


41
42
43
44
45
46
47
48
# File 'lib/alchemy_api.rb', line 41

def self.search(mode, opts)
  klass = Config.modes[mode]

  raise InvalidAPIKey unless Config.apikey
  raise InvalidSearchMode unless klass

  klass.new.search(opts)
end