docverter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/docverter/version.rb +1 -1
- data/lib/docverter.rb +4 -4
- data/test/test_docverter.rb +8 -0
- metadata +3 -4
data/lib/docverter/version.rb
CHANGED
data/lib/docverter.rb
CHANGED
@@ -23,9 +23,9 @@ module Docverter
|
|
23
23
|
def self.api_url(path='')
|
24
24
|
u = URI(@@base_url + path)
|
25
25
|
key = self.api_key
|
26
|
-
raise AuthenticationError.new('No API key provided. (HINT: set your API key using "Docverter.api_key = <API-KEY>". You can find your API in the Docverter web interface. See http://www.docverter.com/api.html for details, or email pete@docverter.com if you have any questions.)')
|
27
|
-
u.user = key
|
28
|
-
u.password = ''
|
26
|
+
raise AuthenticationError.new('No API key provided. (HINT: set your API key using "Docverter.api_key = <API-KEY>". You can find your API in the Docverter web interface. See http://www.docverter.com/api.html for details, or email pete@docverter.com if you have any questions.)') if key.nil? && @@base_url == 'https://api.docverter.com/v1'
|
27
|
+
u.user = key if key
|
28
|
+
u.password = '' if key
|
29
29
|
u.to_s
|
30
30
|
end
|
31
31
|
|
@@ -35,7 +35,7 @@ module Docverter
|
|
35
35
|
|
36
36
|
def self.reset
|
37
37
|
@@api_key = nil
|
38
|
-
@@
|
38
|
+
@@base_url = 'https://api.docverter.com/v1'
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.request(method, url, params={}, headers={})
|
data/test/test_docverter.rb
CHANGED
@@ -21,6 +21,14 @@ class TestDocverter < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
should "not raise if no api key given and base url changed" do
|
25
|
+
Docverter.api_key = nil
|
26
|
+
Docverter.base_url = 'http://localhost:9595/convert'
|
27
|
+
assert_nothing_raised do
|
28
|
+
Docverter.api_url
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
24
32
|
should "have default base url" do
|
25
33
|
assert_equal "https://test_key:@api.docverter.com/v1", Docverter.api_url
|
26
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docverter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -98,11 +98,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.23
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
104
|
summary: API for converting documents with the Docverter service
|
105
105
|
test_files:
|
106
106
|
- test/test_docverter.rb
|
107
107
|
- test/test_helper.rb
|
108
|
-
has_rdoc:
|