Class: EverSdk::NativeLibResponseResult
- Inherits:
-
Object
- Object
- EverSdk::NativeLibResponseResult
- Defined in:
- lib/ever_sdk_client/types.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(result: nil, error: nil) ⇒ NativeLibResponseResult
constructor
A new instance of NativeLibResponseResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(result: nil, error: nil) ⇒ NativeLibResponseResult
Returns a new instance of NativeLibResponseResult.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ever_sdk_client/types.rb', line 23 def initialize(result: nil, error: nil) if !result.nil? && !error.nil? raise ArgumentError.new('only either argument, result or error, should be specified') elsif !result.nil? @result = result elsif !error.nil? @error = SdkError.new( code: error["code"], message: error["message"], data: error["data"] ) else # Some methods like unsubscribe will trigger this error. Should be refactored raise ArgumentError.new('some arguments are wrong; provide either result or error') end self end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
21 22 23 |
# File 'lib/ever_sdk_client/types.rb', line 21 def error @error end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
21 22 23 |
# File 'lib/ever_sdk_client/types.rb', line 21 def result @result end |
Instance Method Details
#failure? ⇒ Boolean
43 |
# File 'lib/ever_sdk_client/types.rb', line 43 def failure? = !@error.nil? |
#success? ⇒ Boolean
42 |
# File 'lib/ever_sdk_client/types.rb', line 42 def success? = !@result.nil? |