Class: MyInfo::V3::Response
- Inherits:
-
Object
- Object
- MyInfo::V3::Response
- Defined in:
- lib/myinfo/v3/response.rb
Overview
Simple response wrapper
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #exception? ⇒ Boolean
-
#initialize(success:, data:) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(success:, data:) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/myinfo/v3/response.rb', line 9 def initialize(success:, data:) @success = success if data.is_a?(StandardError) @data = data. @exception = true else @data = data @exception = false end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/myinfo/v3/response.rb', line 7 def data @data end |
Instance Method Details
#exception? ⇒ Boolean
21 22 23 |
# File 'lib/myinfo/v3/response.rb', line 21 def exception? @exception end |
#success? ⇒ Boolean
25 26 27 |
# File 'lib/myinfo/v3/response.rb', line 25 def success? @success end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/myinfo/v3/response.rb', line 29 def to_s data end |