Class: Transporter::Service

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/transporter/service.rb,
lib/transporter/service/validations.rb

Defined Under Namespace

Modules: Validations

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validations

#config_errors, included, #valid_config?

Constructor Details

#initialize(config) ⇒ Service

Returns a new instance of Service.

Raises:

  • (TypeError)


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_configObject

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

#configObject (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

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/transporter/service.rb', line 20

def deliver(message)
  raise NotImplementedError, "Please implement this method on your service"
end