zapier_ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +17 -10
- data/lib/zapier_ruby/version.rb +1 -1
- data/lib/zapier_ruby/zapper.rb +2 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2EwNTM5NjRlODUzMzQ5NGQ0MmE1MjdmYjIzMjc0YTQ3NzVhZjdiNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDE2ZmRmYmI3YTBkMzcyYjUzOGFmOTBjODg2NjA2MTljZTUxNDcwZg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2VhOTMwNzYxNTk3NmZkNWRjZTdhNWFmNWFlZjg4YzU2NzFkNDk5NjQzMDll
|
10
|
+
Mzg5MjI5ZjRjYzEzYjQ4ODBhZjUxNjUxY2YxMTk2ZTI2MDZhZTAxZmU3MDM2
|
11
|
+
ZTM5ZDJjZmU2MmRhOTc3OTc3Y2QxZTVjOWE2ZTljYTkxY2Q0Yjg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MDgzMjViN2U3MjUxY2M0ZTAzOTUwZjhmODY3MTRlYTZhNGEwYzE0N2I4NGI1
|
14
|
+
ODI0MzBkYjFjZmQyMzA5ZmM0ZWMzMDdlYjgwNzAwYjBkOGY0OWI3YWFhNjUz
|
15
|
+
M2EwM2JlMjNhZTJlMTEyZTcwNDgzMGMwNDE3Njc5MTU1MjIyNTc=
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# ZapierRuby
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/zapier_ruby.svg)](http://badge.fury.io/rb/zapier_ruby)
|
4
|
+
|
3
5
|
Zapier Ruby provides a simple wrapper to post a 'zap' to a Zapier (https://zapier.com) webhook from any Ruby application. You must first have a Zapier account and have created a webhook configured to 'catch hook'. This gem is useful for simple integrations, such as posting to slack when an event happens in your Rails app, or sending an email when your chef deploy has completed.
|
4
6
|
|
5
7
|
## Installation
|
@@ -21,25 +23,30 @@ Or install it yourself as:
|
|
21
23
|
## Usage
|
22
24
|
|
23
25
|
### General Usage
|
24
|
-
First, configure ZapierRuby. Pass a hash of each of your zap webhooks you would like to integrate, you can also change the uri we post to or disable logging.
|
26
|
+
First, configure ZapierRuby. Pass a hash of each of your zap webhooks you would like to integrate, you can also change the uri we post to or disable logging. Next, Instantiate a Zapper for the webhook to hit. Then, use the `zap` method with hash of params and send it to the Zapier web hook. `zap` returns true if it is able to successfully post the zap.
|
25
27
|
|
26
28
|
```
|
27
|
-
|
29
|
+
require 'rubygems'
|
30
|
+
require 'zapier_ruby'
|
31
|
+
|
32
|
+
ZapierRuby.configure do |c|
|
28
33
|
c.web_hooks = {example_zap: "webhook_id"}
|
29
34
|
c.enable_logging = false
|
30
35
|
end
|
36
|
+
|
37
|
+
zapper = ZapierRuby::Zapper.new(:example_zap)
|
38
|
+
|
39
|
+
if zapper.zap({hello: "world"})
|
40
|
+
puts "zapped it"
|
41
|
+
else
|
42
|
+
puts "it remains unzapped"
|
43
|
+
end
|
31
44
|
```
|
32
45
|
|
33
|
-
You can find the value to fill in for webhook id in the location highlighted below ('xxxxxx' in the green box) when configuring your Zap:
|
46
|
+
You can find the value to fill in for "webhook id" in the location highlighted below ('xxxxxx' in the green box) when configuring your Zap:
|
34
47
|
|
35
48
|
![](https://github.com/pete2786/pete2786.github.io/blob/master/images/finding_webhook.png)
|
36
49
|
|
37
|
-
Next, instantiate a Zapper for the webhook to hit. Then, use the `zap` method with hash of params and send it to the Zapier web hook.
|
38
|
-
|
39
|
-
```
|
40
|
-
zapper=ZapierRuby::Zapper.new(:example_zap)
|
41
|
-
zapper.zap({hello: "world"})
|
42
|
-
```
|
43
50
|
|
44
51
|
Each param you send can be used by Zapier, so include all of the information required to complete the task.
|
45
52
|
|
@@ -58,7 +65,7 @@ If you do not have email configured for you application, you could send an email
|
|
58
65
|
```
|
59
66
|
class User < ActiveRecord::Base
|
60
67
|
after_create :welcome_new_user
|
61
|
-
|
68
|
+
|
62
69
|
def welcome_new_user
|
63
70
|
ZapierRuby::Zapper.new(:welcome_new_user).zap(user.attributes)
|
64
71
|
end
|
data/lib/zapier_ruby/version.rb
CHANGED
data/lib/zapier_ruby/zapper.rb
CHANGED
@@ -13,7 +13,7 @@ module ZapierRuby
|
|
13
13
|
return false
|
14
14
|
end
|
15
15
|
|
16
|
-
logger.info "Zapping #{zap_name} with params: #{params.
|
16
|
+
logger.info "Zapping #{zap_name} with params: #{params.to_s}"
|
17
17
|
post_zap(params)
|
18
18
|
end
|
19
19
|
|
@@ -22,7 +22,7 @@ module ZapierRuby
|
|
22
22
|
rest_client.post(params, zap_headers)
|
23
23
|
true
|
24
24
|
rescue Exception => e
|
25
|
-
logger.error "Unable to post to Zapier url: #{zap_url} with params: #{params.
|
25
|
+
logger.error "Unable to post to Zapier url: #{zap_url} with params: #{params.to_s}. Error: #{e.message}"
|
26
26
|
false
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zapier_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Peterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rest-client
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Simple gem to integrate Zapier webhooks with a Ruby project.
|
@@ -59,7 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
-
|
62
|
+
- .gitignore
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
@@ -80,17 +80,17 @@ require_paths:
|
|
80
80
|
- lib
|
81
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ! '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.2.2
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Simple gem to integrate Zapier webhooks with a Ruby project.
|