dialog-api 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dialog-api/api/event.rb +23 -0
- data/lib/dialog-api/client.rb +5 -3
- data/lib/dialog-api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b9d7fa748378063343ee7d7f94563c79ae7cccc
|
4
|
+
data.tar.gz: 1465e648f7af211023725ffdd141d679a392b565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03631655e9caddc255ad3cf1f87c76fbd03699f1aa1ee5573252bf9828ffbecba8f3c17f553a3b7da2101e27f56c577527f8f79ee01416e95a3c4186ff53a851
|
7
|
+
data.tar.gz: cc935cc8627b824644dc26971df19a115ec030888780865752f1074d1c1de847cab55ecb47c5b1a59f1d63b1f28540b2a9a271643cb3cd79d1e78b42c13ee200
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Dialog
|
2
|
+
module API
|
3
|
+
module Event
|
4
|
+
|
5
|
+
# Helper method to create an event
|
6
|
+
# @param name [String] Event name
|
7
|
+
# @param name [Float] Unix datetime in milliseconds
|
8
|
+
# @param name [String] Interlocutor tied to the event
|
9
|
+
# @param name [Hash] Event properties
|
10
|
+
# @return [Hash]
|
11
|
+
def event(name, created_at, interlocutor_id, properties)
|
12
|
+
create_event({ name: name, created_at: created_at, interlocutor_id: interlocutor_id, properties: properties })
|
13
|
+
end
|
14
|
+
|
15
|
+
# Creates an event
|
16
|
+
# @param payload [Hash]
|
17
|
+
# @return [Hash]
|
18
|
+
def create_event(payload)
|
19
|
+
post("b/#{bot_id}/events", body: { event: payload })
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/dialog-api/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'dialog-api/request'
|
2
2
|
require 'dialog-api/api/conversation'
|
3
|
+
require 'dialog-api/api/event'
|
3
4
|
require 'dialog-api/api/interlocutor'
|
4
5
|
require 'dialog-api/api/message'
|
5
6
|
require 'dialog-api/api/track'
|
@@ -8,6 +9,7 @@ module Dialog
|
|
8
9
|
class Client
|
9
10
|
include Dialog::Request
|
10
11
|
include Dialog::API::Conversation
|
12
|
+
include Dialog::API::Event
|
11
13
|
include Dialog::API::Interlocutor
|
12
14
|
include Dialog::API::Message
|
13
15
|
include Dialog::API::Track
|
@@ -23,12 +25,12 @@ module Dialog
|
|
23
25
|
end
|
24
26
|
|
25
27
|
# Wraps an url into a trackable Dialog url
|
26
|
-
# @param id [String] A conversation distinct Id provided by the platform or the provider
|
27
28
|
# @param url [String]
|
29
|
+
# @param id [String] An interlocutor distinct Id provided by the platform or the provider
|
28
30
|
# @return [String]
|
29
|
-
def link(
|
31
|
+
def link(url, id)
|
30
32
|
escaped = URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
31
|
-
URI.join(api_endpoint, "v1/
|
33
|
+
URI.join(api_endpoint, "v1/b/", bot_id, "/click/", "?id=#{id}&url=#{escaped}").to_s
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
data/lib/dialog-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dialog-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Dionne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -34,6 +34,7 @@ extra_rdoc_files: []
|
|
34
34
|
files:
|
35
35
|
- lib/dialog-api.rb
|
36
36
|
- lib/dialog-api/api/conversation.rb
|
37
|
+
- lib/dialog-api/api/event.rb
|
37
38
|
- lib/dialog-api/api/interlocutor.rb
|
38
39
|
- lib/dialog-api/api/message.rb
|
39
40
|
- lib/dialog-api/api/track.rb
|