Class: Integromat::Base
- Inherits:
-
Object
- Object
- Integromat::Base
- Defined in:
- lib/integromat/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #api ⇒ Object
- #api_url ⇒ Object
- #config ⇒ Object
- #hook_path ⇒ Object
- #post_hook(data) ⇒ Object
- #web_hook_id ⇒ Object
Instance Method Details
#api ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/integromat/base.rb', line 13 def api @api ||= ::Faraday.new(url: api_url) do |faraday| faraday.request :json faraday.response :logger, ::Logger.new($stdout), bodies: true faraday.adapter ::Faraday.default_adapter end end |
#api_url ⇒ Object
21 22 23 |
# File 'lib/integromat/base.rb', line 21 def api_url config.base_uri.to_s end |
#config ⇒ Object
29 30 31 |
# File 'lib/integromat/base.rb', line 29 def config Integromat.config end |
#hook_path ⇒ Object
25 26 27 |
# File 'lib/integromat/base.rb', line 25 def hook_path "/#{web_hook_id}" end |
#post_hook(data) ⇒ Object
5 6 7 |
# File 'lib/integromat/base.rb', line 5 def post_hook(data) api.post(hook_path, data) end |
#web_hook_id ⇒ Object
9 10 11 |
# File 'lib/integromat/base.rb', line 9 def web_hook_id @web_hook_id ||= config.web_hooks[hook_ref] end |