test-pack-1 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +872 -0
  4. data/lib/test_pack_1.rb +63 -0
  5. data/lib/test_pack_1/api_helper.rb +275 -0
  6. data/lib/test_pack_1/configuration.rb +63 -0
  7. data/lib/test_pack_1/controllers/alerts_controller.rb +381 -0
  8. data/lib/test_pack_1/controllers/assets_controller.rb +227 -0
  9. data/lib/test_pack_1/controllers/base_controller.rb +51 -0
  10. data/lib/test_pack_1/controllers/configuration_data_controller.rb +76 -0
  11. data/lib/test_pack_1/controllers/data_controller.rb +349 -0
  12. data/lib/test_pack_1/controllers/statuses_controller.rb +215 -0
  13. data/lib/test_pack_1/exceptions/api_exception.rb +20 -0
  14. data/lib/test_pack_1/http/auth/custom_query_auth.rb +16 -0
  15. data/lib/test_pack_1/http/faraday_client.rb +64 -0
  16. data/lib/test_pack_1/http/http_call_back.rb +24 -0
  17. data/lib/test_pack_1/http/http_client.rb +104 -0
  18. data/lib/test_pack_1/http/http_context.rb +20 -0
  19. data/lib/test_pack_1/http/http_method_enum.rb +13 -0
  20. data/lib/test_pack_1/http/http_request.rb +50 -0
  21. data/lib/test_pack_1/http/http_response.rb +23 -0
  22. data/lib/test_pack_1/models/aggregate_mode_enum.rb +23 -0
  23. data/lib/test_pack_1/models/alert_item.rb +104 -0
  24. data/lib/test_pack_1/models/base_model.rb +36 -0
  25. data/lib/test_pack_1/models/calculation_mode_enum.rb +20 -0
  26. data/lib/test_pack_1/models/client_configuration.rb +62 -0
  27. data/lib/test_pack_1/models/configuration_item.rb +55 -0
  28. data/lib/test_pack_1/models/data_item.rb +92 -0
  29. data/lib/test_pack_1/models/data_per_category_item.rb +82 -0
  30. data/lib/test_pack_1/models/data_per_category_response.rb +63 -0
  31. data/lib/test_pack_1/models/data_real_time_item.rb +83 -0
  32. data/lib/test_pack_1/models/data_signal.rb +53 -0
  33. data/lib/test_pack_1/models/data_signal_configuration.rb +66 -0
  34. data/lib/test_pack_1/models/data_signal_item.rb +62 -0
  35. data/lib/test_pack_1/models/device.rb +208 -0
  36. data/lib/test_pack_1/models/device_model.rb +53 -0
  37. data/lib/test_pack_1/models/metadata_field.rb +44 -0
  38. data/lib/test_pack_1/models/power_curve.rb +60 -0
  39. data/lib/test_pack_1/models/power_curve_value.rb +44 -0
  40. data/lib/test_pack_1/models/resolution_enum.rb +41 -0
  41. data/lib/test_pack_1/models/site.rb +44 -0
  42. data/lib/test_pack_1/models/site_with_data.rb +78 -0
  43. data/lib/test_pack_1/models/status_category_enum.rb +26 -0
  44. data/lib/test_pack_1/models/status_item.rb +161 -0
  45. data/lib/test_pack_1/models/time_zone_configuration.rb +76 -0
  46. data/lib/test_pack_1/models/turbine_type.rb +89 -0
  47. data/lib/test_pack_1/test_pack1_client.rb +51 -0
  48. data/test/controllers/controller_test_base.rb +33 -0
  49. data/test/controllers/test_assets_controller.rb +46 -0
  50. data/test/controllers/test_configuration_data_controller.rb +44 -0
  51. data/test/http_response_catcher.rb +20 -0
  52. data/test/test_helper.rb +99 -0
  53. metadata +219 -0
@@ -0,0 +1,53 @@
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 device model information.
8
+ class DeviceModel < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Integer]
11
+ attr_accessor :device_model_id
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :manufacturer
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :model
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['device_model_id'] = 'deviceModelId'
25
+ @_hash['manufacturer'] = 'manufacturer'
26
+ @_hash['model'] = 'model'
27
+ @_hash
28
+ end
29
+
30
+ def initialize(device_model_id = nil,
31
+ manufacturer = nil,
32
+ model = nil)
33
+ @device_model_id = device_model_id
34
+ @manufacturer = manufacturer
35
+ @model = model
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
+ device_model_id = hash['deviceModelId']
44
+ manufacturer = hash['manufacturer']
45
+ model = hash['model']
46
+
47
+ # Create object from extracted values.
48
+ DeviceModel.new(device_model_id,
49
+ manufacturer,
50
+ model)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,44 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # A metadata field.
8
+ class MetadataField < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :key
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :value
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['key'] = 'key'
21
+ @_hash['value'] = 'value'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(key = nil,
26
+ value = nil)
27
+ @key = key
28
+ @value = value
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ key = hash['key']
37
+ value = hash['value']
38
+
39
+ # Create object from extracted values.
40
+ MetadataField.new(key,
41
+ value)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,60 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # PowerCurve Model.
8
+ class PowerCurve < BaseModel
9
+ # The id of a device.
10
+ # @return [Integer]
11
+ attr_accessor :device_id
12
+
13
+ # The title of the power curve.
14
+ # @return [String]
15
+ attr_accessor :title
16
+
17
+ # The title of the power curve.
18
+ # @return [List of PowerCurveValue]
19
+ attr_accessor :values
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['device_id'] = 'deviceId'
25
+ @_hash['title'] = 'title'
26
+ @_hash['values'] = 'values'
27
+ @_hash
28
+ end
29
+
30
+ def initialize(device_id = nil,
31
+ title = nil,
32
+ values = nil)
33
+ @device_id = device_id
34
+ @title = title
35
+ @values = values
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
+ device_id = hash['deviceId']
44
+ title = hash['title']
45
+ # Parameter is an array, so we need to iterate through it
46
+ values = nil
47
+ unless hash['values'].nil?
48
+ values = []
49
+ hash['values'].each do |structure|
50
+ values << (PowerCurveValue.from_hash(structure) if structure)
51
+ end
52
+ end
53
+
54
+ # Create object from extracted values.
55
+ PowerCurve.new(device_id,
56
+ title,
57
+ values)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,44 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # The power at a specific wind speed according to a power curve.
8
+ class PowerCurveValue < BaseModel
9
+ # Wind speed in m/s
10
+ # @return [Float]
11
+ attr_accessor :wind_speed
12
+
13
+ # Power in kW
14
+ # @return [Float]
15
+ attr_accessor :power
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['wind_speed'] = 'windSpeed'
21
+ @_hash['power'] = 'power'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(wind_speed = nil,
26
+ power = nil)
27
+ @wind_speed = wind_speed
28
+ @power = power
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ wind_speed = hash['windSpeed']
37
+ power = hash['power']
38
+
39
+ # Create object from extracted values.
40
+ PowerCurveValue.new(wind_speed,
41
+ power)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,41 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # The resolution for time-series data.
8
+ class ResolutionEnum
9
+ RESOLUTION_ENUM = [
10
+ # TODO: Write general description for ENUM_5MINUTE
11
+ ENUM_5MINUTE = '5minute'.freeze,
12
+
13
+ # TODO: Write general description for ENUM_10MINUTE
14
+ ENUM_10MINUTE = '10minute'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_15MINUTE
17
+ ENUM_15MINUTE = '15minute'.freeze,
18
+
19
+ # TODO: Write general description for HOURLY
20
+ HOURLY = 'hourly'.freeze,
21
+
22
+ # TODO: Write general description for DAILY
23
+ DAILY = 'daily'.freeze,
24
+
25
+ # TODO: Write general description for WEEKLY
26
+ WEEKLY = 'weekly'.freeze,
27
+
28
+ # TODO: Write general description for MONTHLY
29
+ MONTHLY = 'monthly'.freeze,
30
+
31
+ # TODO: Write general description for YEARLY
32
+ YEARLY = 'yearly'.freeze,
33
+
34
+ # TODO: Write general description for INTERVAL
35
+ INTERVAL = 'interval'.freeze,
36
+
37
+ # TODO: Write general description for DEVICE
38
+ DEVICE = 'device'.freeze
39
+ ].freeze
40
+ end
41
+ end
@@ -0,0 +1,44 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # Site Model.
8
+ class Site < BaseModel
9
+ # The id of a site.
10
+ # @return [Integer]
11
+ attr_accessor :site_id
12
+
13
+ # The id of a site.
14
+ # @return [String]
15
+ attr_accessor :title
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['site_id'] = 'siteId'
21
+ @_hash['title'] = 'title'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(site_id = nil,
26
+ title = nil)
27
+ @site_id = site_id
28
+ @title = title
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ site_id = hash['siteId']
37
+ title = hash['title']
38
+
39
+ # Create object from extracted values.
40
+ Site.new(site_id,
41
+ title)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,78 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # SiteWithData Model.
8
+ class SiteWithData < BaseModel
9
+ # The id of a site.
10
+ # @return [Integer]
11
+ attr_accessor :site_id
12
+
13
+ # The id of a site.
14
+ # @return [String]
15
+ attr_accessor :title
16
+
17
+ # The id of a site.
18
+ # @return [String]
19
+ attr_accessor :country
20
+
21
+ # The id of a site.
22
+ # @return [String]
23
+ attr_accessor :identity
24
+
25
+ # A list of metadata fields and their values.
26
+ # @return [List of MetadataField]
27
+ attr_accessor :metadata
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['site_id'] = 'siteId'
33
+ @_hash['title'] = 'title'
34
+ @_hash['country'] = 'country'
35
+ @_hash['identity'] = 'identity'
36
+ @_hash['metadata'] = 'metadata'
37
+ @_hash
38
+ end
39
+
40
+ def initialize(site_id = nil,
41
+ title = nil,
42
+ country = nil,
43
+ identity = nil,
44
+ metadata = nil)
45
+ @site_id = site_id
46
+ @title = title
47
+ @country = country
48
+ @identity = identity
49
+ @metadata = metadata
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ site_id = hash['siteId']
58
+ title = hash['title']
59
+ country = hash['country']
60
+ identity = hash['identity']
61
+ # Parameter is an array, so we need to iterate through it
62
+ metadata = nil
63
+ unless hash['metadata'].nil?
64
+ metadata = []
65
+ hash['metadata'].each do |structure|
66
+ metadata << (MetadataField.from_hash(structure) if structure)
67
+ end
68
+ end
69
+
70
+ # Create object from extracted values.
71
+ SiteWithData.new(site_id,
72
+ title,
73
+ country,
74
+ identity,
75
+ metadata)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,26 @@
1
+ # test_pack_1
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0 (
4
+ # https://apimatic.io ).
5
+
6
+ module TestPack1
7
+ # The category a status belongs to.
8
+ class StatusCategoryEnum
9
+ STATUS_CATEGORY_ENUM = [
10
+ # TODO: Write general description for STOP
11
+ STOP = 'stop'.freeze,
12
+
13
+ # TODO: Write general description for WARNING
14
+ WARNING = 'warning'.freeze,
15
+
16
+ # TODO: Write general description for INFORMATIONAL
17
+ INFORMATIONAL = 'informational'.freeze,
18
+
19
+ # TODO: Write general description for COMMUNICATION
20
+ COMMUNICATION = 'communication'.freeze,
21
+
22
+ # TODO: Write general description for CURTAILMENT
23
+ CURTAILMENT = 'curtailment'.freeze
24
+ ].freeze
25
+ end
26
+ end
@@ -0,0 +1,161 @@
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
+ # A status that may contain statuses of the same type as sub-statuses. Note
9
+ # that for sub-statuses the fields `categoryIec`, `categoryContract`, and
10
+ # `subStatus` will always be null.
11
+ class StatusItem < BaseModel
12
+ # The id of the device affected by the status.
13
+ # @return [Integer]
14
+ attr_accessor :device_id
15
+
16
+ # The timestamp when the status began. The timestamp is in your
17
+ # system-configured time zone without UTC offset.
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp_start
20
+
21
+ # The timestamp when the status ended. The timestamp is in your
22
+ # system-configured time zone without UTC offset.
23
+ # @return [DateTime]
24
+ attr_accessor :timestamp_end
25
+
26
+ # Indicates whether the status has a duration.
27
+ # @return [Boolean]
28
+ attr_accessor :has_timestamp_end
29
+
30
+ # The category a status belongs to.
31
+ # @return [StatusCategoryEnum]
32
+ attr_accessor :category
33
+
34
+ # The status code.
35
+ # @return [Float]
36
+ attr_accessor :code
37
+
38
+ # A description of the status code.
39
+ # @return [String]
40
+ attr_accessor :message
41
+
42
+ # A user comment associated with the status.
43
+ # @return [String]
44
+ attr_accessor :comment
45
+
46
+ # The lost production in kWh associated with the status. This field
47
+ # will be null if the caller is not authorized for the system-configured
48
+ # lost production signal. The configured lost production signal is available
49
+ # via the `/configuration.json` endpoint (`DataSignalConfiguration` schema).
50
+ # @return [Float]
51
+ attr_accessor :lost_production
52
+
53
+ # The status category as defined by the IEC.
54
+ # @return [String]
55
+ attr_accessor :category_iec
56
+
57
+ # The status category as defined the availability contract assigned to the
58
+ # site.
59
+ # @return [Object]
60
+ attr_accessor :category_contract
61
+
62
+ # Statuses of the same type that have been grouped under this status.
63
+ # @return [List of StatusItem]
64
+ attr_accessor :sub_status
65
+
66
+ # Indicates whether the status has been acknowledged.
67
+ # @return [Boolean]
68
+ attr_accessor :acknowledged
69
+
70
+ # A mapping from model property names to API property names.
71
+ def self.names
72
+ @_hash = {} if @_hash.nil?
73
+ @_hash['device_id'] = 'deviceId'
74
+ @_hash['timestamp_start'] = 'timestampStart'
75
+ @_hash['timestamp_end'] = 'timestampEnd'
76
+ @_hash['has_timestamp_end'] = 'hasTimestampEnd'
77
+ @_hash['category'] = 'category'
78
+ @_hash['code'] = 'code'
79
+ @_hash['message'] = 'message'
80
+ @_hash['comment'] = 'comment'
81
+ @_hash['lost_production'] = 'lostProduction'
82
+ @_hash['category_iec'] = 'categoryIec'
83
+ @_hash['category_contract'] = 'categoryContract'
84
+ @_hash['sub_status'] = 'subStatus'
85
+ @_hash['acknowledged'] = 'acknowledged'
86
+ @_hash
87
+ end
88
+
89
+ def initialize(device_id = nil,
90
+ timestamp_start = nil,
91
+ timestamp_end = nil,
92
+ has_timestamp_end = nil,
93
+ category = nil,
94
+ code = nil,
95
+ message = nil,
96
+ comment = nil,
97
+ lost_production = nil,
98
+ category_iec = nil,
99
+ category_contract = nil,
100
+ sub_status = nil,
101
+ acknowledged = nil)
102
+ @device_id = device_id
103
+ @timestamp_start = timestamp_start
104
+ @timestamp_end = timestamp_end
105
+ @has_timestamp_end = has_timestamp_end
106
+ @category = category
107
+ @code = code
108
+ @message = message
109
+ @comment = comment
110
+ @lost_production = lost_production
111
+ @category_iec = category_iec
112
+ @category_contract = category_contract
113
+ @sub_status = sub_status
114
+ @acknowledged = acknowledged
115
+ end
116
+
117
+ # Creates an instance of the object from a hash.
118
+ def self.from_hash(hash)
119
+ return nil unless hash
120
+
121
+ # Extract variables from the hash.
122
+ device_id = hash['deviceId']
123
+ timestamp_start = APIHelper.rfc3339(hash['timestampStart']) if
124
+ hash['timestampStart']
125
+ timestamp_end = APIHelper.rfc3339(hash['timestampEnd']) if
126
+ hash['timestampEnd']
127
+ has_timestamp_end = hash['hasTimestampEnd']
128
+ category = hash['category']
129
+ code = hash['code']
130
+ message = hash['message']
131
+ comment = hash['comment']
132
+ lost_production = hash['lostProduction']
133
+ category_iec = hash['categoryIec']
134
+ category_contract = hash['categoryContract']
135
+ # Parameter is an array, so we need to iterate through it
136
+ sub_status = nil
137
+ unless hash['subStatus'].nil?
138
+ sub_status = []
139
+ hash['subStatus'].each do |structure|
140
+ sub_status << (StatusItem.from_hash(structure) if structure)
141
+ end
142
+ end
143
+ acknowledged = hash['acknowledged']
144
+
145
+ # Create object from extracted values.
146
+ StatusItem.new(device_id,
147
+ timestamp_start,
148
+ timestamp_end,
149
+ has_timestamp_end,
150
+ category,
151
+ code,
152
+ message,
153
+ comment,
154
+ lost_production,
155
+ category_iec,
156
+ category_contract,
157
+ sub_status,
158
+ acknowledged)
159
+ end
160
+ end
161
+ end