wss_agent 17.12.2 → 18.5.2
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.
- checksums.yaml +5 -5
- data/lib/wss_agent/client.rb +4 -2
- data/lib/wss_agent/configure.rb +8 -0
- data/lib/wss_agent/version.rb +1 -1
- data/spec/wss_agent/client_spec.rb +24 -10
- data/spec/wss_agent/configure_spec.rb +20 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6a168842e0686c32bc7165a9175e5be05470a161e88ab99f9adb37e80c60c2e9
|
4
|
+
data.tar.gz: 4d6b01926bc21b67eb0604aa4700398ca5de190c91434ebfee903aeda10a1bfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1957d887f52a2c9bcc867f3d1ae5954fa00271f89f7184ad00ffc4a8d4aa981108f27bc4506d0ddb549d1a808683c0b99dec5a53051166789ac583be746658e
|
7
|
+
data.tar.gz: 39ff2e97b3d0858d3c05431bee93a18bc0eb7471884032fe5acbd240368c44dd714759d4e91e5dbaa496cd74c9afdbdf00b725f985b8907a900583bfe01107e9
|
data/lib/wss_agent/client.rb
CHANGED
@@ -35,7 +35,7 @@ module WssAgent
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def payload(gem_list, options = {})
|
38
|
-
{
|
38
|
+
req_options = {
|
39
39
|
agent: Configure['agent'],
|
40
40
|
agentVersion: Configure['agent_version'],
|
41
41
|
token: Configure.token,
|
@@ -43,7 +43,9 @@ module WssAgent
|
|
43
43
|
productVersion: Configure['product_version'].to_s,
|
44
44
|
timeStamp: Time.now.to_i,
|
45
45
|
diff: diff(gem_list)
|
46
|
-
}
|
46
|
+
}
|
47
|
+
req_options[:userKey] = Configure.user_key if Configure.user_key?
|
48
|
+
req_options.merge(options)
|
47
49
|
end
|
48
50
|
|
49
51
|
def update(gem_list)
|
data/lib/wss_agent/configure.rb
CHANGED
data/lib/wss_agent/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe WssAgent::Client, vcr: true do
|
4
|
+
let(:user_key){ '9ec685d4f32843c2b963e3556256489e273cb1a122f948ba93463ffba6f1ed8c' }
|
4
5
|
let(:bad_request_response) {
|
5
6
|
{"envelopeVersion"=>"2.1.0", "status"=>2, "message"=>"Illegal arguments", "data"=>"Unsupported agent: null"}
|
6
7
|
}
|
@@ -19,20 +20,33 @@ describe WssAgent::Client, vcr: true do
|
|
19
20
|
|
20
21
|
|
21
22
|
describe '#payload' do
|
23
|
+
let(:payload) {
|
24
|
+
{
|
25
|
+
agent: "bundler-plugin",
|
26
|
+
agentVersion: "1.0",
|
27
|
+
token: "xxxxxx",
|
28
|
+
product: "",
|
29
|
+
productVersion: "",
|
30
|
+
diff: "[{\"coordinates\":{\"artifactId\":\"wss_agent\",\"version\":\"#{WssAgent::VERSION}\"},\"dependencies\":{}}]",
|
22
31
|
|
23
|
-
|
32
|
+
}
|
33
|
+
|
34
|
+
}
|
35
|
+
it 'should return request params with userKey' do
|
36
|
+
allow(WssAgent::Configure).to receive_messages(user_key: user_key)
|
24
37
|
Timecop.freeze(Time.now) do
|
25
|
-
|
26
|
-
agent: "bundler-plugin",
|
27
|
-
agentVersion: "1.0",
|
28
|
-
token: "xxxxxx",
|
29
|
-
product: "",
|
30
|
-
productVersion: "",
|
38
|
+
payload_params = payload.merge(
|
31
39
|
timeStamp: Time.now.to_i,
|
32
|
-
|
33
|
-
|
40
|
+
userKey: user_key
|
41
|
+
)
|
34
42
|
|
35
|
-
expect(wss_client.payload({})).to eq(
|
43
|
+
expect(wss_client.payload({})).to eq(payload_params)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
it 'should return request params without userKey' do
|
47
|
+
Timecop.freeze(Time.now) do
|
48
|
+
payload_params = payload.merge(timeStamp: Time.now.to_i)
|
49
|
+
expect(wss_client.payload({})).to eq(payload_params)
|
36
50
|
end
|
37
51
|
end
|
38
52
|
end
|
@@ -124,6 +124,26 @@ describe WssAgent::Configure do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
describe '.user_key' do
|
128
|
+
context 'when user_key is not exist' do
|
129
|
+
it 'should return empty string' do
|
130
|
+
expect(WssAgent::Configure.user_key).to eq('')
|
131
|
+
end
|
132
|
+
it { expect(WssAgent::Configure.user_key?).to be_falsey }
|
133
|
+
end
|
134
|
+
context 'when user_key is exist' do
|
135
|
+
before do
|
136
|
+
allow(WssAgent::Configure).to receive_messages(user_key: '11111111')
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should return user_key' do
|
140
|
+
expect(WssAgent::Configure.user_key).to eq('11111111')
|
141
|
+
end
|
142
|
+
|
143
|
+
it { expect(WssAgent::Configure.user_key?).to be_truthy }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
127
147
|
describe '.agent' do
|
128
148
|
it 'should be "bundler-plugin"' do
|
129
149
|
expect(WssAgent::Configure['agent']).to eq('bundler-plugin')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wss_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 18.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Pechnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
339
|
version: '0'
|
340
340
|
requirements: []
|
341
341
|
rubyforge_project:
|
342
|
-
rubygems_version: 2.
|
342
|
+
rubygems_version: 2.7.3
|
343
343
|
signing_key:
|
344
344
|
specification_version: 4
|
345
345
|
summary: White Source agent.
|