amiando 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/amiando.gemspec +1 -0
- data/lib/amiando.rb +3 -0
- data/lib/amiando/request.rb +3 -2
- data/lib/amiando/resource.rb +2 -1
- data/lib/amiando/version.rb +1 -1
- data/test/amiando/request_test.rb +16 -0
- metadata +116 -108
data/Gemfile
CHANGED
@@ -11,6 +11,7 @@ end
|
|
11
11
|
group :development do
|
12
12
|
gem 'minitest-reporters', '= 0.8.0'
|
13
13
|
gem 'guard-minitest'
|
14
|
+
gem 'typhoeus', '0.4.2'
|
14
15
|
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
15
16
|
gem 'rb-fsevent', '>= 0.4.0', :require => false
|
16
17
|
gem 'growl', '~> 1.0.3', :require => false
|
data/amiando.gemspec
CHANGED
@@ -24,5 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'hydra_cache'
|
25
25
|
s.add_development_dependency 'minitest', '2.9.0'
|
26
26
|
s.add_development_dependency 'webmock', '~> 1.7.9'
|
27
|
+
s.add_development_dependency 'mocha'
|
27
28
|
s.add_development_dependency 'rake'
|
28
29
|
end
|
data/lib/amiando.rb
CHANGED
@@ -60,6 +60,9 @@ module Amiando
|
|
60
60
|
# Used for statistics (time-bandits for example)
|
61
61
|
attr_accessor :total_time, :total_requests
|
62
62
|
|
63
|
+
# Set default options for typhoeus
|
64
|
+
attr_accessor :default_options
|
65
|
+
|
63
66
|
URL = 'https://www.amiando.com'
|
64
67
|
TEST_URL = 'https://test.amiando.com'
|
65
68
|
|
data/lib/amiando/request.rb
CHANGED
@@ -2,7 +2,7 @@ module Amiando
|
|
2
2
|
class Request < Typhoeus::Request
|
3
3
|
attr_reader :object
|
4
4
|
|
5
|
-
def initialize(object, verb, path, params)
|
5
|
+
def initialize(object, verb, path, params, options = {})
|
6
6
|
@object = object
|
7
7
|
|
8
8
|
if verb == :post
|
@@ -12,7 +12,8 @@ module Amiando
|
|
12
12
|
params = default_params.merge(params || {})
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
options = options.merge(:method => verb, :params => params, :verbose => Amiando.verbose, :timeout => Amiando.timeout)
|
16
|
+
super(path, options)
|
16
17
|
end
|
17
18
|
|
18
19
|
def log_request
|
data/lib/amiando/resource.rb
CHANGED
@@ -22,7 +22,8 @@ module Amiando
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def do_request(object, verb, path, options = {})
|
25
|
-
|
25
|
+
options = options.merge Amiando.default_options if Amiando.default_options
|
26
|
+
req = Request.new(object, verb, path, map_params(options[:params] || {}), options)
|
26
27
|
object.request = req
|
27
28
|
|
28
29
|
req.log_request
|
data/lib/amiando/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'mocha'
|
3
|
+
|
4
|
+
describe "Using options" do
|
5
|
+
|
6
|
+
it "should send any options to the request" do
|
7
|
+
Amiando.default_options = { :ignore_ssl => true }
|
8
|
+
|
9
|
+
Amiando::Request.expects(:new).with do |object, verb, path, params, options |
|
10
|
+
options[:ignore_ssl] == true
|
11
|
+
end.returns(stub_everything)
|
12
|
+
|
13
|
+
Amiando::Public::Event.search(:start_date => Time.utc(2012, 6, 18))
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
metadata
CHANGED
@@ -1,122 +1,137 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: amiando
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
hash: 9
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 0.5.1
|
5
|
+
version: 0.5.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jorge Dias
|
14
9
|
- Albert Llop
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: typhoeus
|
17
|
+
type: :runtime
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
23
19
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
31
|
-
version_requirements: *id001
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
32
24
|
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: multi_json
|
33
33
|
type: :runtime
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
37
35
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
segments:
|
43
|
-
- 0
|
44
|
-
version: "0"
|
45
|
-
version_requirements: *id002
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
46
40
|
prerelease: false
|
47
|
-
|
48
|
-
name: multi_json
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
42
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: hydra_cache
|
49
|
+
type: :development
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
60
56
|
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: minitest
|
61
65
|
type: :development
|
62
|
-
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
65
67
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
hash: 43
|
70
|
-
segments:
|
71
|
-
- 2
|
72
|
-
- 9
|
73
|
-
- 0
|
68
|
+
requirements:
|
69
|
+
- - '='
|
70
|
+
- !ruby/object:Gem::Version
|
74
71
|
version: 2.9.0
|
75
|
-
version_requirements: *id004
|
76
72
|
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - '='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.9.0
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: webmock
|
77
81
|
type: :development
|
78
|
-
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
81
83
|
none: false
|
82
|
-
requirements:
|
84
|
+
requirements:
|
83
85
|
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
hash: 25
|
86
|
-
segments:
|
87
|
-
- 1
|
88
|
-
- 7
|
89
|
-
- 9
|
86
|
+
- !ruby/object:Gem::Version
|
90
87
|
version: 1.7.9
|
91
|
-
version_requirements: *id005
|
92
88
|
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.7.9
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: mocha
|
93
97
|
type: :development
|
94
|
-
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
97
99
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
version_requirements: *id006
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
106
104
|
prerelease: false
|
107
|
-
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
108
112
|
name: rake
|
113
|
+
type: :development
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
109
127
|
description: A ruby client for the amiando REST API with parallel requests in mind
|
110
|
-
email:
|
128
|
+
email:
|
111
129
|
- jorge@mrdias.com
|
112
130
|
- mrsimo@gmail.com
|
113
131
|
executables: []
|
114
|
-
|
115
132
|
extensions: []
|
116
|
-
|
117
133
|
extra_rdoc_files: []
|
118
|
-
|
119
|
-
files:
|
134
|
+
files:
|
120
135
|
- .gitignore
|
121
136
|
- .travis.yml
|
122
137
|
- ChangeLog
|
@@ -152,6 +167,7 @@ files:
|
|
152
167
|
- test/amiando/partner_test.rb
|
153
168
|
- test/amiando/payment_type_test.rb
|
154
169
|
- test/amiando/public/event_test.rb
|
170
|
+
- test/amiando/request_test.rb
|
155
171
|
- test/amiando/resource_test.rb
|
156
172
|
- test/amiando/result_test.rb
|
157
173
|
- test/amiando/sync_test.rb
|
@@ -251,40 +267,31 @@ files:
|
|
251
267
|
- test/support/factory.rb
|
252
268
|
- test/support/hydra_monkey_patch.rb
|
253
269
|
- test/test_helper.rb
|
254
|
-
homepage:
|
270
|
+
homepage: ''
|
255
271
|
licenses: []
|
256
|
-
|
257
272
|
post_install_message:
|
258
273
|
rdoc_options: []
|
259
|
-
|
260
|
-
require_paths:
|
274
|
+
require_paths:
|
261
275
|
- lib
|
262
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
276
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
263
277
|
none: false
|
264
|
-
requirements:
|
265
|
-
- -
|
266
|
-
- !ruby/object:Gem::Version
|
267
|
-
|
268
|
-
|
269
|
-
- 0
|
270
|
-
version: "0"
|
271
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
278
|
+
requirements:
|
279
|
+
- - ! '>='
|
280
|
+
- !ruby/object:Gem::Version
|
281
|
+
version: '0'
|
282
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
272
283
|
none: false
|
273
|
-
requirements:
|
274
|
-
- -
|
275
|
-
- !ruby/object:Gem::Version
|
276
|
-
|
277
|
-
segments:
|
278
|
-
- 0
|
279
|
-
version: "0"
|
284
|
+
requirements:
|
285
|
+
- - ! '>='
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: '0'
|
280
288
|
requirements: []
|
281
|
-
|
282
289
|
rubyforge_project: amiando
|
283
|
-
rubygems_version: 1.8.
|
290
|
+
rubygems_version: 1.8.23
|
284
291
|
signing_key:
|
285
292
|
specification_version: 3
|
286
293
|
summary: A ruby client for the amiando REST API
|
287
|
-
test_files:
|
294
|
+
test_files:
|
288
295
|
- test/amiando/amiando_test.rb
|
289
296
|
- test/amiando/api_key_test.rb
|
290
297
|
- test/amiando/boolean_test.rb
|
@@ -292,6 +299,7 @@ test_files:
|
|
292
299
|
- test/amiando/partner_test.rb
|
293
300
|
- test/amiando/payment_type_test.rb
|
294
301
|
- test/amiando/public/event_test.rb
|
302
|
+
- test/amiando/request_test.rb
|
295
303
|
- test/amiando/resource_test.rb
|
296
304
|
- test/amiando/result_test.rb
|
297
305
|
- test/amiando/sync_test.rb
|