amiando 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/amiando.gemspec +1 -1
- data/lib/amiando.rb +5 -2
- data/lib/amiando/version.rb +1 -1
- data/test/amiando/amiando_test.rb +7 -1
- data/test/amiando/resource_test.rb +7 -10
- data/test/test_helper.rb +1 -0
- metadata +8 -10
data/amiando.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency 'multi_json'
|
23
23
|
|
24
24
|
s.add_development_dependency 'minitest', '2.9.0'
|
25
|
-
s.add_development_dependency 'webmock', '~> 1.7.
|
25
|
+
s.add_development_dependency 'webmock', '~> 1.7.9'
|
26
26
|
s.add_development_dependency 'rake'
|
27
27
|
end
|
data/lib/amiando.rb
CHANGED
@@ -41,10 +41,13 @@ module Amiando
|
|
41
41
|
# If set to true, will run the requests automatically when needed.
|
42
42
|
attr_accessor :autorun
|
43
43
|
|
44
|
+
# You can configure the amiando end point manually
|
45
|
+
attr_writer :base_url
|
46
|
+
|
44
47
|
# Timeout value (in milliseconds). Default: 15 seconds.
|
45
48
|
attr_accessor :timeout
|
46
49
|
|
47
|
-
URL = 'https://amiando.com'
|
50
|
+
URL = 'https://www.amiando.com'
|
48
51
|
TEST_URL = 'https://test.amiando.com'
|
49
52
|
|
50
53
|
# Connect to the production server
|
@@ -59,7 +62,7 @@ module Amiando
|
|
59
62
|
|
60
63
|
# @return [String] the url for the environment
|
61
64
|
def base_url
|
62
|
-
@production ? URL : TEST_URL
|
65
|
+
@base_url || (@production ? URL : TEST_URL)
|
63
66
|
end
|
64
67
|
|
65
68
|
def requests
|
data/lib/amiando/version.rb
CHANGED
@@ -7,10 +7,16 @@ describe Amiando do
|
|
7
7
|
|
8
8
|
it 'should return the right url for the production environment' do
|
9
9
|
Amiando.production!
|
10
|
-
Amiando.base_url.must_equal 'https://amiando.com'
|
10
|
+
Amiando.base_url.must_equal 'https://www.amiando.com'
|
11
11
|
Amiando.development!
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should allow a configurable url' do
|
15
|
+
Amiando.base_url = 'https://something.amiando.com'
|
16
|
+
Amiando.base_url.must_equal 'https://something.amiando.com'
|
17
|
+
Amiando.base_url = nil
|
18
|
+
end
|
19
|
+
|
14
20
|
describe 'logger' do
|
15
21
|
it 'should define a logger' do
|
16
22
|
log = StringIO.new
|
@@ -33,16 +33,13 @@ describe Amiando::Resource do
|
|
33
33
|
}.must_raise Amiando::Error::ServiceDown
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Amiando.run
|
44
|
-
# }.must_raise Amiando::Error::Timeout
|
45
|
-
# end
|
36
|
+
it 'raises error when the request times out' do
|
37
|
+
stub_request(:post, /somewhere/).to_timeout
|
38
|
+
lambda {
|
39
|
+
Wadus.create
|
40
|
+
Amiando.run
|
41
|
+
}.must_raise Amiando::Error::Timeout
|
42
|
+
end
|
46
43
|
|
47
44
|
it 'raises error when the request returns code 0' do
|
48
45
|
stub_request(:post, /somewhere/).to_return(:status => 0)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amiando
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 9
|
10
|
+
version: 0.3.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jorge Dias
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-01-
|
20
|
-
default_executable:
|
19
|
+
date: 2012-01-19 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: typhoeus
|
@@ -71,12 +70,12 @@ dependencies:
|
|
71
70
|
requirements:
|
72
71
|
- - ~>
|
73
72
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
73
|
+
hash: 25
|
75
74
|
segments:
|
76
75
|
- 1
|
77
76
|
- 7
|
78
|
-
-
|
79
|
-
version: 1.7.
|
77
|
+
- 9
|
78
|
+
version: 1.7.9
|
80
79
|
type: :development
|
81
80
|
version_requirements: *id004
|
82
81
|
- !ruby/object:Gem::Dependency
|
@@ -226,7 +225,6 @@ files:
|
|
226
225
|
- test/support/hydra_cache.rb
|
227
226
|
- test/support/hydra_monkey_patch.rb
|
228
227
|
- test/test_helper.rb
|
229
|
-
has_rdoc: true
|
230
228
|
homepage: ""
|
231
229
|
licenses: []
|
232
230
|
|
@@ -256,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
254
|
requirements: []
|
257
255
|
|
258
256
|
rubyforge_project: amiando
|
259
|
-
rubygems_version: 1.
|
257
|
+
rubygems_version: 1.8.10
|
260
258
|
signing_key:
|
261
259
|
specification_version: 3
|
262
260
|
summary: A ruby client for the amiando REST API
|