dialog-api 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b9d7fa748378063343ee7d7f94563c79ae7cccc
4
- data.tar.gz: 1465e648f7af211023725ffdd141d679a392b565
3
+ metadata.gz: d658c312362d533ec96a86fb7cff064dbce408b7
4
+ data.tar.gz: 4bf6f4e4a513a281f2147ea3a9f69be1ce69bef1
5
5
  SHA512:
6
- metadata.gz: 03631655e9caddc255ad3cf1f87c76fbd03699f1aa1ee5573252bf9828ffbecba8f3c17f553a3b7da2101e27f56c577527f8f79ee01416e95a3c4186ff53a851
7
- data.tar.gz: cc935cc8627b824644dc26971df19a115ec030888780865752f1074d1c1de847cab55ecb47c5b1a59f1d63b1f28540b2a9a271643cb3cd79d1e78b42c13ee200
6
+ metadata.gz: 043373de8c07d6cb37efbd41604b8df78bbdde10d9081cc309717c0813ccad8af6807e3b53c50b5f03a8483553cbab6ed7f8cb84cb4589fd41dc50d4f92e0450
7
+ data.tar.gz: 8aaeea9d1cce5370e00b0e67aef5ef099c47d0d3c862bf3bbd5fc9a1106ec31d856dcb787ff22375c1cf790935403481c42b50b5851502c3c6fe83e60e0fafd6
@@ -9,7 +9,7 @@ module Dialog
9
9
  end
10
10
 
11
11
  # Retrieves a conversation
12
- # @param id [String]
12
+ # @param id [String] Conversation Id
13
13
  # @return [Hash]
14
14
  def conversation(id)
15
15
  get("b/#{bot_id}/conversations/#{id}")
@@ -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 name [Float] Unix datetime in milliseconds
8
- # @param name [String] Interlocutor tied to the event
9
- # @param name [Hash] Event properties
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, interlocutor_id, properties)
12
- create_event({ name: name, created_at: created_at, interlocutor_id: interlocutor_id, properties: properties })
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#{id}")
15
+ get("b/#{bot_id}/interlocutors/#{id}")
16
16
  end
17
17
 
18
- # Creates an interlocutor
18
+ # Updates an interlocutor
19
+ # @param id [String] Interlocutor Id
19
20
  # @param payload [Hash]
20
21
  # @return [Hash]
21
- def create_interlocutor(payload)
22
- post("b/#{bot_id}/interlocutors", body: { interlocutor: payload })
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}")
@@ -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)
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Dialog
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
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.7
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-15 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http