dialog-api 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d658c312362d533ec96a86fb7cff064dbce408b7
4
- data.tar.gz: 4bf6f4e4a513a281f2147ea3a9f69be1ce69bef1
3
+ metadata.gz: 90e9f07b1a3ec96316eb4e38d761c99be12efda1
4
+ data.tar.gz: 671e828edfc0f31011dbe42db2dbfee48bf7f21c
5
5
  SHA512:
6
- metadata.gz: 043373de8c07d6cb37efbd41604b8df78bbdde10d9081cc309717c0813ccad8af6807e3b53c50b5f03a8483553cbab6ed7f8cb84cb4589fd41dc50d4f92e0450
7
- data.tar.gz: 8aaeea9d1cce5370e00b0e67aef5ef099c47d0d3c862bf3bbd5fc9a1106ec31d856dcb787ff22375c1cf790935403481c42b50b5851502c3c6fe83e60e0fafd6
6
+ metadata.gz: 5abcc7aa02874e12a48a181cd7f466fd077d5e0c8736f9deb28535015ce1b2e92228f1db90263f77a681a865766249b2d770f58676ef19924d94164c12886be7
7
+ data.tar.gz: f627e7a4e7d4a9cde44fda85ee67e44d9f34ef6e4eefb311a25e613a671ce7a54ec9eec3414eeb2c4c0e1b1f222ebea59e4b70df9aa5744030fecd0d1cc21158
@@ -4,12 +4,11 @@ module Dialog
4
4
 
5
5
  # Helper method to create an event
6
6
  # @param name [String] Event name
7
- # @param created_at [Float] Unix datetime in milliseconds
8
7
  # @param interlocutor_distinct_id [String] Interlocutor distinct Id
9
8
  # @param properties [Hash] Event properties
10
9
  # @return [Hash]
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 })
10
+ def event(name, interlocutor_distinct_id, properties)
11
+ create_event({ name: name, created_at: Time.now.to_f, id: interlocutor_distinct_id, properties: properties })
13
12
  end
14
13
 
15
14
  # Creates an event
@@ -4,7 +4,7 @@ module Dialog
4
4
 
5
5
  # Lists all messages associated to a conversation
6
6
  # @param conversation_id [String] Conversation Id
7
- # @return
7
+ # @return [Array]
8
8
  def messages(conversation_id)
9
9
  get("b/#{bot_id}/conversations/#{conversation_id}/messages")
10
10
  end
@@ -12,7 +12,7 @@ module Dialog
12
12
  # Retrieves a message
13
13
  # @param id [String]
14
14
  # @param conversation_id [String] Conversation Id
15
- # @return
15
+ # @return [Hash]
16
16
  def message(id, conversation_id)
17
17
  get("b/#{bot_id}/conversations/#{conversation_id}/messages/#{id}")
18
18
  end
@@ -1,12 +1,29 @@
1
+ require 'active_support/core_ext/hash/deep_merge'
2
+
1
3
  module Dialog
2
4
  module API
3
5
  module Track
4
6
 
7
+ # @param options [Hash, String] Properties to merge with the track payload
8
+ # @return [Hash]
9
+ def attach(options)
10
+ if options.is_a?(String)
11
+ @context = { message: { name: options }}
12
+ else
13
+ @context = options
14
+ end
15
+ end
16
+
5
17
  # Tracks a message
6
18
  # @param payload [Hash]
7
- # @return
19
+ # @return [Hash]
8
20
  def track(payload)
9
- post("b/#{bot_id}/track", body: payload)
21
+ body = payload.deep_merge(@context || {})
22
+ @context = nil
23
+
24
+ post("b/#{bot_id}/track", body: body)
25
+
26
+ body
10
27
  end
11
28
  end
12
29
  end
@@ -1,3 +1,3 @@
1
1
  module Dialog
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
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.8
4
+ version: 0.0.9
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-16 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  description: Dialog is a conversational analytics platform. See https://dialoganalytics.com
28
42
  for details.
29
43
  email: