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.
8 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 8 def initialize(success: nil, data: nil, error: nil) = super |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data
7 8 9 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 7 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error
7 8 9 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 7 def error @error end |
#success ⇒ Object (readonly)
Returns the value of attribute success
7 8 9 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 7 def success @success end |
Class Method Details
.fail(error) ⇒ Object
16 17 18 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 16 def self.fail(error) new(success: false, data: nil, error: error) end |
.ok(data) ⇒ Object
12 13 14 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 12 def self.ok(data) new(success: true, data: data, error: nil) end |
Instance Method Details
#failure? ⇒ Boolean
10 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 10 def failure? = !success |
#success? ⇒ Boolean
9 |
# File 'app/services/edi/amazon/listing_message_processor.rb', line 9 def success? = success |