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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb77f5dbba6843230b787b2bfaa39477d5fec3e2
4
- data.tar.gz: 0c302bca907a901c985ee1603975d43967bef8dd
3
+ metadata.gz: 85c6ebe72aa595082ef5159f73424c9788206743
4
+ data.tar.gz: e129d7a0430b5056bfd435fdfe086f0a0682be15
5
5
  SHA512:
6
- metadata.gz: 2ce823953ef28c381109cda44b3c35b2886a9f845618f8e39ac16413226af8c6d89b7ef55039a23a2f4e92950bf03bdd7bb6f013a04c52bdf88dac810e0de2a7
7
- data.tar.gz: 30a26531b31e615310338dc2d0c37f45ca631a1e68621cdb4244fe1109d5ad22fdf02287542b499253f77b9bc0762fe4b107078e717d7106783dc8610333d859
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
@@ -1,4 +1,4 @@
1
1
  module Controls
2
2
  # The version of the Controls gem
3
- VERSION = '1.7.1'
3
+ VERSION = '1.7.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: controls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erran Carey