xcal-parktronic 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xcal/parktronic.rb +1 -0
- data/lib/xcal/parktronic/generic_response.rb +1 -0
- data/lib/xcal/parktronic/routes/nested/value_groups.rb +25 -0
- data/lib/xcal/parktronic/version.rb +1 -1
- data/spec/lib/xcal/parktronic/routes/nested/value_groups_spec.rb +20 -0
- data/spec/support/api_mock.rb +4 -0
- data/spec/support/fixtures/responses/value_groups.json +9 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01fc8eb4225cf47551484217847f6fee1f32b393
|
4
|
+
data.tar.gz: 09781fbac9dd973934e8e2833521b076b31e9e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61f2c1dd6c88f3d506cc5de27a6598e05f95db899cc066a41d4ecdba83d92794155f95ed34bd412389ff47b8fa5e0b2614ce0746cfc63213e9f2c72809d5dc1c
|
7
|
+
data.tar.gz: 0c0404a134cd905ba3bf51b79ad1c77688f385e9db4078e66ac1f6d375b22daa24f17f00c36cfa2e62cbc0d4b7166898675c35b77cbf46b777c06dd112f501fa
|
data/lib/xcal/parktronic.rb
CHANGED
@@ -18,6 +18,7 @@ require 'xcal/parktronic/routes/custom_queries'
|
|
18
18
|
require 'xcal/parktronic/routes/nested/alarm_actions'
|
19
19
|
require 'xcal/parktronic/routes/nested/metric_values'
|
20
20
|
require 'xcal/parktronic/routes/nested/device_errors'
|
21
|
+
require 'xcal/parktronic/routes/nested/value_groups'
|
21
22
|
require 'xcal/parktronic/routes/outages'
|
22
23
|
require 'xcal/parktronic/routes/stack_changes'
|
23
24
|
require 'xcal/parktronic/routes/event_history_items'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Xcal
|
2
|
+
module Parktronic
|
3
|
+
module Routes
|
4
|
+
module Nested
|
5
|
+
|
6
|
+
module ValueGroups
|
7
|
+
|
8
|
+
# Fetches value_groups for the specific metric
|
9
|
+
# Executed as a method chain from the GenericResponse object
|
10
|
+
#
|
11
|
+
# Call example:
|
12
|
+
# metric(id).get_value_groups
|
13
|
+
def get_value_groups(args = {})
|
14
|
+
args.merge!(:access_token => client.access_token)
|
15
|
+
response = client.get_response("/#{client.api_version}/metrics/#{id}/value_groups?#{URI.encode_www_form(args)}")
|
16
|
+
|
17
|
+
Xcal::Parktronic::GenericResponse.new(response.body, client)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xcal::Parktronic::ApiClient do
|
4
|
+
|
5
|
+
let(:api_http_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://api.mock', access_token: 'access_token') }
|
6
|
+
let(:api_invalid_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://api.mock') }
|
7
|
+
|
8
|
+
context 'metrics route' do
|
9
|
+
|
10
|
+
describe '#get_value_groups' do
|
11
|
+
it 'should return value_groups for metric' do
|
12
|
+
value_groups = nil
|
13
|
+
expect { value_groups = api_http_client.get_metric(7).get_value_groups }.not_to raise_error
|
14
|
+
expect(value_groups.value_groups.size).to eql(5)
|
15
|
+
expect(value_groups.group_types.size).to eql(2)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/spec/support/api_mock.rb
CHANGED
@@ -94,6 +94,10 @@ class ApiMock < Sinatra::Base
|
|
94
94
|
json_response 201, 'metric_post.json'
|
95
95
|
end
|
96
96
|
|
97
|
+
get '/:version/metrics/:id/value_groups' do
|
98
|
+
json_response 200, 'value_groups.json'
|
99
|
+
end
|
100
|
+
|
97
101
|
# Events
|
98
102
|
get '/:version/events' do
|
99
103
|
if params[:page].nil? || params[:page].empty?
|
@@ -0,0 +1,9 @@
|
|
1
|
+
{
|
2
|
+
"value_groups": [
|
3
|
+
{"value_group_id": 1, "group_type": "Location", "group_value": "A"},
|
4
|
+
{"value_group_id": 2, "group_type": "Location", "group_value": "B"},
|
5
|
+
{"value_group_id": 3, "group_type": "Software Stack", "group_value": "1"},
|
6
|
+
{"value_group_id": 4, "group_type": "Software Stack", "group_value": "2"},
|
7
|
+
{"value_group_id": 5, "group_type": "Software Stack", "group_value": "3"}],
|
8
|
+
"group_types": ["Location", "Software Stack"]
|
9
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcal-parktronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitaliy Omelchenko
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-08-
|
13
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hashie
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/xcal/parktronic/routes/nested/device_errors.rb
|
153
153
|
- lib/xcal/parktronic/routes/nested/events.rb
|
154
154
|
- lib/xcal/parktronic/routes/nested/metric_values.rb
|
155
|
+
- lib/xcal/parktronic/routes/nested/value_groups.rb
|
155
156
|
- lib/xcal/parktronic/routes/outages.rb
|
156
157
|
- lib/xcal/parktronic/routes/stack_changes.rb
|
157
158
|
- lib/xcal/parktronic/version.rb
|
@@ -164,6 +165,7 @@ files:
|
|
164
165
|
- spec/lib/xcal/parktronic/routes/metrics_routes_spec.rb
|
165
166
|
- spec/lib/xcal/parktronic/routes/nested/alarm_actions_spec.rb
|
166
167
|
- spec/lib/xcal/parktronic/routes/nested/events_spec.rb
|
168
|
+
- spec/lib/xcal/parktronic/routes/nested/value_groups_spec.rb
|
167
169
|
- spec/lib/xcal/parktronic/routes/outages_routes_spec.rb
|
168
170
|
- spec/lib/xcal/parktronic/routes/stack_changes_routes_spec.rb
|
169
171
|
- spec/spec_helper.rb
|
@@ -196,6 +198,7 @@ files:
|
|
196
198
|
- spec/support/fixtures/responses/stack_changes_page_1.json
|
197
199
|
- spec/support/fixtures/responses/stack_changes_page_2.json
|
198
200
|
- spec/support/fixtures/responses/stack_changes_post.json
|
201
|
+
- spec/support/fixtures/responses/value_groups.json
|
199
202
|
- xcal-parktronic.gemspec
|
200
203
|
homepage: ''
|
201
204
|
licenses:
|
@@ -231,6 +234,7 @@ test_files:
|
|
231
234
|
- spec/lib/xcal/parktronic/routes/metrics_routes_spec.rb
|
232
235
|
- spec/lib/xcal/parktronic/routes/nested/alarm_actions_spec.rb
|
233
236
|
- spec/lib/xcal/parktronic/routes/nested/events_spec.rb
|
237
|
+
- spec/lib/xcal/parktronic/routes/nested/value_groups_spec.rb
|
234
238
|
- spec/lib/xcal/parktronic/routes/outages_routes_spec.rb
|
235
239
|
- spec/lib/xcal/parktronic/routes/stack_changes_routes_spec.rb
|
236
240
|
- spec/spec_helper.rb
|
@@ -263,3 +267,4 @@ test_files:
|
|
263
267
|
- spec/support/fixtures/responses/stack_changes_page_1.json
|
264
268
|
- spec/support/fixtures/responses/stack_changes_page_2.json
|
265
269
|
- spec/support/fixtures/responses/stack_changes_post.json
|
270
|
+
- spec/support/fixtures/responses/value_groups.json
|