spot-gps 0.2.1 → 0.2.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/CHANGELOG.md +5 -0
- data/lib/spot-gps/api_service.rb +4 -1
- data/lib/spot-gps/services/messages.rb +4 -1
- data/lib/spot-gps/version.rb +1 -1
- data/spec/api_service_spec.rb +11 -0
- data/spec/services/messages_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d8b0903516cfa4fa8380df8b32e4dd8b7b99c48
|
4
|
+
data.tar.gz: 8027a9f30397682700e08ba08697bf4c08fe9105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af5db30f5ca02f4defd81f2bce76f2664b6b2648d2583e15625ca1f3cec59f7edb55fb635199a69518b1bced687281ab90a81c32da5cfbc0d1f7d7b8cd4097e
|
7
|
+
data.tar.gz: c241257559dd44332de8868db7f7c3fbbca5f02258de2bbb8c20075ab5967e775f5f732eed5becbe13dd97e19891de6d8a470c4cda6019d9b34c35cd4b8ae00b
|
data/CHANGELOG.md
CHANGED
data/lib/spot-gps/api_service.rb
CHANGED
@@ -20,7 +20,10 @@ module SPOT
|
|
20
20
|
# Make a GET request to the SPOT API
|
21
21
|
def get(path:, params: {})
|
22
22
|
params ||= {}
|
23
|
-
|
23
|
+
|
24
|
+
if feed_password && !feed_password.empty?
|
25
|
+
params = params.merge(feedPassword: feed_password)
|
26
|
+
end
|
24
27
|
|
25
28
|
response = make_request(:get, path, params)
|
26
29
|
|
@@ -29,7 +29,10 @@ module SPOT
|
|
29
29
|
|
30
30
|
def latest
|
31
31
|
response = get(path: "latest.json")
|
32
|
-
|
32
|
+
unenveloped_body = unenvelope_body(response.body)
|
33
|
+
|
34
|
+
return nil if unenveloped_body.nil?
|
35
|
+
Resources::Message.new(unenveloped_body, response)
|
33
36
|
end
|
34
37
|
|
35
38
|
private
|
data/lib/spot-gps/version.rb
CHANGED
data/spec/api_service_spec.rb
CHANGED
@@ -29,6 +29,17 @@ describe SPOT::ApiService do
|
|
29
29
|
to have_requested(:get, 'https://example.com/EXAMPLE_ID/messages.json').
|
30
30
|
with(query: { feedPassword: 'password' })
|
31
31
|
end
|
32
|
+
|
33
|
+
context 'that is blank' do
|
34
|
+
let(:password) { '' }
|
35
|
+
|
36
|
+
it 'is expected to not include the password in the querystring' do
|
37
|
+
service.get(path: 'messages.json')
|
38
|
+
expect(WebMock).
|
39
|
+
to have_requested(:get, 'https://example.com/EXAMPLE_ID/messages.json').
|
40
|
+
with(query: {})
|
41
|
+
end
|
42
|
+
end
|
32
43
|
end
|
33
44
|
end
|
34
45
|
|
@@ -217,5 +217,17 @@ describe SPOT::Services::Messages do
|
|
217
217
|
|
218
218
|
it { is_expected.to be_a(SPOT::Resources::Message) }
|
219
219
|
its(:response) { is_expected.to be_a(SPOT::ApiResponse) }
|
220
|
+
|
221
|
+
context "with no records" do
|
222
|
+
before do
|
223
|
+
stub_url = SPOT.endpoint + 'EXAMPLE_ID/latest.json'
|
224
|
+
stub_request(:get, stub_url).to_return(
|
225
|
+
body: load_fixture('no_messages.json'),
|
226
|
+
headers: { 'Content-Type' => 'application/json' }
|
227
|
+
)
|
228
|
+
end
|
229
|
+
|
230
|
+
it { is_expected.to be_nil }
|
231
|
+
end
|
220
232
|
end
|
221
233
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spot-gps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grey Baker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webmock
|