open_calais 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dddc985b23664df2bceb1d3e76514a8e3380d7ed
4
- data.tar.gz: 86e484371ee46d9f7054c2576cdac9dff8b85b8a
3
+ metadata.gz: a2fdfafb9d1563e07adfb6bf8149e012008ffdfb
4
+ data.tar.gz: 0638f12eac133c7fa41d58e116e8b9bb8af480d7
5
5
  SHA512:
6
- metadata.gz: 62f0a663c050ac632b8258136125d9db76bd60e826d41d39e114ae019f590c710930e62d2d3551a0cd644e5b34f5e1d11be0d801dd2c7a9df9a778d2f858c88b
7
- data.tar.gz: 291b85dc4ffc2c9601e54c090a617f50fdc4372bcb949d931b308b33235afae5440b31918a3bcd9753bcdaa02adcfb0ab57d9e0db79fcd617719a855c62bebac
6
+ metadata.gz: 2d5c0b3cd56aed6317fff624e417c49c9e1e2f964211ceaf5dcac549c47af363cfad88f8ee312e80b74db54bfa596e7afc10dca8276d89287ca4e6b5c4448928
7
+ data.tar.gz: f8ec4708f9e19d2c36df508ee6c3147b5e4c78ae93b2d5a3b1b8e161e7d62f5c2e33f7cfa8d921fa6cc70958ea3e94f9affb8a24f1c9f38d5067cd3821d728a8
@@ -14,30 +14,20 @@ module OpenCalais
14
14
  :license_id => 'X-AG-Access-Token',
15
15
  :content_type => 'Content-Type',
16
16
  :output_format => 'outputFormat',
17
- :reltag_base_url => 'reltagBaseURL',
18
- :calculate_relevance_score => 'calculateRelevanceScore',
19
- :enable_metadata_type => 'enableMetadataType',
20
- :doc_rdf_accessible => 'docRDFaccessible',
21
- :discard_metadata => 'discardMetadata',
22
- :omit_outputting_original_text => 'omitOutputtingOriginalText',
23
- :allow_distribution => 'allowDistribution',
24
- :allow_search => 'allowSearch',
25
- :external_id => 'externalID',
26
- :submitter => 'submitter'
17
+ :language => 'x-calais-language'
27
18
  }
28
19
 
29
20
  CONTENT_TYPES = {
30
- :xml => 'TEXT/XML',
31
- :html => 'TEXT/HTML',
32
- :htmlraw => 'TEXT/HTMLRAW',
21
+ :xml => 'text/xml',
22
+ :html => 'text/html',
23
+ :htmlraw => 'text/htmlraw',
33
24
  :raw => 'text/raw'
34
25
  }
35
26
 
36
27
  OUTPUT_FORMATS = {
37
- :rdf => 'XML/RDF',
38
- :simple => 'Text/Simple',
39
- :microformats => 'Text/Microformats',
40
- :json => 'application/json'
28
+ :rdf => 'xml/rdf',
29
+ :n3 => 'text/n3',
30
+ :json => 'application/json'
41
31
  }
42
32
 
43
33
  METADATA_SOCIAL_TAGS = 'SocialTags'
@@ -49,5 +39,4 @@ module OpenCalais
49
39
  GEO_TYPES = %w(City Continent Country NaturalFeature ProvinceOrState Region)
50
40
 
51
41
  DISAMBUGUATIONS = %w(er/Company er/Geo er/Product)
52
-
53
42
  end
@@ -38,7 +38,7 @@ module OpenCalais
38
38
 
39
39
  def analyze(text, opts={})
40
40
  raise 'Specify a value for the text' unless (text && text.length > 0)
41
- options = {params: current_options}.merge(opts)
41
+ options = current_options.merge(opts)
42
42
 
43
43
  response = connection(options).post do |request|
44
44
  request.body = text
@@ -49,7 +49,5 @@ module OpenCalais
49
49
  # using analyze as a standard method name
50
50
  # enrich is more OpenCalais specific
51
51
  alias_method :enrich, :analyze
52
-
53
52
  end
54
-
55
53
  end
@@ -53,6 +53,5 @@ module OpenCalais
53
53
  self.user_agent = DEFAULT_USER_AGENT
54
54
  self
55
55
  end
56
-
57
56
  end
58
57
  end
@@ -22,20 +22,17 @@ module OpenCalais
22
22
  'Accept' => "#{OpenCalais::OUTPUT_FORMATS[:json]};charset=utf-8",
23
23
 
24
24
  # open calais default headers
25
- OpenCalais::HEADERS[:license_id] => api_key,
26
- OpenCalais::HEADERS[:content_type] => OpenCalais::CONTENT_TYPES[:raw],
27
- OpenCalais::HEADERS[:output_format] => OpenCalais::OUTPUT_FORMATS[:json],
28
- OpenCalais::HEADERS[:calculate_relevance_score] => 'false',
29
- OpenCalais::HEADERS[:enable_metadata_type] => 'SocialTags',
30
- OpenCalais::HEADERS[:doc_rdf_accessible] => 'false',
31
- OpenCalais::HEADERS[:omit_outputting_original_text] => 'TRUE' # case matters here, actually
25
+ OpenCalais::HEADERS[:license_id] => api_key,
26
+ OpenCalais::HEADERS[:content_type] => OpenCalais::CONTENT_TYPES[:raw],
27
+ OpenCalais::HEADERS[:output_format] => OpenCalais::OUTPUT_FORMATS[:json],
28
+ OpenCalais::HEADERS[:language] => 'English'
32
29
  },
33
30
  :ssl => {:verify => false},
34
31
  :url => endpoint
35
32
  }.merge(opts)
36
33
  options[:headers] = options[:headers].merge(headers)
37
34
  OpenCalais::HEADERS.each{|k,v| options[:headers][v] = options.delete(k) if options.key?(k)}
38
- options
35
+ options.select{|k,v| ALLOWED_OPTIONS.include?(k.to_sym)}
39
36
  end
40
37
 
41
38
  def connection(options={})
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module OpenCalais
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -36,5 +36,4 @@ describe OpenCalais::Client do
36
36
  response.wont_be_nil
37
37
  response.raw.wont_be_nil
38
38
  end
39
-
40
39
  end
@@ -21,5 +21,4 @@ describe OpenCalais do
21
21
 
22
22
  OpenCalais.options[:api_key].must_equal "this is a test key"
23
23
  end
24
-
25
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_calais
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kuklewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday