Class: ZapierRuby::Zapper
- Inherits:
-
Object
- Object
- ZapierRuby::Zapper
- Defined in:
- lib/zapier_ruby/zapper.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#zap_name ⇒ Object
Returns the value of attribute zap_name.
Instance Method Summary collapse
-
#initialize(zap_name, web_hook_id = nil) ⇒ Zapper
constructor
A new instance of Zapper.
- #zap(params = {}) ⇒ Object
Constructor Details
#initialize(zap_name, web_hook_id = nil) ⇒ Zapper
Returns a new instance of Zapper.
5 6 7 8 9 |
# File 'lib/zapier_ruby/zapper.rb', line 5 def initialize(zap_name, web_hook_id=nil) self.zap_name = zap_name self.logger = LoggerDecorator.new(config.enable_logging) @zap_web_hook = web_hook_id if web_hook_id end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/zapier_ruby/zapper.rb', line 3 def logger @logger end |
#zap_name ⇒ Object
Returns the value of attribute zap_name.
3 4 5 |
# File 'lib/zapier_ruby/zapper.rb', line 3 def zap_name @zap_name end |
Instance Method Details
#zap(params = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/zapier_ruby/zapper.rb', line 11 def zap(params={}) unless zap_web_hook_id raise ZapierMisConfiguration, "No zap configured for #{zap_name}. Configured webhooks: #{config.web_hooks.to_s}" end logger.debug "Zapping #{zap_name} with params: #{params.to_s}" post_zap(params) end |