vault-usage-client 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +4 -4
- data/lib/vault-usage-client/client.rb +2 -2
- data/lib/vault-usage-client/version.rb +1 -1
- data/lib/vault-usage-client.rb +1 -1
- data/test/client_test.rb +7 -7
- data/vault-usage-client.gemspec +1 -1
- metadata +5 -5
data/Gemfile.lock
CHANGED
@@ -15,19 +15,20 @@ GIT
|
|
15
15
|
PATH
|
16
16
|
remote: .
|
17
17
|
specs:
|
18
|
-
vault-usage-client (0.0.
|
18
|
+
vault-usage-client (0.0.6)
|
19
19
|
colorize
|
20
20
|
excon
|
21
|
-
|
21
|
+
multi_json
|
22
22
|
|
23
23
|
GEM
|
24
24
|
remote: https://rubygems.org/
|
25
25
|
specs:
|
26
26
|
ansi (1.4.3)
|
27
27
|
colorize (0.5.8)
|
28
|
-
excon (0.
|
28
|
+
excon (0.25.3)
|
29
29
|
json (1.7.7)
|
30
30
|
minitest (4.7.1)
|
31
|
+
multi_json (1.7.9)
|
31
32
|
nokogiri (1.5.9)
|
32
33
|
open4 (1.3.0)
|
33
34
|
perftools.rb (2.0.0)
|
@@ -45,7 +46,6 @@ GEM
|
|
45
46
|
rr (1.0.5)
|
46
47
|
turn (0.9.6)
|
47
48
|
ansi
|
48
|
-
yajl-ruby (1.1.0)
|
49
49
|
yard (0.8.6.1)
|
50
50
|
|
51
51
|
PLATFORMS
|
@@ -43,7 +43,7 @@ module Vault::Usage
|
|
43
43
|
"/events/#{event_id}/open/#{iso_format(start_time)}"
|
44
44
|
unless detail.nil?
|
45
45
|
headers = {'Content-Type' => 'application/json'}
|
46
|
-
body =
|
46
|
+
body = MultiJson.dump(detail)
|
47
47
|
end
|
48
48
|
connection = Excon.new(@url)
|
49
49
|
connection.put(path: path, headers: headers, body: body,
|
@@ -120,7 +120,7 @@ module Vault::Usage
|
|
120
120
|
query[:callback_url] = callback_url if callback_url
|
121
121
|
connection = Excon.new(@url)
|
122
122
|
response = connection.get(path: path, expects: [200], query: query)
|
123
|
-
payload =
|
123
|
+
payload = MultiJson.load(response.body, {symbolize_keys: true})
|
124
124
|
return payload[:job_id] if payload[:job_id]
|
125
125
|
events = payload[:events]
|
126
126
|
events.each do |event|
|
data/lib/vault-usage-client.rb
CHANGED
data/test/client_test.rb
CHANGED
@@ -66,7 +66,7 @@ class ClientTest < Vault::TestCase
|
|
66
66
|
kernel: 'us-east-1-a'}
|
67
67
|
Excon.stub(method: :put) do |request|
|
68
68
|
assert_equal('application/json', request[:headers]['Content-Type'])
|
69
|
-
assert_equal(detail,
|
69
|
+
assert_equal(detail, MultiJson.load(request[:body], {symbolize_keys: true}))
|
70
70
|
Excon.stubs.pop
|
71
71
|
{status: 201}
|
72
72
|
end
|
@@ -152,7 +152,7 @@ class ClientTest < Vault::TestCase
|
|
152
152
|
"#{iso_format(@stop_time)}",
|
153
153
|
request[:path])
|
154
154
|
Excon.stubs.pop
|
155
|
-
{status: 200, body:
|
155
|
+
{status: 200, body: MultiJson.dump({events: []})}
|
156
156
|
end
|
157
157
|
assert_equal([], @client.usage_for_user(@user_hid, @start_time,
|
158
158
|
@stop_time))
|
@@ -164,7 +164,7 @@ class ClientTest < Vault::TestCase
|
|
164
164
|
Excon.stub(method: :get) do |request|
|
165
165
|
assert_equal({exclude: 'platform:dyno:physical'}, request[:query])
|
166
166
|
Excon.stubs.pop
|
167
|
-
{status: 200, body:
|
167
|
+
{status: 200, body: MultiJson.dump({events: []})}
|
168
168
|
end
|
169
169
|
assert_equal([], @client.usage_for_user(@user_hid, @start_time, @stop_time,
|
170
170
|
['platform:dyno:physical']))
|
@@ -174,7 +174,7 @@ class ClientTest < Vault::TestCase
|
|
174
174
|
Excon.stub(method: :get) do |request|
|
175
175
|
assert_equal({callback_url: 'http://example.com'}, request[:query])
|
176
176
|
Excon.stubs.pop
|
177
|
-
{status: 200, body:
|
177
|
+
{status: 200, body: MultiJson.dump({job_id: 'DEADBEEF'})}
|
178
178
|
end
|
179
179
|
assert_equal('DEADBEEF',
|
180
180
|
@client.usage_for_user(@user_hid, @start_time, @stop_time, nil,'http://example.com'))
|
@@ -188,7 +188,7 @@ class ClientTest < Vault::TestCase
|
|
188
188
|
assert_equal({exclude: 'platform:dyno:physical,addons:memcache:100mb'},
|
189
189
|
request[:query])
|
190
190
|
Excon.stubs.pop
|
191
|
-
{status: 200, body:
|
191
|
+
{status: 200, body: MultiJson.dump({events: []})}
|
192
192
|
end
|
193
193
|
assert_equal([], @client.usage_for_user(@user_hid, @start_time, @stop_time,
|
194
194
|
['platform:dyno:physical',
|
@@ -201,7 +201,7 @@ class ClientTest < Vault::TestCase
|
|
201
201
|
Excon.stub(method: :get) do |request|
|
202
202
|
assert_equal({}, request[:query])
|
203
203
|
Excon.stubs.pop
|
204
|
-
{status: 200, body:
|
204
|
+
{status: 200, body: MultiJson.dump({events: []})}
|
205
205
|
end
|
206
206
|
assert_equal([], @client.usage_for_user(@user_hid, @start_time, @stop_time,
|
207
207
|
[]))
|
@@ -218,7 +218,7 @@ class ClientTest < Vault::TestCase
|
|
218
218
|
start_time: iso_format(@start_time),
|
219
219
|
stop_time: iso_format(@stop_time),
|
220
220
|
detail: {}}]
|
221
|
-
{status: 200, body:
|
221
|
+
{status: 200, body: MultiJson.dump({events: events})}
|
222
222
|
end
|
223
223
|
assert_equal([{id: @event_id,
|
224
224
|
product: @product_name,
|
data/vault-usage-client.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-usage-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2013-
|
13
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: excon
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: multi_json
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
segments:
|
99
99
|
- 0
|
100
|
-
hash: -
|
100
|
+
hash: -3250898009532451176
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
103
103
|
requirements:
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash: -
|
109
|
+
hash: -3250898009532451176
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
112
|
rubygems_version: 1.8.23
|