wordnik 4.11 → 4.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/Rakefile +1 -1
- data/lib/wordnik/response.rb +2 -2
- data/lib/wordnik/version.rb +1 -1
- data/spec/response_spec.rb +7 -17
- data/spec/spec_helper.rb +1 -1
- metadata +2 -8
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wordnik (4.
|
4
|
+
wordnik (4.12)
|
5
5
|
activemodel (>= 3.0.3)
|
6
6
|
addressable (>= 2.2.4)
|
7
7
|
htmlentities (>= 4.2.4)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
diff-lcs (1.1.3)
|
29
29
|
htmlentities (4.3.1)
|
30
30
|
i18n (0.6.1)
|
31
|
-
json (1.7.
|
31
|
+
json (1.7.6)
|
32
32
|
mime-types (1.19)
|
33
33
|
multi_json (1.3.6)
|
34
34
|
nokogiri (1.5.5)
|
data/Rakefile
CHANGED
data/lib/wordnik/response.rb
CHANGED
@@ -57,7 +57,7 @@ module Wordnik
|
|
57
57
|
# Extract the response format from the header hash
|
58
58
|
# e.g. {'Content-Type' => 'application/json'}
|
59
59
|
def format
|
60
|
-
headers['Content-Type'].split("/").last.to_s
|
60
|
+
headers['Content-Type'].split(";").first.strip.split("/").last.to_s
|
61
61
|
end
|
62
62
|
|
63
63
|
def json?
|
@@ -91,4 +91,4 @@ module Wordnik
|
|
91
91
|
end
|
92
92
|
|
93
93
|
end
|
94
|
-
end
|
94
|
+
end
|
data/lib/wordnik/version.rb
CHANGED
data/spec/response_spec.rb
CHANGED
@@ -4,9 +4,7 @@ describe Wordnik::Response do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
|
7
|
-
#
|
8
|
-
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.json")
|
9
|
-
#end
|
7
|
+
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.json")
|
10
8
|
|
11
9
|
@response = Wordnik::Response.new(@raw)
|
12
10
|
end
|
@@ -29,10 +27,8 @@ describe Wordnik::Response do
|
|
29
27
|
|
30
28
|
describe "unauthorized" do
|
31
29
|
it "raises an error when initialized" do
|
32
|
-
#
|
33
|
-
|
34
|
-
expect { Wordnik::Response.new(@unauthorized_raw) }.to raise_error(ClientError)
|
35
|
-
#end
|
30
|
+
@unauthorized_raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.json/dog/images/flickr")
|
31
|
+
expect { Wordnik::Response.new(@unauthorized_raw) }.to raise_error(ClientError)
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
@@ -44,9 +40,7 @@ describe Wordnik::Response do
|
|
44
40
|
end
|
45
41
|
|
46
42
|
it "recognizes xml" do
|
47
|
-
#
|
48
|
-
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.xml")
|
49
|
-
#end
|
43
|
+
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.xml")
|
50
44
|
@response = Wordnik::Response.new(@raw)
|
51
45
|
@response.format.should == 'xml'
|
52
46
|
@response.xml?.should == true
|
@@ -62,17 +56,13 @@ describe Wordnik::Response do
|
|
62
56
|
|
63
57
|
it "has a pretty XML body even in the face of adverse characters" do
|
64
58
|
configure_wordnik
|
65
|
-
|
66
|
-
|
67
|
-
@response = @request.response
|
68
|
-
#end
|
59
|
+
@request = Wordnik::Request.new(:get, "word.xml/hero/pronunciations", :params => {:limit => 1})
|
60
|
+
@response = @request.response
|
69
61
|
@response.pretty_body.should =~ /\?xml/
|
70
62
|
end
|
71
63
|
|
72
64
|
it "has a pretty xml body" do
|
73
|
-
#
|
74
|
-
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.xml")
|
75
|
-
#end
|
65
|
+
@raw = Typhoeus::Request.get("http://#{Wordnik.configuration.host}#{Wordnik.configuration.base_path}/word.xml")
|
76
66
|
@response = Wordnik::Response.new(@raw)
|
77
67
|
@response.pretty_body.should =~ /\?xml/
|
78
68
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -42,7 +42,7 @@ def configure_wordnik
|
|
42
42
|
config.password = CREDENTIALS[:password]
|
43
43
|
config.logger = CREDENTIALS[:logfile] ? Logger.new(CREDENTIALS[:logfile]) : Logger.new('/dev/null')
|
44
44
|
|
45
|
-
config.host = CREDENTIALS[:host] || 'beta.wordnik.com'
|
45
|
+
config.host = CREDENTIALS[:host] || 'beta.api.wordnik.com'
|
46
46
|
config.hosts = CREDENTIALS[:hosts] || []
|
47
47
|
config.base_path = CREDENTIALS[:base_path] || '/v4'
|
48
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordnik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '4.
|
4
|
+
version: '4.12'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typhoeus
|
@@ -308,18 +308,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
308
308
|
- - ! '>='
|
309
309
|
- !ruby/object:Gem::Version
|
310
310
|
version: '0'
|
311
|
-
segments:
|
312
|
-
- 0
|
313
|
-
hash: 2965605732452902667
|
314
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
315
312
|
none: false
|
316
313
|
requirements:
|
317
314
|
- - ! '>='
|
318
315
|
- !ruby/object:Gem::Version
|
319
316
|
version: '0'
|
320
|
-
segments:
|
321
|
-
- 0
|
322
|
-
hash: 2965605732452902667
|
323
317
|
requirements: []
|
324
318
|
rubyforge_project: wordnik
|
325
319
|
rubygems_version: 1.8.24
|