dinosaurus 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require "httparty"
2
2
  require "json"
3
+ require "uri"
3
4
 
4
5
  module Dinosaurus
5
6
  class MissingApiKeyError < StandardError; end
@@ -30,7 +31,7 @@ module Dinosaurus
30
31
  def self.url_for(word)
31
32
  key = Dinosaurus.configuration.api_key
32
33
  raise MissingApiKeyError unless key
33
- "/api/2/" + key + '/' + word + '/json'
34
+ URI.encode("/api/2/" + key + '/' + word + '/json')
34
35
  end
35
36
  end
36
37
  end
@@ -1,3 +1,3 @@
1
1
  module Dinosaurus
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -31,6 +31,12 @@ describe Dinosaurus::Thesaurus do
31
31
  end
32
32
  end
33
33
 
34
+ it "should handle two words" do
35
+ VCR.use_cassette('meal_people') do
36
+ subject.lookup('meal people')[:results].should == []
37
+ end
38
+ end
39
+
34
40
  it "should raise up if missing api key" do
35
41
  Dinosaurus.configuration.stub(:api_key)
36
42
  expect do
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://words.bighugelabs.com/api/2/<API_KEY>/meal%20people/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ Server:
16
+ - nginx/1.1.19
17
+ Date:
18
+ - Sun, 22 Jul 2012 23:06:07 GMT
19
+ Content-Type:
20
+ - text/html
21
+ Content-Length:
22
+ - '0'
23
+ Connection:
24
+ - keep-alive
25
+ X-Powered-By:
26
+ - PHP/5.3.10-1ubuntu3.2
27
+ Set-Cookie:
28
+ - PHPSESSID=07bn2cohasfbffavd8brgf7m52; path=/; domain=words.bighugelabs.com
29
+ Expires:
30
+ - Thu, 19 Nov 1981 08:52:00 GMT
31
+ Cache-Control:
32
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
33
+ Pragma:
34
+ - no-cache
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ http_version:
39
+ recorded_at: Sun, 22 Jul 2012 23:06:07 GMT
40
+ recorded_with: VCR 2.2.0
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.3
4
+ version: 0.0.4
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: &70182548252180 !ruby/object:Gem::Requirement
16
+ requirement: &70207579581080 !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: *70182548252180
24
+ version_requirements: *70207579581080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vcr
27
- requirement: &70182548250000 !ruby/object:Gem::Requirement
27
+ requirement: &70207579600980 !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: *70182548250000
35
+ version_requirements: *70207579600980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: httparty
38
- requirement: &70182548247380 !ruby/object:Gem::Requirement
38
+ requirement: &70207579599500 !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: *70182548247380
46
+ version_requirements: *70207579599500
47
47
  description: Ruby wrapper for the Big Huge Thesaurus APIs.
48
48
  email:
49
49
  - dtuite@gmail.com
@@ -65,6 +65,7 @@ files:
65
65
  - lib/dinosaurus/thesaurus.rb
66
66
  - lib/dinosaurus/version.rb
67
67
  - spec/dinosaurus/thesaurus_spec.rb
68
+ - spec/fixtures/vcr_cassettes/meal_people.yml
68
69
  - spec/fixtures/vcr_cassettes/nonsense.yml
69
70
  - spec/fixtures/vcr_cassettes/word.yml
70
71
  - spec/spec_helper.rb
@@ -94,6 +95,7 @@ specification_version: 3
94
95
  summary: Lookup synonyms, antonyms etc. using the Big Huge Thesaurus API.
95
96
  test_files:
96
97
  - spec/dinosaurus/thesaurus_spec.rb
98
+ - spec/fixtures/vcr_cassettes/meal_people.yml
97
99
  - spec/fixtures/vcr_cassettes/nonsense.yml
98
100
  - spec/fixtures/vcr_cassettes/word.yml
99
101
  - spec/spec_helper.rb