small changes all around to fit with hoe
[ruby-calais.git] / lib / calais.rb
blob2c030105c22d12dc37d2ae5c076be5d495eed529
1 require 'digest/sha1'
2 require 'net/http'
3 require 'yaml'
4 require 'cgi'
6 require 'rubygems'
7 require 'hpricot'
9 $KCODE = "UTF8"
11 Dir.glob(File.join(File.dirname(__FILE__), 'calais/*.rb')).each { |f| require f }
13 module Calais
14   POST_URL = "http://api.opencalais.com"
15   
16   AVAILABLE_OUTPUT_FORMATS = {
17     :rdf => "XML/RDF"
18   }
19   DEFAULT_OUTPUT_FORMAT = :rdf
20   
21   AVAILABLE_CONTENT_TYPES = {
22     :xml => "TEXT/XML",
23     :html => "TEXT/HTML",
24     :text => "TEXT/TXT"
25   }
26   DEFAULT_CONTENT_TYPE = :xml
27   
28   DEFAULT_SUBMITTER = "calais.rb"
29   
30   AVAILABLE_METHODS = {
31     :enlighten => "/enlighten/calais.asmx/Enlighten"
32   }
33   
34   MAX_RETRIES = 5
35   
36   class << self
37     def enlighten(*args, &block) Client.new(*args, &block).call(:enlighten) end
38     def process_document(*args, &block) 
39       data, error = Calais.enlighten(*args, &block)
40       Client.process_data(data, error)
41     end
42   end
43 end
45 module Calais
46   VERSION = '0.0.1'
47 end