dialog-api 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dialog-api/api/conversation.rb +1 -1
- data/lib/dialog-api/api/event.rb +5 -5
- data/lib/dialog-api/api/interlocutor.rb +6 -5
- data/lib/dialog-api/api/message.rb +2 -2
- data/lib/dialog-api/client.rb +1 -1
- data/lib/dialog-api/request.rb +9 -0
- data/lib/dialog-api/version.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: d658c312362d533ec96a86fb7cff064dbce408b7
|
4
|
+
data.tar.gz: 4bf6f4e4a513a281f2147ea3a9f69be1ce69bef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043373de8c07d6cb37efbd41604b8df78bbdde10d9081cc309717c0813ccad8af6807e3b53c50b5f03a8483553cbab6ed7f8cb84cb4589fd41dc50d4f92e0450
|
7
|
+
data.tar.gz: 8aaeea9d1cce5370e00b0e67aef5ef099c47d0d3c862bf3bbd5fc9a1106ec31d856dcb787ff22375c1cf790935403481c42b50b5851502c3c6fe83e60e0fafd6
|
data/lib/dialog-api/api/event.rb
CHANGED
@@ -4,12 +4,12 @@ module Dialog
|
|
4
4
|
|
5
5
|
# Helper method to create an event
|
6
6
|
# @param name [String] Event name
|
7
|
-
# @param
|
8
|
-
# @param
|
9
|
-
# @param
|
7
|
+
# @param created_at [Float] Unix datetime in milliseconds
|
8
|
+
# @param interlocutor_distinct_id [String] Interlocutor distinct Id
|
9
|
+
# @param properties [Hash] Event properties
|
10
10
|
# @return [Hash]
|
11
|
-
def event(name, created_at,
|
12
|
-
create_event({ name: name, created_at: created_at,
|
11
|
+
def event(name, created_at, interlocutor_distinct_id, properties)
|
12
|
+
create_event({ name: name, created_at: created_at, id: interlocutor_distinct_id, properties: properties })
|
13
13
|
end
|
14
14
|
|
15
15
|
# Creates an event
|
@@ -9,17 +9,18 @@ module Dialog
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Retrieves an interlocutor
|
12
|
-
# @param id [String] Interlocutor Id
|
12
|
+
# @param id [String] Interlocutor distinct Id
|
13
13
|
# @return [Hash]
|
14
14
|
def interlocutor(id)
|
15
|
-
get("b/#{bot_id}/interlocutors
|
15
|
+
get("b/#{bot_id}/interlocutors/#{id}")
|
16
16
|
end
|
17
17
|
|
18
|
-
#
|
18
|
+
# Updates an interlocutor
|
19
|
+
# @param id [String] Interlocutor Id
|
19
20
|
# @param payload [Hash]
|
20
21
|
# @return [Hash]
|
21
|
-
def
|
22
|
-
|
22
|
+
def update_interlocutor(id, payload)
|
23
|
+
patch("b/#{bot_id}/interlocutors/#{id}", body: { interlocutor: payload })
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -3,7 +3,7 @@ module Dialog
|
|
3
3
|
module Message
|
4
4
|
|
5
5
|
# Lists all messages associated to a conversation
|
6
|
-
# @param conversation_id [String]
|
6
|
+
# @param conversation_id [String] Conversation Id
|
7
7
|
# @return
|
8
8
|
def messages(conversation_id)
|
9
9
|
get("b/#{bot_id}/conversations/#{conversation_id}/messages")
|
@@ -11,7 +11,7 @@ module Dialog
|
|
11
11
|
|
12
12
|
# Retrieves a message
|
13
13
|
# @param id [String]
|
14
|
-
# @param conversation_id [String]
|
14
|
+
# @param conversation_id [String] Conversation Id
|
15
15
|
# @return
|
16
16
|
def message(id, conversation_id)
|
17
17
|
get("b/#{bot_id}/conversations/#{conversation_id}/messages/#{id}")
|
data/lib/dialog-api/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Dialog
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Wraps an url into a trackable Dialog url
|
28
|
-
# @param url [String]
|
28
|
+
# @param url [String] An URL to redirect the user to
|
29
29
|
# @param id [String] An interlocutor distinct Id provided by the platform or the provider
|
30
30
|
# @return [String]
|
31
31
|
def link(url, id)
|
data/lib/dialog-api/request.rb
CHANGED
@@ -20,6 +20,15 @@ module Dialog
|
|
20
20
|
request(:post, URI.parse(api_endpoint).merge(path), params: params, body: body)
|
21
21
|
end
|
22
22
|
|
23
|
+
# Performs a HTTP Patch request
|
24
|
+
#
|
25
|
+
# @param path [String]
|
26
|
+
# @param params [Hash]
|
27
|
+
# @param body [Hash]
|
28
|
+
def patch(path, params: {}, body: {})
|
29
|
+
request(:patch, URI.parse(api_endpoint).merge(path), params: params, body: body)
|
30
|
+
end
|
31
|
+
|
23
32
|
|
24
33
|
private
|
25
34
|
|
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.8
|
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-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|