castle-rb 7.1.1 → 7.1.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 +4 -4
- data/lib/castle/core/send_request.rb +1 -3
- data/lib/castle/version.rb +1 -1
- data/spec/lib/castle/core/send_request_spec.rb +24 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2d022daae00e63158ee2f9d886faa5dbf3f70b89c16775c14f9328b0096f446
|
4
|
+
data.tar.gz: 1820e1afb9bd65683f5dd1a183369ed231b616c8466ee5c2b3d3cdd59d704319
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '009de5db675b53f46bb90f0f2cfe57cb081598c5af02d3770125d79d27739b03e82e6170013b86d5e74321e26a9f053023f6914ae68c1a7770b3ee2496c0482b'
|
7
|
+
data.tar.gz: 2dee44618c8c3318ba1dacc2f4484187fc8e28d2413db81531c9e46451da61dfcbea6aa5916a6df2d0eceaf6e5f97bed4c81f08bb3f9e1607f4ac798c90561ea
|
@@ -27,9 +27,7 @@ module Castle
|
|
27
27
|
url = "#{config.base_url.path}/#{command.path}"
|
28
28
|
request_obj = Net::HTTP.const_get(command.method.to_s.capitalize).new(url, headers)
|
29
29
|
|
30
|
-
|
31
|
-
request_obj.body = ::Castle::Utils::CleanInvalidChars.call(command.data).to_json
|
32
|
-
end
|
30
|
+
request_obj.body = ::Castle::Utils::CleanInvalidChars.call(command.data || {}).to_json
|
33
31
|
|
34
32
|
Castle::Logger.call("#{url}:", request_obj.body, config)
|
35
33
|
|
data/lib/castle/version.rb
CHANGED
@@ -73,5 +73,29 @@ describe Castle::Core::SendRequest do
|
|
73
73
|
it { expect(build.to_hash).to have_key('sample-header') }
|
74
74
|
it { expect(build.to_hash['sample-header']).to eql(['1']) }
|
75
75
|
end
|
76
|
+
|
77
|
+
context 'when get' do
|
78
|
+
let(:time) { Time.now.utc.iso8601(3) }
|
79
|
+
let(:command) { Castle::Commands::GetDevice.build(device_token: '1') }
|
80
|
+
let(:expected_body) { {} }
|
81
|
+
|
82
|
+
before { allow(Castle::Utils::GetTimestamp).to receive(:call).and_return(time) }
|
83
|
+
|
84
|
+
it { expect(build.body).to be_eql(expected_body.to_json) }
|
85
|
+
it { expect(build.method).to eql('GET') }
|
86
|
+
it { expect(build.path).to eql("/v1/#{command.path}") }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when put' do
|
90
|
+
let(:time) { Time.now.utc.iso8601(3) }
|
91
|
+
let(:command) { Castle::Commands::ApproveDevice.build(device_token: '1') }
|
92
|
+
let(:expected_body) { {} }
|
93
|
+
|
94
|
+
before { allow(Castle::Utils::GetTimestamp).to receive(:call).and_return(time) }
|
95
|
+
|
96
|
+
it { expect(build.body).to be_eql(expected_body.to_json) }
|
97
|
+
it { expect(build.method).to eql('PUT') }
|
98
|
+
it { expect(build.path).to eql("/v1/#{command.path}") }
|
99
|
+
end
|
76
100
|
end
|
77
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: castle-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
|
-
rubygems_version: 3.
|
180
|
+
rubygems_version: 3.2.23
|
181
181
|
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: Castle
|