Class: Edi::Amazon::ListingMessageProcessor::Result
- Inherits:
-
Data
- Object
- Data
- Edi::Amazon::ListingMessageProcessor::Result
- Defined in:
- app/services/edi/amazon/listing_message_processor.rb
Overview
Immutable result object for process outcomes
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Class Method Summary collapse
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(success: nil, data: nil, error: nil) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(success: nil, data: nil, error: nil) ⇒ Result
Returns a new instance of Result.
7 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 7 def initialize(success: nil, data: nil, error: nil) = super |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data
6 7 8 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 6 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error
6 7 8 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 6 def error @error end |
#success ⇒ Object (readonly)
Returns the value of attribute success
6 7 8 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 6 def success @success end |
Class Method Details
.fail(error) ⇒ Object
15 16 17 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 15 def self.fail(error) new(success: false, data: nil, error: error) end |
.ok(data) ⇒ Object
11 12 13 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 11 def self.ok(data) new(success: true, data: data, error: nil) end |
Instance Method Details
#failure? ⇒ Boolean
9 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 9 def failure? = !success |
#success? ⇒ Boolean
8 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 8 def success? = success |