controls 1.7.1 → 1.7.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/lib/controls/objects/error.rb +29 -0
- data/lib/controls/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c6ebe72aa595082ef5159f73424c9788206743
|
4
|
+
data.tar.gz: e129d7a0430b5056bfd435fdfe086f0a0682be15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1822309b48a51e05b3433554505f8285988bd57275791cd781e2d9e16a3dd79c5996876b89cae725654f59abfe3861886314b1221afe8e7c5ab434ee7af44bb6
|
7
|
+
data.tar.gz: e270e0d91e19d8e9dd61f67ab7557a3b4cd51fe031e974be22df34a25170c82dd1fba3c7d3a653345c972f84372b0ea608afb7ad958118fbc6b8004b4d66b66b
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Controls
|
2
2
|
# A class under the Controls namespace to wrap API errors
|
3
|
+
#
|
4
|
+
# [review] - subclass Dish::Plate instead of StandardError?
|
3
5
|
class Error < StandardError
|
4
6
|
# @!attribute message
|
5
7
|
# The message related to the error
|
@@ -8,5 +10,32 @@ module Controls
|
|
8
10
|
# @!attribute message
|
9
11
|
# The status code for the error response
|
10
12
|
attr_accessor :status
|
13
|
+
|
14
|
+
def initialize(attributes = {})
|
15
|
+
@__attributes__ = attributes
|
16
|
+
@__attributes__.each do |attribute, value|
|
17
|
+
instance_variable_set(:"@#{attribute}", value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_h
|
22
|
+
@__attributes__
|
23
|
+
end
|
24
|
+
|
25
|
+
def inspect
|
26
|
+
vars = to_h.map do |attribute, value|
|
27
|
+
"#{attribute}: #{value}"
|
28
|
+
end
|
29
|
+
|
30
|
+
"#<#{self.class}: #{vars.join(', ')}>"
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
@message or inspect
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
attr_reader :__attributes__
|
11
40
|
end
|
12
41
|
end
|
data/lib/controls/version.rb
CHANGED