dinosaurus 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dinosaurus/thesaurus.rb +5 -1
- data/lib/dinosaurus/version.rb +1 -1
- data/spec/dinosaurus/thesaurus_spec.rb +7 -0
- metadata +7 -7
data/lib/dinosaurus/thesaurus.rb
CHANGED
@@ -2,6 +2,8 @@ require "httparty"
|
|
2
2
|
require "json"
|
3
3
|
|
4
4
|
module Dinosaurus
|
5
|
+
class MissingApiKeyError < StandardError; end
|
6
|
+
|
5
7
|
class Thesaurus
|
6
8
|
include HTTParty
|
7
9
|
base_uri "words.bighugelabs.com"
|
@@ -23,7 +25,9 @@ module Dinosaurus
|
|
23
25
|
private
|
24
26
|
|
25
27
|
def self.url_for(word)
|
26
|
-
|
28
|
+
key = Dinosaurus.configuration.api_key
|
29
|
+
raise MissingApiKeyError unless key
|
30
|
+
"/api/2/" + key + '/' + word + '/json'
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
data/lib/dinosaurus/version.rb
CHANGED
@@ -24,4 +24,11 @@ describe Dinosaurus::Thesaurus do
|
|
24
24
|
subject.lookup('word')
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
it "should raise up if missing api key" do
|
29
|
+
Dinosaurus.configuration.stub(:api_key)
|
30
|
+
expect do
|
31
|
+
subject.lookup('word')
|
32
|
+
end.to raise_error(Dinosaurus::MissingApiKeyError)
|
33
|
+
end
|
27
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dinosaurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70358289347500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70358289347500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: vcr
|
27
|
-
requirement: &
|
27
|
+
requirement: &70358289346580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70358289346580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: httparty
|
38
|
-
requirement: &
|
38
|
+
requirement: &70358289345480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70358289345480
|
47
47
|
description: Ruby wrapper for the Big Huge Thesaurus APIs.
|
48
48
|
email:
|
49
49
|
- dtuite@gmail.com
|