test-pack-1 1.0.0 → 1.0.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -768
  3. data/lib/test_pack_1.rb +2 -30
  4. data/lib/test_pack_1/configuration.rb +5 -17
  5. data/lib/test_pack_1/controllers/simple_calculator_controller.rb +53 -0
  6. data/lib/test_pack_1/models/operation_type_enum.rb +23 -0
  7. data/lib/test_pack_1/test_pack1_client.rb +4 -34
  8. data/test/controllers/test_simple_calculator_controller.rb +33 -0
  9. metadata +6 -64
  10. data/lib/test_pack_1/controllers/alerts_controller.rb +0 -381
  11. data/lib/test_pack_1/controllers/assets_controller.rb +0 -227
  12. data/lib/test_pack_1/controllers/configuration_data_controller.rb +0 -76
  13. data/lib/test_pack_1/controllers/data_controller.rb +0 -349
  14. data/lib/test_pack_1/controllers/statuses_controller.rb +0 -215
  15. data/lib/test_pack_1/http/auth/custom_query_auth.rb +0 -16
  16. data/lib/test_pack_1/models/aggregate_mode_enum.rb +0 -23
  17. data/lib/test_pack_1/models/alert_item.rb +0 -104
  18. data/lib/test_pack_1/models/calculation_mode_enum.rb +0 -20
  19. data/lib/test_pack_1/models/client_configuration.rb +0 -62
  20. data/lib/test_pack_1/models/configuration_item.rb +0 -55
  21. data/lib/test_pack_1/models/data_item.rb +0 -92
  22. data/lib/test_pack_1/models/data_per_category_item.rb +0 -82
  23. data/lib/test_pack_1/models/data_per_category_response.rb +0 -63
  24. data/lib/test_pack_1/models/data_real_time_item.rb +0 -83
  25. data/lib/test_pack_1/models/data_signal.rb +0 -53
  26. data/lib/test_pack_1/models/data_signal_configuration.rb +0 -66
  27. data/lib/test_pack_1/models/data_signal_item.rb +0 -62
  28. data/lib/test_pack_1/models/device.rb +0 -208
  29. data/lib/test_pack_1/models/device_model.rb +0 -53
  30. data/lib/test_pack_1/models/metadata_field.rb +0 -44
  31. data/lib/test_pack_1/models/power_curve.rb +0 -60
  32. data/lib/test_pack_1/models/power_curve_value.rb +0 -44
  33. data/lib/test_pack_1/models/resolution_enum.rb +0 -41
  34. data/lib/test_pack_1/models/site.rb +0 -44
  35. data/lib/test_pack_1/models/site_with_data.rb +0 -78
  36. data/lib/test_pack_1/models/status_category_enum.rb +0 -26
  37. data/lib/test_pack_1/models/status_item.rb +0 -161
  38. data/lib/test_pack_1/models/time_zone_configuration.rb +0 -76
  39. data/lib/test_pack_1/models/turbine_type.rb +0 -89
  40. data/test/controllers/test_assets_controller.rb +0 -46
  41. data/test/controllers/test_configuration_data_controller.rb +0 -44
@@ -1,215 +0,0 @@
1
- # test_pack_1
2
- #
3
- # This file was automatically generated by APIMATIC v2.0 (
4
- # https://apimatic.io ).
5
-
6
- module TestPack1
7
- # StatusesController
8
- class StatusesController < BaseController
9
- @instance = StatusesController.new
10
-
11
- class << self
12
- attr_accessor :instance
13
- end
14
-
15
- def instance
16
- self.class.instance
17
- end
18
-
19
- # Gets active statuses for multiple devices. This request can also be made
20
- # using the POST method, with a JSON request body instead of query
21
- # parameters.
22
- # @param [List of Integer] device_ids Required parameter: Which devices to
23
- # get statuses for.
24
- # @param [List of StatusCategoryEnum] category Optional parameter: Which
25
- # status categories to get statuses for.
26
- # @param [List of String] fields Optional parameter: Which fields to include
27
- # in the response. Valid fields are those defined in the `StatusItem`
28
- # schema. By default all fields are included.
29
- # @param [List of String] sort_by Optional parameter: Which fields to sort
30
- # the response items by. By default the items are sorted by
31
- # timestampStart.
32
- # @param [Boolean] sort_asc Optional parameter: Whether to sort the items in
33
- # ascending order.
34
- # @param [Integer] page_size Optional parameter: The number of items to
35
- # return per page.
36
- # @param [Integer] page Optional parameter: Which page to return when the
37
- # number of items exceed the page size.
38
- # @return List of StatusItem response from the API call
39
- def get_active_statuses(device_ids,
40
- category = nil,
41
- fields = nil,
42
- sort_by = nil,
43
- sort_asc = false,
44
- page_size = 50,
45
- page = 1)
46
- # Prepare query url.
47
- _path_url = '/activestatus.json'
48
- _query_builder = Configuration.get_base_uri
49
- _query_builder << _path_url
50
- _query_builder = APIHelper.append_url_with_query_parameters(
51
- _query_builder,
52
- {
53
- 'deviceIds' => device_ids,
54
- 'category' => category,
55
- 'fields' => fields,
56
- 'sortBy' => sort_by,
57
- 'sortAsc' => sort_asc,
58
- 'pageSize' => page_size,
59
- 'page' => page
60
- },
61
- array_serialization: Configuration.array_serialization
62
- )
63
- _query_url = APIHelper.clean_url _query_builder
64
- # Prepare headers.
65
- _headers = {
66
- 'accept' => 'application/json'
67
- }
68
- # Prepare and execute HttpRequest.
69
- _request = @http_client.get(
70
- _query_url,
71
- headers: _headers
72
- )
73
- CustomQueryAuth.apply(_request)
74
- _context = execute_request(_request)
75
- # Validate response against endpoint and global error codes.
76
- if _context.response.status_code == 400
77
- raise APIException.new(
78
- 'The request cannot be fulfilled due to bad syntax.',
79
- _context
80
- )
81
- elsif _context.response.status_code == 401
82
- raise APIException.new(
83
- 'One of the following: * The request is missing a valid API key. *' \
84
- ' The API key does not authorize access the requested' \
85
- ' data. Devices or data signals can be limited. ',
86
- _context
87
- )
88
- elsif _context.response.status_code == 405
89
- raise APIException.new(
90
- 'The HTTP method is not allowed for the endpoint.',
91
- _context
92
- )
93
- elsif _context.response.status_code == 429
94
- raise APIException.new(
95
- 'The API key has been used in too many requests in a given amount' \
96
- ' of time. The following headers will be set in the' \
97
- ' response: * X-Rate-Limit-Limit - The total number of' \
98
- ' allowed requests for this period. *' \
99
- ' X-Rate-Limit-Remaining - The remaining number of' \
100
- ' requests for this period. * X-Rate-Limit-Reset - The' \
101
- ' number of seconds left until the end of this period. ',
102
- _context
103
- )
104
- end
105
- validate_response(_context)
106
- # Return appropriate response type.
107
- decoded = APIHelper.json_deserialize(_context.response.raw_body)
108
- decoded.map { |element| StatusItem.from_hash(element) }
109
- end
110
-
111
- # Gets statuses for multiple devices during the given time period. This
112
- # request can also be made using the POST method, with a JSON request body
113
- # instead of query parameters.
114
- # @param [List of Integer] device_ids Required parameter: Which devices to
115
- # get statuses for.
116
- # @param [DateTime] timestamp_start Required parameter: The first timestamp
117
- # to get data for. Timestamps ending with 'Z' are treated as UTC. Other
118
- # timestamps are treated as local time in your system-configured time
119
- # zone.
120
- # @param [DateTime] timestamp_end Required parameter: The last timestamp to
121
- # get data for. Timestamps ending with 'Z' are treated as UTC. Other
122
- # timestamps are treated as local time in your system-configured time
123
- # zone.
124
- # @param [List of StatusCategoryEnum] category Optional parameter: Which
125
- # status categories to get statuses for.
126
- # @param [List of String] fields Optional parameter: Which fields to include
127
- # in the response. Valid fields are those defined in the `StatusItem`
128
- # schema. By default all fields are included.
129
- # @param [List of String] sort_by Optional parameter: Which fields to sort
130
- # the response items by. By default the items are sorted by
131
- # timestampStart.
132
- # @param [Boolean] sort_asc Optional parameter: Whether to sort the items in
133
- # ascending order.
134
- # @param [Integer] page_size Optional parameter: The number of items to
135
- # return per page.
136
- # @param [Integer] page Optional parameter: Which page to return when the
137
- # number of items exceed the page size.
138
- # @return List of StatusItem response from the API call
139
- def get_statuses(device_ids,
140
- timestamp_start,
141
- timestamp_end,
142
- category = nil,
143
- fields = nil,
144
- sort_by = nil,
145
- sort_asc = false,
146
- page_size = 50,
147
- page = 1)
148
- # Prepare query url.
149
- _path_url = '/status.json'
150
- _query_builder = Configuration.get_base_uri
151
- _query_builder << _path_url
152
- _query_builder = APIHelper.append_url_with_query_parameters(
153
- _query_builder,
154
- {
155
- 'deviceIds' => device_ids,
156
- 'timestampStart' => timestamp_start,
157
- 'timestampEnd' => timestamp_end,
158
- 'category' => category,
159
- 'fields' => fields,
160
- 'sortBy' => sort_by,
161
- 'sortAsc' => sort_asc,
162
- 'pageSize' => page_size,
163
- 'page' => page
164
- },
165
- array_serialization: Configuration.array_serialization
166
- )
167
- _query_url = APIHelper.clean_url _query_builder
168
- # Prepare headers.
169
- _headers = {
170
- 'accept' => 'application/json'
171
- }
172
- # Prepare and execute HttpRequest.
173
- _request = @http_client.get(
174
- _query_url,
175
- headers: _headers
176
- )
177
- CustomQueryAuth.apply(_request)
178
- _context = execute_request(_request)
179
- # Validate response against endpoint and global error codes.
180
- if _context.response.status_code == 400
181
- raise APIException.new(
182
- 'The request cannot be fulfilled due to bad syntax.',
183
- _context
184
- )
185
- elsif _context.response.status_code == 401
186
- raise APIException.new(
187
- 'One of the following: * The request is missing a valid API key. *' \
188
- ' The API key does not authorize access the requested' \
189
- ' data. Devices or data signals can be limited. ',
190
- _context
191
- )
192
- elsif _context.response.status_code == 405
193
- raise APIException.new(
194
- 'The HTTP method is not allowed for the endpoint.',
195
- _context
196
- )
197
- elsif _context.response.status_code == 429
198
- raise APIException.new(
199
- 'The API key has been used in too many requests in a given amount' \
200
- ' of time. The following headers will be set in the' \
201
- ' response: * X-Rate-Limit-Limit - The total number of' \
202
- ' allowed requests for this period. *' \
203
- ' X-Rate-Limit-Remaining - The remaining number of' \
204
- ' requests for this period. * X-Rate-Limit-Reset - The' \
205
- ' number of seconds left until the end of this period. ',
206
- _context
207
- )
208
- end
209
- validate_response(_context)
210
- # Return appropriate response type.
211
- decoded = APIHelper.json_deserialize(_context.response.raw_body)
212
- decoded.map { |element| StatusItem.from_hash(element) }
213
- end
214
- end
215
- end
@@ -1,16 +0,0 @@
1
- # test_pack_1
2
- #
3
- # This file was automatically generated by APIMATIC v2.0 (
4
- # https://apimatic.io ).
5
-
6
- module TestPack1
7
- # Utility class for custom query_parameter authorization.
8
- class CustomQueryAuth
9
- # Add custom authentication to the request.
10
- # @param [HttpRequest] The HttpRequest object to which authentication will
11
- # be added.
12
- def self.apply(http_request)
13
- http_request.add_query_parameter('apiToken', Configuration.api_token)
14
- end
15
- end
16
- end
@@ -1,23 +0,0 @@
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
@@ -1,104 +0,0 @@
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
@@ -1,20 +0,0 @@
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
@@ -1,62 +0,0 @@
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
@@ -1,55 +0,0 @@
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