chatbase 0.1.4 → 0.1.5

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: cb1e68242eb852896b4470d5342203de4dda832b
4
- data.tar.gz: f205cef1e8b32278dba509ef3efb3fbc24532152
3
+ metadata.gz: '08f9e281187a6216982d233b3e609ab45b5be66d'
4
+ data.tar.gz: 75f294e68d46e5b439d1d19ecb44e86596890c4b
5
5
  SHA512:
6
- metadata.gz: 0d03370431b3dbc850656f361f8dcb5a703288dfeb30ab8bc3c59fea63e31c3b4295e9ddcca3a72deb3e23fe1ee71fd9c4f13690c930ecfddab5d1e172c89c1e
7
- data.tar.gz: 0c0d9b9cb2ae6c3986355963daccce6e0e9cc3749f71fba804e3058da5f3e44a8aaf3e9d3221d5966f2e70ef069b2b1ea9b1646831f030c707d67afc1112ba80
6
+ metadata.gz: a738929c6581ef29dced192b5311fb166839c165e8c4d33f3af9ae61c6d853b3337727e3c6096ec19e68fc41af46c07492efb5f4223f9046c95688786e26855b
7
+ data.tar.gz: d32f0e96023dfa1fa5971a70b30b7a11d58fc8513f4754035d812835fd878e65fed01c908e298b08e303e714597b0c58df005792231a5e6d9adb70148d26713f
data/README.md CHANGED
@@ -50,6 +50,37 @@ response = Chatbase::Message.new.send_message(req_params)
50
50
  {"message_id": "1048441442", "status": 200}
51
51
  ```
52
52
 
53
+ ### Send generic multiple messages at once API
54
+
55
+ ```ruby
56
+ chat_params = {
57
+ messages:[
58
+ {
59
+ platform: "ruby",
60
+ message: "Hello Chatbase message1!",
61
+ version: "1.0",
62
+ type: "agent",
63
+ user_id: "agent-01",
64
+ time_stamp: DateTime.now.strftime('%Q'),
65
+ },
66
+ {
67
+ platform: "ruby",
68
+ message: "Hello Chatbase message2!",
69
+ version: "1.0",
70
+ type: "agent",
71
+ user_id: "agent-01",
72
+ time_stamp: DateTime.now.strftime('%Q'),
73
+ }
74
+ ]
75
+ }
76
+
77
+ response = Chatbase::Message.new.send_messages(chat_params) # messages not message
78
+
79
+ => response.body
80
+
81
+ {"all_succeeded"=>true, "responses"=>[{"message_id"=>1048692001, "status"=>"success"}, {"message_id"=>1048692002, "status"=>"success"}], "status"=>200}
82
+ ```
83
+
53
84
  ### Facebook Message API
54
85
  ```ruby
55
86
  fb_params = {
data/chatbase.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["eugeniu.rtj@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Chatbase.com analytics API.}
13
- spec.description = %q{Chatbase.com analytics client API written in ruby.}
13
+ spec.description = %q{Chatbase.com analytics API client written in ruby.}
14
14
  spec.homepage = "https://github.com/RTJ/chatbase"
15
15
  spec.license = "MIT"
16
16
 
@@ -12,12 +12,38 @@ module Chatbase
12
12
  end
13
13
 
14
14
  def send_message(request_parameters)
15
- http_service.request_post("/api/message", {'api_key': @agent_key}.merge(request_parameters))
15
+ http_service.request_post("/api/message", {api_key: @agent_key}.merge(request_parameters))
16
+ end
17
+
18
+ def send_messages(request_parameters)
19
+ request_parameters[:messages].each do |message|
20
+ message.merge!({'api_key': @agent_key})
21
+ end
22
+ http_service.request_post("/api/messages", request_parameters)
23
+ end
24
+
25
+ def update_message(request_parameters)
26
+ http_service.request_post("api/message/update", request_parameters)
16
27
  end
17
28
 
18
29
  def send_fbmessage(request_parameters)
30
+ http_service.request_post("/api/facebook/send_message?api_key=#{@agent_key}", request_parameters)
31
+ end
32
+
33
+ def send_fbmessages(request_parameters)
34
+ http_service.request_post("/api/facebook/send_message_batch?api_key=#{@agent_key}", request_parameters)
35
+ end
36
+
37
+ def send_received_fbmessage(request_parameters)
19
38
  http_service.request_post("/api/facebook/message_received?api_key=#{@agent_key}", request_parameters)
20
39
  end
40
+
41
+ def send_received_fbmessages(request_parameters)
42
+ http_service.request_post("/api/facebook/message_received_batch?api_key=#{@agent_key}", request_parameters)
43
+ end
21
44
 
45
+ def update_fbmessage(request_parameters, message_id)
46
+ http_service.request_post("/api/facebook/send_message?api_key=#{@agent_key}&message_id=#{@message_id}", request_parameters)
47
+ end
22
48
  end
23
49
  end
@@ -1,3 +1,3 @@
1
1
  module Chatbase
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugeniu Tambur
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.13'
69
- description: Chatbase.com analytics client API written in ruby.
69
+ description: Chatbase.com analytics API client written in ruby.
70
70
  email:
71
71
  - eugeniu.rtj@gmail.com
72
72
  executables: []