test-pack-1 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +872 -0
- data/lib/test_pack_1.rb +63 -0
- data/lib/test_pack_1/api_helper.rb +275 -0
- data/lib/test_pack_1/configuration.rb +63 -0
- data/lib/test_pack_1/controllers/alerts_controller.rb +381 -0
- data/lib/test_pack_1/controllers/assets_controller.rb +227 -0
- data/lib/test_pack_1/controllers/base_controller.rb +51 -0
- data/lib/test_pack_1/controllers/configuration_data_controller.rb +76 -0
- data/lib/test_pack_1/controllers/data_controller.rb +349 -0
- data/lib/test_pack_1/controllers/statuses_controller.rb +215 -0
- data/lib/test_pack_1/exceptions/api_exception.rb +20 -0
- data/lib/test_pack_1/http/auth/custom_query_auth.rb +16 -0
- data/lib/test_pack_1/http/faraday_client.rb +64 -0
- data/lib/test_pack_1/http/http_call_back.rb +24 -0
- data/lib/test_pack_1/http/http_client.rb +104 -0
- data/lib/test_pack_1/http/http_context.rb +20 -0
- data/lib/test_pack_1/http/http_method_enum.rb +13 -0
- data/lib/test_pack_1/http/http_request.rb +50 -0
- data/lib/test_pack_1/http/http_response.rb +23 -0
- data/lib/test_pack_1/models/aggregate_mode_enum.rb +23 -0
- data/lib/test_pack_1/models/alert_item.rb +104 -0
- data/lib/test_pack_1/models/base_model.rb +36 -0
- data/lib/test_pack_1/models/calculation_mode_enum.rb +20 -0
- data/lib/test_pack_1/models/client_configuration.rb +62 -0
- data/lib/test_pack_1/models/configuration_item.rb +55 -0
- data/lib/test_pack_1/models/data_item.rb +92 -0
- data/lib/test_pack_1/models/data_per_category_item.rb +82 -0
- data/lib/test_pack_1/models/data_per_category_response.rb +63 -0
- data/lib/test_pack_1/models/data_real_time_item.rb +83 -0
- data/lib/test_pack_1/models/data_signal.rb +53 -0
- data/lib/test_pack_1/models/data_signal_configuration.rb +66 -0
- data/lib/test_pack_1/models/data_signal_item.rb +62 -0
- data/lib/test_pack_1/models/device.rb +208 -0
- data/lib/test_pack_1/models/device_model.rb +53 -0
- data/lib/test_pack_1/models/metadata_field.rb +44 -0
- data/lib/test_pack_1/models/power_curve.rb +60 -0
- data/lib/test_pack_1/models/power_curve_value.rb +44 -0
- data/lib/test_pack_1/models/resolution_enum.rb +41 -0
- data/lib/test_pack_1/models/site.rb +44 -0
- data/lib/test_pack_1/models/site_with_data.rb +78 -0
- data/lib/test_pack_1/models/status_category_enum.rb +26 -0
- data/lib/test_pack_1/models/status_item.rb +161 -0
- data/lib/test_pack_1/models/time_zone_configuration.rb +76 -0
- data/lib/test_pack_1/models/turbine_type.rb +89 -0
- data/lib/test_pack_1/test_pack1_client.rb +51 -0
- data/test/controllers/controller_test_base.rb +33 -0
- data/test/controllers/test_assets_controller.rb +46 -0
- data/test/controllers/test_configuration_data_controller.rb +44 -0
- data/test/http_response_catcher.rb +20 -0
- data/test/test_helper.rb +99 -0
- metadata +219 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Represents an Http call in context.
|
8
|
+
class HttpContext
|
9
|
+
attr_accessor :request, :response
|
10
|
+
|
11
|
+
# The constructor.
|
12
|
+
# @param [HttpRequest] An HttpRequest object representing the HTTP request.
|
13
|
+
# @param [HttpResponse] An HttpResponse object representing the HTTP
|
14
|
+
# response.
|
15
|
+
def initialize(request, response)
|
16
|
+
@request = request
|
17
|
+
@response = response
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# HTTP Methods Enumeration.
|
8
|
+
class HttpMethodEnum
|
9
|
+
HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
|
10
|
+
PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
|
11
|
+
DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Represents a single Http Request.
|
8
|
+
class HttpRequest
|
9
|
+
attr_accessor :http_method, :query_url, :headers,
|
10
|
+
:parameters, :username, :password
|
11
|
+
|
12
|
+
# The constructor.
|
13
|
+
# @param [HttpMethodEnum] The HTTP method.
|
14
|
+
# @param [String] The URL to send the request to.
|
15
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
16
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
17
|
+
def initialize(http_method,
|
18
|
+
query_url,
|
19
|
+
headers: {},
|
20
|
+
parameters: {})
|
21
|
+
@http_method = http_method
|
22
|
+
@query_url = query_url
|
23
|
+
@headers = headers
|
24
|
+
@parameters = parameters
|
25
|
+
end
|
26
|
+
|
27
|
+
# Add a header to the HttpRequest.
|
28
|
+
# @param [String] The name of the header.
|
29
|
+
# @param [String] The value of the header.
|
30
|
+
def add_header(name, value)
|
31
|
+
@headers[name] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
# Add a parameter to the HttpRequest.
|
35
|
+
# @param [String] The name of the parameter.
|
36
|
+
# @param [String] The value of the parameter.
|
37
|
+
def add_parameter(name, value)
|
38
|
+
@parameters[name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add a query parameter to the HttpRequest.
|
42
|
+
# @param [String] The name of the query parameter.
|
43
|
+
# @param [String] The value of the query parameter.
|
44
|
+
def add_query_parameter(name, value)
|
45
|
+
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
46
|
+
name => value)
|
47
|
+
@query_url = APIHelper.clean_url(@query_url)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Http response received.
|
8
|
+
class HttpResponse
|
9
|
+
attr_accessor :status_code, :headers, :raw_body
|
10
|
+
|
11
|
+
# The constructor
|
12
|
+
# @param [Integer] The status code returned by the server.
|
13
|
+
# @param [Hash] The headers sent by the server in the response.
|
14
|
+
# @param [String] The raw body of the response.
|
15
|
+
def initialize(status_code,
|
16
|
+
headers,
|
17
|
+
raw_body)
|
18
|
+
@status_code = status_code
|
19
|
+
@headers = headers
|
20
|
+
@raw_body = raw_body
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# How data is aggregated in the asset structure.
|
8
|
+
class AggregateModeEnum
|
9
|
+
AGGREGATE_MODE_ENUM = [
|
10
|
+
# TODO: Write general description for DEVICE
|
11
|
+
DEVICE = 'device'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for DEVICELEVEL
|
14
|
+
DEVICELEVEL = 'deviceLevel'.freeze,
|
15
|
+
|
16
|
+
# TODO: Write general description for SITE
|
17
|
+
SITE = 'site'.freeze,
|
18
|
+
|
19
|
+
# TODO: Write general description for PORTFOLIO
|
20
|
+
PORTFOLIO = 'portfolio'.freeze
|
21
|
+
].freeze
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module TestPack1
|
8
|
+
# An alert generated for a device based on a rule.
|
9
|
+
class AlertItem < BaseModel
|
10
|
+
# The id of the device the alert was generated for.
|
11
|
+
# @return [Integer]
|
12
|
+
attr_accessor :device_id
|
13
|
+
|
14
|
+
# The id of the rule the alert is based on.
|
15
|
+
# @return [Integer]
|
16
|
+
attr_accessor :rule_id
|
17
|
+
|
18
|
+
# The timestamp when the alert began. The timestamp is in your
|
19
|
+
# system-configured time zone without UTC offset.
|
20
|
+
# @return [DateTime]
|
21
|
+
attr_accessor :timestamp_start
|
22
|
+
|
23
|
+
# The timestamp when the alert ended. The timestamp is in your
|
24
|
+
# system-configured time zone without UTC offset.
|
25
|
+
# @return [DateTime]
|
26
|
+
attr_accessor :timestamp_end
|
27
|
+
|
28
|
+
# The title of the rule the alert is based on.
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :message
|
31
|
+
|
32
|
+
# A user comment associated with the alert.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :comment
|
35
|
+
|
36
|
+
# A description explaning the rule the alert is based on.
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :description
|
39
|
+
|
40
|
+
# Additional details for the alert. Note that the structure of this data is
|
41
|
+
# subject to change.
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :details
|
44
|
+
|
45
|
+
# A mapping from model property names to API property names.
|
46
|
+
def self.names
|
47
|
+
@_hash = {} if @_hash.nil?
|
48
|
+
@_hash['device_id'] = 'deviceId'
|
49
|
+
@_hash['rule_id'] = 'ruleId'
|
50
|
+
@_hash['timestamp_start'] = 'timestampStart'
|
51
|
+
@_hash['timestamp_end'] = 'timestampEnd'
|
52
|
+
@_hash['message'] = 'message'
|
53
|
+
@_hash['comment'] = 'comment'
|
54
|
+
@_hash['description'] = 'description'
|
55
|
+
@_hash['details'] = 'details'
|
56
|
+
@_hash
|
57
|
+
end
|
58
|
+
|
59
|
+
def initialize(device_id = nil,
|
60
|
+
rule_id = nil,
|
61
|
+
timestamp_start = nil,
|
62
|
+
timestamp_end = nil,
|
63
|
+
message = nil,
|
64
|
+
comment = nil,
|
65
|
+
description = nil,
|
66
|
+
details = nil)
|
67
|
+
@device_id = device_id
|
68
|
+
@rule_id = rule_id
|
69
|
+
@timestamp_start = timestamp_start
|
70
|
+
@timestamp_end = timestamp_end
|
71
|
+
@message = message
|
72
|
+
@comment = comment
|
73
|
+
@description = description
|
74
|
+
@details = details
|
75
|
+
end
|
76
|
+
|
77
|
+
# Creates an instance of the object from a hash.
|
78
|
+
def self.from_hash(hash)
|
79
|
+
return nil unless hash
|
80
|
+
|
81
|
+
# Extract variables from the hash.
|
82
|
+
device_id = hash['deviceId']
|
83
|
+
rule_id = hash['ruleId']
|
84
|
+
timestamp_start = APIHelper.rfc3339(hash['timestampStart']) if
|
85
|
+
hash['timestampStart']
|
86
|
+
timestamp_end = APIHelper.rfc3339(hash['timestampEnd']) if
|
87
|
+
hash['timestampEnd']
|
88
|
+
message = hash['message']
|
89
|
+
comment = hash['comment']
|
90
|
+
description = hash['description']
|
91
|
+
details = hash['details']
|
92
|
+
|
93
|
+
# Create object from extracted values.
|
94
|
+
AlertItem.new(device_id,
|
95
|
+
rule_id,
|
96
|
+
timestamp_start,
|
97
|
+
timestamp_end,
|
98
|
+
message,
|
99
|
+
comment,
|
100
|
+
description,
|
101
|
+
details)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Base model.
|
8
|
+
class BaseModel
|
9
|
+
# Returns a Hash representation of the current object.
|
10
|
+
def to_hash
|
11
|
+
hash = {}
|
12
|
+
instance_variables.each do |name|
|
13
|
+
value = instance_variable_get(name)
|
14
|
+
name = name[1..-1]
|
15
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
16
|
+
if value.instance_of? Array
|
17
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
18
|
+
elsif value.instance_of? Hash
|
19
|
+
hash[key] = {}
|
20
|
+
value.each do |k, v|
|
21
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
22
|
+
end
|
23
|
+
else
|
24
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
hash
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns a JSON representation of the curent object.
|
31
|
+
def to_json(options = {})
|
32
|
+
hash = to_hash
|
33
|
+
hash.to_json(options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Which operation to use when aggregating data.
|
8
|
+
class CalculationModeEnum
|
9
|
+
CALCULATION_MODE_ENUM = [
|
10
|
+
# TODO: Write general description for AVERAGE
|
11
|
+
AVERAGE = 'average'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for SUM
|
14
|
+
SUM = 'sum'.freeze,
|
15
|
+
|
16
|
+
# TODO: Write general description for COUNTER
|
17
|
+
COUNTER = 'counter'.freeze
|
18
|
+
].freeze
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# General configuration data.
|
8
|
+
class ClientConfiguration < BaseModel
|
9
|
+
# The title of your Greenbyte Platform website.
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :title
|
12
|
+
|
13
|
+
# Your internal customer tag.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :tag
|
16
|
+
|
17
|
+
# Your URL to access the Greenbyte Platform website.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :url_web
|
20
|
+
|
21
|
+
# Your URL to access the Greenbyte Platform API.
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :url_api
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names.
|
26
|
+
def self.names
|
27
|
+
@_hash = {} if @_hash.nil?
|
28
|
+
@_hash['title'] = 'title'
|
29
|
+
@_hash['tag'] = 'tag'
|
30
|
+
@_hash['url_web'] = 'urlWeb'
|
31
|
+
@_hash['url_api'] = 'urlApi'
|
32
|
+
@_hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(title = nil,
|
36
|
+
tag = nil,
|
37
|
+
url_web = nil,
|
38
|
+
url_api = nil)
|
39
|
+
@title = title
|
40
|
+
@tag = tag
|
41
|
+
@url_web = url_web
|
42
|
+
@url_api = url_api
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates an instance of the object from a hash.
|
46
|
+
def self.from_hash(hash)
|
47
|
+
return nil unless hash
|
48
|
+
|
49
|
+
# Extract variables from the hash.
|
50
|
+
title = hash['title']
|
51
|
+
tag = hash['tag']
|
52
|
+
url_web = hash['urlWeb']
|
53
|
+
url_api = hash['urlApi']
|
54
|
+
|
55
|
+
# Create object from extracted values.
|
56
|
+
ClientConfiguration.new(title,
|
57
|
+
tag,
|
58
|
+
url_web,
|
59
|
+
url_api)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# Your configuration data.
|
8
|
+
class ConfigurationItem < BaseModel
|
9
|
+
# General configuration data.
|
10
|
+
# @return [ClientConfiguration]
|
11
|
+
attr_accessor :client
|
12
|
+
|
13
|
+
# your system-configured time zone configuration.
|
14
|
+
# @return [TimeZoneConfiguration]
|
15
|
+
attr_accessor :time_zone
|
16
|
+
|
17
|
+
# Your data signal configuration. These only apply to wind devices.
|
18
|
+
# @return [DataSignalConfiguration]
|
19
|
+
attr_accessor :data_signals
|
20
|
+
|
21
|
+
# A mapping from model property names to API property names.
|
22
|
+
def self.names
|
23
|
+
@_hash = {} if @_hash.nil?
|
24
|
+
@_hash['client'] = 'client'
|
25
|
+
@_hash['time_zone'] = 'timeZone'
|
26
|
+
@_hash['data_signals'] = 'dataSignals'
|
27
|
+
@_hash
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(client = nil,
|
31
|
+
time_zone = nil,
|
32
|
+
data_signals = nil)
|
33
|
+
@client = client
|
34
|
+
@time_zone = time_zone
|
35
|
+
@data_signals = data_signals
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates an instance of the object from a hash.
|
39
|
+
def self.from_hash(hash)
|
40
|
+
return nil unless hash
|
41
|
+
|
42
|
+
# Extract variables from the hash.
|
43
|
+
client = ClientConfiguration.from_hash(hash['client']) if hash['client']
|
44
|
+
time_zone = TimeZoneConfiguration.from_hash(hash['timeZone']) if
|
45
|
+
hash['timeZone']
|
46
|
+
data_signals = DataSignalConfiguration.from_hash(hash['dataSignals']) if
|
47
|
+
hash['dataSignals']
|
48
|
+
|
49
|
+
# Create object from extracted values.
|
50
|
+
ConfigurationItem.new(client,
|
51
|
+
time_zone,
|
52
|
+
data_signals)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# test_pack_1
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module TestPack1
|
7
|
+
# An object containing time-series data for a specific aggregate, data signal
|
8
|
+
# and interval.
|
9
|
+
class DataItem < BaseModel
|
10
|
+
# How data is aggregated in the asset structure.
|
11
|
+
# @return [AggregateModeEnum]
|
12
|
+
attr_accessor :aggregate
|
13
|
+
|
14
|
+
# The id of this aggregate group: device id, site id, or the constant -1 for
|
15
|
+
# portfolio
|
16
|
+
# @return [Integer]
|
17
|
+
attr_accessor :aggregate_id
|
18
|
+
|
19
|
+
# The ids of the devices in this aggregate group.
|
20
|
+
# @return [List of Integer]
|
21
|
+
attr_accessor :device_ids
|
22
|
+
|
23
|
+
# The resolution for time-series data.
|
24
|
+
# @return [ResolutionEnum]
|
25
|
+
attr_accessor :resolution
|
26
|
+
|
27
|
+
# Which operation to use when aggregating data.
|
28
|
+
# @return [CalculationModeEnum]
|
29
|
+
attr_accessor :calculation
|
30
|
+
|
31
|
+
# A data signal.
|
32
|
+
# @return [DataSignal]
|
33
|
+
attr_accessor :data_signal
|
34
|
+
|
35
|
+
# A data signal.
|
36
|
+
# @return [Array<String, Float>]
|
37
|
+
attr_accessor :data
|
38
|
+
|
39
|
+
# A mapping from model property names to API property names.
|
40
|
+
def self.names
|
41
|
+
@_hash = {} if @_hash.nil?
|
42
|
+
@_hash['aggregate'] = 'aggregate'
|
43
|
+
@_hash['aggregate_id'] = 'aggregateId'
|
44
|
+
@_hash['device_ids'] = 'deviceIds'
|
45
|
+
@_hash['resolution'] = 'resolution'
|
46
|
+
@_hash['calculation'] = 'calculation'
|
47
|
+
@_hash['data_signal'] = 'dataSignal'
|
48
|
+
@_hash['data'] = 'data'
|
49
|
+
@_hash
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(aggregate = nil,
|
53
|
+
aggregate_id = nil,
|
54
|
+
device_ids = nil,
|
55
|
+
resolution = nil,
|
56
|
+
calculation = nil,
|
57
|
+
data_signal = nil,
|
58
|
+
data = nil)
|
59
|
+
@aggregate = aggregate
|
60
|
+
@aggregate_id = aggregate_id
|
61
|
+
@device_ids = device_ids
|
62
|
+
@resolution = resolution
|
63
|
+
@calculation = calculation
|
64
|
+
@data_signal = data_signal
|
65
|
+
@data = data
|
66
|
+
end
|
67
|
+
|
68
|
+
# Creates an instance of the object from a hash.
|
69
|
+
def self.from_hash(hash)
|
70
|
+
return nil unless hash
|
71
|
+
|
72
|
+
# Extract variables from the hash.
|
73
|
+
aggregate = hash['aggregate']
|
74
|
+
aggregate_id = hash['aggregateId']
|
75
|
+
device_ids = hash['deviceIds']
|
76
|
+
resolution = hash['resolution']
|
77
|
+
calculation = hash['calculation']
|
78
|
+
data_signal = DataSignal.from_hash(hash['dataSignal']) if
|
79
|
+
hash['dataSignal']
|
80
|
+
data = hash['data']
|
81
|
+
|
82
|
+
# Create object from extracted values.
|
83
|
+
DataItem.new(aggregate,
|
84
|
+
aggregate_id,
|
85
|
+
device_ids,
|
86
|
+
resolution,
|
87
|
+
calculation,
|
88
|
+
data_signal,
|
89
|
+
data)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|