burghers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d5016ecadb007cdb522ecb1054b2d1978811ee7
4
- data.tar.gz: a8c05eac6d8c6a6ab6a4a0ed3f90c42d2424d292
3
+ metadata.gz: fdddc6ea3144da369f0d582b627d4a89eb41f4d6
4
+ data.tar.gz: 8d4c4738d11b5a052903459f48e52bdedd3880a5
5
5
  SHA512:
6
- metadata.gz: 615907fc781daab3d08bafaca8fb40ae79c7b31f28fca7e6d9a3e3800b7ab7885aa3ed1a6feaf3ad66dfef9fe4c4e1dcea73eacd7ba77b3fb81ada616a474f3b
7
- data.tar.gz: e5205056ababade184aaf90b60dbc5c6f8f6a2133a58f88f731dd53ed454b38a9e865ade5c30e597d16dbe3a780c0c7c15444e6092da0968e926c7361290b9e1
6
+ metadata.gz: 5ccaecba85327b4001bba513adf212bfe947e78ea7a7addf3a185a4c27bf3eca199983984bc25d8a23ae50446a275f6e9d72a235e80b536695c845f73a05826a
7
+ data.tar.gz: 4fb9f954fc70d484c0942029ebcaf66f54a58bafc610e477ff3c99a3a622dcb7913851badc83e1ee962d438c69ffcceb024ef2ee0ee5482ac6dfe827b23dd6e6
@@ -1,3 +1,4 @@
1
1
  require "burghers/version"
2
+ require "burghers/exceptions"
2
3
  require "burghers/response"
3
4
  require "burghers/client"
@@ -30,7 +30,7 @@ module Burghers
30
30
 
31
31
  response = HTTParty.post(URI, :body => content, :headers => headers)
32
32
  if response.code != 200
33
- raise "Got response code of #{response.code}: #{response}"
33
+ raise CalaisResponseError, "Got response code of #{response.code}: #{response}"
34
34
  end
35
35
 
36
36
  Response.new response.parsed_response
@@ -0,0 +1,7 @@
1
+ module Burghers
2
+ class DocumentTooSmallError < RuntimeError
3
+ end
4
+
5
+ class CalaisResponseError < RuntimeError
6
+ end
7
+ end
@@ -11,7 +11,7 @@ module Burghers
11
11
  @relations = []
12
12
 
13
13
  if @raw['doc']['meta']['language'] == "InputTextTooShort"
14
- raise "Document too short to process."
14
+ raise DocumentTooSmallError, "Document too short to process."
15
15
  end
16
16
 
17
17
  @raw.each do |key, value|
@@ -1,3 +1,3 @@
1
1
  module Burghers
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -25,7 +25,7 @@ class BurghersTest < MiniTest::Test
25
25
 
26
26
  def test_with_url
27
27
  content = "http://www.washingtonpost.com/lifestyle/style/rep-vance-mcallister-kissed-now-can-he-make-up-with-voters-after-the-scandal/2014/04/16/9a898fde-c57c-11e3-9f37-7ce307c56815_story.html"
28
- expected = [{:name=>"Politics", :score=>0.57}]
28
+ expected = [{:name=>"Politics", :score=>0.66}]
29
29
  assert_equal expected, @client.enrich(content).topics
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burghers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Muller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-21 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -82,6 +82,7 @@ files:
82
82
  - burghers.gemspec
83
83
  - lib/burghers.rb
84
84
  - lib/burghers/client.rb
85
+ - lib/burghers/exceptions.rb
85
86
  - lib/burghers/response.rb
86
87
  - lib/burghers/version.rb
87
88
  - test/burghers_test.rb