Class: Mqttopia::Subscriptions::Services::TestDebug
- Defined in:
- lib/mqttopia/subscriptions/services/test_debug.rb
Defined Under Namespace
Classes: TestDebugInvalidError
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#topic_name ⇒ Object
readonly
Returns the value of attribute topic_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(topic_name:, payload:, options: {}) ⇒ TestDebug
constructor
A new instance of TestDebug.
- #process ⇒ Object
Methods included from Helpers::DataExtractor
#extract_trip_id, #extract_user_id
Constructor Details
#initialize(topic_name:, payload:, options: {}) ⇒ TestDebug
Returns a new instance of TestDebug.
18 19 20 21 22 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 18 def initialize(topic_name:, payload:, options: {}) @topic_name = topic_name @payload = payload = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 13 def end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
13 14 15 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 13 def payload @payload end |
#topic_name ⇒ Object (readonly)
Returns the value of attribute topic_name.
13 14 15 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 13 def topic_name @topic_name end |
Class Method Details
.call(topic, payload, options = {}) ⇒ Object
24 25 26 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 24 def self.call(topic, payload, = {}) new(topic_name: topic, payload: payload, options: ).process end |
Instance Method Details
#process ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/mqttopia/subscriptions/services/test_debug.rb', line 28 def process raise TestDebugInvalidError, errors..to_sentence unless valid? Mqttopia::Serializers::TestDebug.serialize({ topic_name: topic_name, payload: payload }) end |