Class: Transporter::Service
- Inherits:
-
Object
- Object
- Transporter::Service
- Includes:
- Validations
- Defined in:
- lib/transporter/service.rb,
lib/transporter/service/validations.rb
Defined Under Namespace
Modules: Validations
Class Attribute Summary collapse
-
.default_config ⇒ Object
Returns the value of attribute default_config.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #deliver(message) ⇒ Object
-
#initialize(config) ⇒ Service
constructor
A new instance of Service.
Methods included from Validations
#config_errors, included, #valid_config?
Constructor Details
#initialize(config) ⇒ Service
Returns a new instance of Service.
15 16 17 18 |
# File 'lib/transporter/service.rb', line 15 def initialize(config) @config = (self.class.default_config || {}).merge(config) raise TypeError, config_errors unless valid_config?(config) end |
Class Attribute Details
.default_config ⇒ Object
Returns the value of attribute default_config.
8 9 10 |
# File 'lib/transporter/service.rb', line 8 def default_config @default_config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/transporter/service.rb', line 13 def config @config end |
Instance Method Details
#deliver(message) ⇒ Object
20 21 22 |
# File 'lib/transporter/service.rb', line 20 def deliver() raise NotImplementedError, "Please implement this method on your service" end |