Class: AlchemyAPI::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/alchemy-api.rb

Constant Summary collapse

COMMON_FUNCTIONS =

Functions that can use Text, HTML, or URL

[
  "GetRankedNamedEntities",
  "GetTextSentiment",
  "GetTargetedSentiment",
  "GetRankedKeywords",
  "GetRankedConcepts",
  "GetRelations",
  "GetCategory",
  "GetLanguage"
]
WEB_ONLY_FUNCTIONS =
[
  "GetAuthor",
  "GetFeedLinks",
  "GetText",
  "GetRawText",
  "GetTitle",
  "GetMicroformatData",
  "GetConstraintQuery"
]
TEXT_FUNCTIONS =
COMMON_FUNCTIONS.map { |func| "Text" + func }
HTML_FUNCTIONS =
(COMMON_FUNCTIONS+WEB_ONLY_FUNCTIONS).map { |func| "HTML" + func }
URL_FUNCTIONS =
(COMMON_FUNCTIONS+WEB_ONLY_FUNCTIONS).map { |func| "URL" + func }

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



35
36
37
# File 'lib/alchemy-api.rb', line 35

def initialize(api_key)
  @default_options = { apikey: api_key, outputMode: 'json' }
end