Class: BabySMS::WebHook

Inherits:
Object
  • Object
show all
Defined in:
lib/babysms/web_hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ WebHook

Returns a new instance of WebHook.



5
6
7
# File 'lib/babysms/web_hook.rb', line 5

def initialize(adapter)
  @adapter = adapter
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



3
4
5
# File 'lib/babysms/web_hook.rb', line 3

def adapter
  @adapter
end

Instance Method Details

#end_pointObject

This is the public URL of the webhook



15
16
17
18
19
# File 'lib/babysms/web_hook.rb', line 15

def end_point
  # Remove optional trailing '/' in configuration
  root = BabySMS.web_hook_root.gsub(/\/\z/, '')
  root + mount_point
end

#mount_pointObject

This is where the webhook handler is mounted relative to the Rack application



10
11
12
# File 'lib/babysms/web_hook.rb', line 10

def mount_point
  "/#{adapter.adapter_id}"
end