botmetrics-rb 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -5
- data/lib/botmetrics-rb/version.rb +1 -1
- data/lib/botmetrics.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ba5b37417b450981dc1c20cbc1fce08f94bae2
|
4
|
+
data.tar.gz: c0d606e3e92f79f473be28a3bbeda0b7f83787d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9c84184f3c351748482bebe7d01d236db4320f3d873bb4c6f247f5c78ae314d2052311262ed6a1dbdd36ba8b93f3719319f56a110dd4e65a7c427fd238911e
|
7
|
+
data.tar.gz: 46286a5e0b11525edcb5c6be9e524fd61674ac789debdaffbc26d31d7b09ebd1a1763cba38842671db11bfd1621668c29e73880804278d81d3524c85162da044
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Status](https://travis-ci.org/botmetrics/botmetrics-rb.svg?branch=master)](https
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'botmetrics-rb'
|
15
|
+
gem 'botmetrics-rb', require: 'botmetrics'
|
16
16
|
```
|
17
17
|
|
18
18
|
And then execute:
|
@@ -23,10 +23,40 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
$ gem install botmetrics-rb
|
25
25
|
|
26
|
-
## Usage
|
26
|
+
## Usage (Facebook)
|
27
27
|
|
28
|
-
|
29
|
-
to "Bot Settings" and find out your Bot ID and API Key.
|
28
|
+
Register your Facebook bot with
|
29
|
+
[Botmetrics](https://getbotmetrics.com). Once you have done so, navigate to "Bot Settings" and find out your Bot ID and API Key.
|
30
|
+
|
31
|
+
With that, you can initialize a `BotMetrics::Client`:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
client = BotMetrics::Client.new(api_key: '123', bot_id: '123')
|
35
|
+
```
|
36
|
+
|
37
|
+
Alternatively, you can set the following ENV variables
|
38
|
+
|
39
|
+
- `ENV['BOTMETRICS_API_KEY']`
|
40
|
+
- `ENV['BOTMETRICS_BOT_ID']`
|
41
|
+
|
42
|
+
and initialize a `BotMetrics::Client` with the default ENV variables:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
client = BotMetrics::Client.new
|
46
|
+
```
|
47
|
+
|
48
|
+
### track
|
49
|
+
|
50
|
+
Call the `track` API in the webhook receiver that handles all of your
|
51
|
+
Facebook messages.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
client.track(params)
|
55
|
+
```
|
56
|
+
|
57
|
+
## Usage (Slack)
|
58
|
+
|
59
|
+
Log in to your [BotMetrics](https://getbotmetrics.com) account, navigate to "Bot Settings" and find out your Bot ID and API Key.
|
30
60
|
|
31
61
|
With that, you can initialize a `BotMetrics::Client`:
|
32
62
|
|
@@ -38,7 +68,6 @@ Alternatively, you can set the following ENV variables
|
|
38
68
|
|
39
69
|
- `ENV['BOTMETRICS_API_KEY']`
|
40
70
|
- `ENV['BOTMETRICS_BOT_ID']`
|
41
|
-
- `ENV['BOTMETRICS_API_HOST']`
|
42
71
|
|
43
72
|
and initialize a `BotMetrics::Client` with the default ENV variables:
|
44
73
|
|
data/lib/botmetrics.rb
CHANGED
@@ -48,7 +48,7 @@ module BotMetrics
|
|
48
48
|
raise ArgumentError.new("event is not a valid JSON string or Hash")
|
49
49
|
end
|
50
50
|
|
51
|
-
response = HTTP.auth(api_key).post("#{api_url}/events", params: {event: event_json})
|
51
|
+
response = HTTP.auth(api_key).post("#{api_url}/events", params: {event: event_json, format: 'json'})
|
52
52
|
response.code == 202
|
53
53
|
end
|
54
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botmetrics-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arunthampi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|