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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b070782d9b3a03d9802c08d2bc0d6179be343452
4
- data.tar.gz: 8880abb6b81a843af5446ddbe1c30e7275accdfa
3
+ metadata.gz: 3b9d7fa748378063343ee7d7f94563c79ae7cccc
4
+ data.tar.gz: 1465e648f7af211023725ffdd141d679a392b565
5
5
  SHA512:
6
- metadata.gz: 6b3793f94963a49a91248c135309fa109850d3b226f66466cf82864ee1ffde7604d3130d57c6c3e5933c2d0de27ddb770ec941b50e7400afdac33e2a95d3713a
7
- data.tar.gz: 791c8bca44aa713b8da1d10097085364843b8f02dc8a1716c19a7884b2369a90479968845d82e423de7f53646dc5bffc64c0fcf9f8120db14486aa6365420fd9
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
@@ -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(id, url)
31
+ def link(url, id)
30
32
  escaped = URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
31
- URI.join(api_endpoint, "v1/click/", id, "?url=#{escaped}").to_s
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
@@ -1,3 +1,3 @@
1
1
  module Dialog
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
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.5
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-01-09 00:00:00.000000000 Z
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