class ZapierRuby::Base
Attributes
logger[RW]
Private Instance Methods
config()
click to toggle source
# File lib/zapier_ruby/base.rb, line 38 def config ZapierRuby.config end
post_zap(params)
click to toggle source
# File lib/zapier_ruby/base.rb, line 7 def post_zap(params) uri = URI.parse(zap_url) logger.debug(uri) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri, zap_headers) request.body = params.to_json http.request(request) rescue StandardError => err raise ZapierServerError, err end
zap_headers()
click to toggle source
# File lib/zapier_ruby/base.rb, line 23 def zap_headers { "Accept" => " application/json", "Content-Type" => "application/json" } end
zap_url()
click to toggle source
# File lib/zapier_ruby/base.rb, line 30 def zap_url if config.account_id "#{config.base_uri}/#{config.account_id}/#{zap_web_hook_id}/" else "#{config.base_uri}/#{zap_web_hook_id}/" end end
zap_web_hook_id()
click to toggle source
# File lib/zapier_ruby/base.rb, line 19 def zap_web_hook_id @zap_web_hook ||= config.web_hooks[zap_name] end