webhook_manager 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +14 -4
- data/lib/webhook_manager.rb +4 -3
- data/lib/webhook_manager/globals.rb +1 -0
- data/lib/webhook_manager/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a409506ecbfcdf2f334beab456bbe6f604386d9307a808eed7df0665269c1de
|
4
|
+
data.tar.gz: 5d8332fea7454ae717751bdade1e71ceb7e5f57a7e10a3af583cb1e8c3742b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daf3a1e0cedddde23f8072eb747309cdaab49b1175a58ffb30bdcade8f1e7e30b102f823e0dc82aa17bfbf4a8ffcb3e90117c7e89f1878b124018674a6139b61
|
7
|
+
data.tar.gz: 40c9202e731932e37876f222223033627fc92414aaae957a02d06c322ff080fd56e73d0e421c1e1b6d5f212b0521379d878c5b76eaa450f3d29781efdc16602a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# WebhookManager
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
A gem that integrates the https://gethooky.com API for plain Ruby or Ruby on Rails applications.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,19 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
1. Initialize the class with your Hooky API key:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
client = WebhookManager::Webhook.new(HOOKY_API_KEY)
|
27
|
+
```
|
28
|
+
|
29
|
+
2. Send your webhook
|
30
|
+
|
31
|
+
Note: Payload expect a Ruby Hash. It will be automatically converted to JSON
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
client.trigger!(event_name: "any.event.name", payload: {foo: "bar"})
|
35
|
+
```
|
26
36
|
|
27
37
|
## Development
|
28
38
|
|
data/lib/webhook_manager.rb
CHANGED
@@ -4,6 +4,7 @@ require "faraday"
|
|
4
4
|
require "json"
|
5
5
|
|
6
6
|
require_relative "webhook_manager/version"
|
7
|
+
require_relative "webhook_manager/globals"
|
7
8
|
|
8
9
|
module WebhookManager
|
9
10
|
class Error < StandardError; end
|
@@ -11,9 +12,9 @@ module WebhookManager
|
|
11
12
|
class Webhook
|
12
13
|
attr_accessor :conn
|
13
14
|
|
14
|
-
def initialize(
|
15
|
+
def initialize(api_key)
|
15
16
|
@conn = Faraday::Connection.new(
|
16
|
-
url:
|
17
|
+
url: HOOKY_API,
|
17
18
|
headers: {
|
18
19
|
"Authorization" => "ApiKey #{api_key}",
|
19
20
|
"Content-Type" => "application/json"
|
@@ -60,7 +61,7 @@ module WebhookManager
|
|
60
61
|
elsif res.status == 401
|
61
62
|
raise Error.new("Unauthorized access to the API!")
|
62
63
|
else
|
63
|
-
raise Error.new("Something went wrong calling the hooky API!")
|
64
|
+
raise Error.new("Something went wrong calling the hooky API! #{res.body}")
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
HOOKY_API = "https://app.hooky.me/api/v1".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhook_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luay Bseiso
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- bin/console
|
59
59
|
- bin/setup
|
60
60
|
- lib/webhook_manager.rb
|
61
|
+
- lib/webhook_manager/globals.rb
|
61
62
|
- lib/webhook_manager/version.rb
|
62
63
|
- webhook_manager.gemspec
|
63
64
|
homepage: https://github.com/buttercloud/webhook_manager
|