Class: Webhookr::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookr/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_name, options = {}) ⇒ Service

Returns a new instance of Service.



5
6
7
8
9
10
# File 'lib/webhookr/service.rb', line 5

def initialize(service_name, options = {})
  @service_name = (service_name || "").downcase
  @raw_payload = options[:payload]
  available?
  validate_security_token(options[:security_token]) if configured_security_token
end

Instance Attribute Details

#service_nameObject (readonly)

Returns the value of attribute service_name.



3
4
5
# File 'lib/webhookr/service.rb', line 3

def service_name
  @service_name
end

Instance Method Details

#process!Object



12
13
14
15
16
# File 'lib/webhookr/service.rb', line 12

def process!
  Array.wrap(service_adapter.send(:process, @raw_payload)).each do |payload|
    callback(callback_class, payload)
  end
end