qismo 0.8.8 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/qismo/api.rb +43 -43
- data/lib/qismo/client.rb +3 -3
- data/lib/qismo/model.rb +2 -2
- data/lib/qismo/version.rb +1 -1
- data/lib/qismo.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbfbe5dc426f29f2bab1875e42889d559b0fb0936d471343e6dd2088ac1c0cc1
|
4
|
+
data.tar.gz: ca61c1154a98b662dbe05b87d6340a5a423b7665908b7ae7baa1f296ff03b8df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b646f0e706c9193f46f60c6aa31aa1572539bbb098718e75725c6f7b197436a68c52e001b7bc9a46ea4fe04dd258eee8e2fcbe3a656c1364a6375ad231907d
|
7
|
+
data.tar.gz: 3d154d41d5a1a763da397b3b245b6087e8a2456028cfdabe32076471956491ca314931c9fc4d5d4340bbd2bd9c1b39281808310b664ad7e934d36ff4cea1dde8
|
data/Gemfile.lock
CHANGED
data/lib/qismo/api.rb
CHANGED
@@ -6,7 +6,7 @@ module Qismo
|
|
6
6
|
#
|
7
7
|
# @param opt [Hash]
|
8
8
|
# @return [Qismo::Collection]
|
9
|
-
def rooms(
|
9
|
+
def rooms(opt = {})
|
10
10
|
body = post("/api/v2/customer_rooms", opt)
|
11
11
|
Collection.new(
|
12
12
|
body.data.customer_rooms,
|
@@ -91,9 +91,9 @@ module Qismo
|
|
91
91
|
# List Whatsapp broadcast history inside room
|
92
92
|
#
|
93
93
|
# @param room_id [Integer]
|
94
|
-
# @param
|
94
|
+
# @param opt [Hash]
|
95
95
|
# @return [Qismo::Collection]
|
96
|
-
def room_broadcast_history(room_id,
|
96
|
+
def room_broadcast_history(room_id, opt = {})
|
97
97
|
body = get("/api/v2/customer_rooms/#{room_id}/broadcast_history", opt)
|
98
98
|
|
99
99
|
next_page = body.meta.page < body.meta.total_page ? (body.meta.page + 1) : nil
|
@@ -112,9 +112,9 @@ module Qismo
|
|
112
112
|
#
|
113
113
|
# @param room_id [Integer]
|
114
114
|
# @param agent_id [Integer]
|
115
|
-
# @param
|
115
|
+
# @param opt [Hash]
|
116
116
|
# @return [Qismo::DataObject]
|
117
|
-
def assign_agent(room_id, agent_id,
|
117
|
+
def assign_agent(room_id, agent_id, opt = {})
|
118
118
|
body = post("/api/v1/admin/service/assign_agent", opt.merge(room_id: room_id.to_s, agent_id: agent_id))
|
119
119
|
body.data.added_agent
|
120
120
|
end
|
@@ -133,9 +133,9 @@ module Qismo
|
|
133
133
|
#
|
134
134
|
# @param room_id [Integer]
|
135
135
|
# @param last_comment_id [Integer]
|
136
|
-
# @param
|
136
|
+
# @param opt [Hash]
|
137
137
|
# @return [Qismo::DataObject]
|
138
|
-
def resolve_room(room_id, last_comment_id,
|
138
|
+
def resolve_room(room_id, last_comment_id, opt = {})
|
139
139
|
body = post("/api/v1/admin/service/mark_as_resolved",
|
140
140
|
opt.merge(room_id: room_id.to_s, last_comment_id: last_comment_id))
|
141
141
|
body.data.service
|
@@ -146,9 +146,9 @@ module Qismo
|
|
146
146
|
# Get agent that can be assigned to room
|
147
147
|
#
|
148
148
|
# @param source [String]
|
149
|
-
# @param
|
149
|
+
# @param opt [Hash]
|
150
150
|
# @return [Qismo::DataObject]
|
151
|
-
def allocate_agent(source,
|
151
|
+
def allocate_agent(source, opt = {})
|
152
152
|
body = post("/api/v1/admin/service/allocate_agent", opt.merge(source: source))
|
153
153
|
body.data.agent
|
154
154
|
end
|
@@ -156,9 +156,9 @@ module Qismo
|
|
156
156
|
# Get agent that can be allocated to room and automatically assign them
|
157
157
|
#
|
158
158
|
# @param room_id [Integer]
|
159
|
-
# @param
|
159
|
+
# @param opt [Hash]
|
160
160
|
# @return [Qismo::DataObject]
|
161
|
-
def allocate_and_assign_agent(room_id,
|
161
|
+
def allocate_and_assign_agent(room_id, opt = {})
|
162
162
|
body = post("/api/v1/admin/service/allocate_assign_agent", opt.merge(room_id: room_id))
|
163
163
|
body.data.agent
|
164
164
|
end
|
@@ -166,9 +166,9 @@ module Qismo
|
|
166
166
|
# List agents that are not in room and can be assigned to room
|
167
167
|
#
|
168
168
|
# @param room_id [Integer]
|
169
|
-
# @param
|
169
|
+
# @param opt [Hash]
|
170
170
|
# @return [Qismo::Collection]
|
171
|
-
def other_agents(room_id,
|
171
|
+
def other_agents(room_id, opt = {})
|
172
172
|
body = get("/api/v2/admin/service/other_agents", opt.merge(room_id: room_id))
|
173
173
|
Collection.new(
|
174
174
|
body.data.agents,
|
@@ -182,9 +182,9 @@ module Qismo
|
|
182
182
|
# List available agents in room
|
183
183
|
#
|
184
184
|
# @param room_id [Integer]
|
185
|
-
# @param
|
185
|
+
# @param opt [Hash]
|
186
186
|
# @return [Qismo::Collection]
|
187
|
-
def available_agents(room_id,
|
187
|
+
def available_agents(room_id, opt = {})
|
188
188
|
body = get("/api/v2/admin/service/available_agents", opt.merge(room_id: room_id))
|
189
189
|
Collection.new(
|
190
190
|
body.data.agents,
|
@@ -205,9 +205,9 @@ module Qismo
|
|
205
205
|
# Set new session webhook
|
206
206
|
#
|
207
207
|
# @param url [String]
|
208
|
-
# @param
|
208
|
+
# @param opt [Hash]
|
209
209
|
# @return [Qismo::DataObject]
|
210
|
-
def set_new_session_webhook(url,
|
210
|
+
def set_new_session_webhook(url, opt = {})
|
211
211
|
post("/api/v2/app/config/new_session_webhook", opt.merge(url: url)).data.configs
|
212
212
|
end
|
213
213
|
|
@@ -221,9 +221,9 @@ module Qismo
|
|
221
221
|
# Set auth webhook
|
222
222
|
#
|
223
223
|
# @param url [String]
|
224
|
-
# @param
|
224
|
+
# @param opt [Hash]
|
225
225
|
# @return [Qismo::DataObject]
|
226
|
-
def set_auth_webhook(url,
|
226
|
+
def set_auth_webhook(url, opt = {})
|
227
227
|
post("/api/v2/app/config/auth_webhook", opt.merge(url: url)).data.configs
|
228
228
|
end
|
229
229
|
|
@@ -237,17 +237,17 @@ module Qismo
|
|
237
237
|
# Set resolve webhook
|
238
238
|
#
|
239
239
|
# @param url [String]
|
240
|
-
# @param
|
240
|
+
# @param opt [Hash]
|
241
241
|
# @return [Qismo::DataObject]
|
242
|
-
def set_resolve_webhook(url,
|
242
|
+
def set_resolve_webhook(url, opt = {})
|
243
243
|
post("/api/v1/app/webhook/mark_as_resolved", opt.merge(url: url)).data
|
244
244
|
end
|
245
245
|
|
246
246
|
# List agents
|
247
247
|
#
|
248
|
-
# @param
|
248
|
+
# @param opt [Hash]
|
249
249
|
# @return [Qismo::Collection]
|
250
|
-
def agents(
|
250
|
+
def agents(opt = {})
|
251
251
|
if opt[:page].nil? || opt[:page].empty?
|
252
252
|
opt[:page] = 1
|
253
253
|
end
|
@@ -278,9 +278,9 @@ module Qismo
|
|
278
278
|
# List agents by divisions
|
279
279
|
#
|
280
280
|
# @param *division_ids [Array<Integer>]
|
281
|
-
# @param
|
281
|
+
# @param opt [Hash]
|
282
282
|
# @return [Qismo::Collection]
|
283
|
-
def agents_by_divisions(
|
283
|
+
def agents_by_divisions(division_ids, opt = {})
|
284
284
|
body = get("/api/v2/admin/agents/by_division", opt.merge({ "division_ids[]": division_ids }))
|
285
285
|
|
286
286
|
next_page = body.meta.page < body.meta.total_page ? (body.meta.page + 1) : nil
|
@@ -316,9 +316,9 @@ module Qismo
|
|
316
316
|
|
317
317
|
# List WA broadcast templates
|
318
318
|
#
|
319
|
-
# @param
|
319
|
+
# @param opt [Hash]
|
320
320
|
# @return [Qismo::Collection]
|
321
|
-
def wa_broadcast_templates(
|
321
|
+
def wa_broadcast_templates(opt = {})
|
322
322
|
body = get("/api/v3/admin/hsm", opt)
|
323
323
|
|
324
324
|
meta = body.meta
|
@@ -336,9 +336,9 @@ module Qismo
|
|
336
336
|
|
337
337
|
# Send WA outbound message
|
338
338
|
#
|
339
|
-
# @param
|
339
|
+
# @param opt [Hash]
|
340
340
|
# @return [Qismo::DataObject]
|
341
|
-
def send_wa_outbound(
|
341
|
+
def send_wa_outbound(opt = {})
|
342
342
|
post("/api/v3/admin/broadcast/client", opt).data
|
343
343
|
end
|
344
344
|
|
@@ -355,17 +355,17 @@ module Qismo
|
|
355
355
|
|
356
356
|
# Send wa broadcast
|
357
357
|
#
|
358
|
-
# @param
|
358
|
+
# @param opt [Hash]
|
359
359
|
# @return [Qismo::DataObject]
|
360
|
-
def send_wa_broadcast(
|
360
|
+
def send_wa_broadcast(opt = {})
|
361
361
|
post("/api/v3/admin/broadcast/send_broadcast", opt).data.broadcast_job
|
362
362
|
end
|
363
363
|
|
364
364
|
# List wa broadcast jobs
|
365
365
|
#
|
366
|
-
# @param
|
366
|
+
# @param opt [Hash]
|
367
367
|
# @return [Qismo::Collection]
|
368
|
-
def wa_broadcast_jobs(
|
368
|
+
def wa_broadcast_jobs(opt = {})
|
369
369
|
body = get("/api/v2/admin/broadcast_jobs", opt)
|
370
370
|
|
371
371
|
prev_page = body.meta.page > 1 ? (body.meta.meta - 1) : nil
|
@@ -391,9 +391,9 @@ module Qismo
|
|
391
391
|
# List wa broadcast logs
|
392
392
|
#
|
393
393
|
# @param broadcast_job_id [Integer]
|
394
|
-
# @param
|
394
|
+
# @param opt [Hash]
|
395
395
|
# @return [Qismo::Collection]
|
396
|
-
def wa_broadcast_logs(broadcast_job_id,
|
396
|
+
def wa_broadcast_logs(broadcast_job_id, opt = {})
|
397
397
|
body = get("/api/v2/admin/broadcast_logs/#{broadcast_job_id}", opt)
|
398
398
|
|
399
399
|
prev_page = body.meta.page > 1 ? (body.meta.meta - 1) : nil
|
@@ -410,9 +410,9 @@ module Qismo
|
|
410
410
|
|
411
411
|
# Send message as bot
|
412
412
|
#
|
413
|
-
# @param
|
413
|
+
# @param opt [Hash]
|
414
414
|
# @return [TrueClass]
|
415
|
-
def send_bot_message(
|
415
|
+
def send_bot_message(opt = {})
|
416
416
|
post("#{app_id}/bot", opt)
|
417
417
|
true
|
418
418
|
end
|
@@ -448,9 +448,9 @@ module Qismo
|
|
448
448
|
#
|
449
449
|
# @param room_id [Integer]
|
450
450
|
# @param *roles [Array<Integer>]
|
451
|
-
# @param
|
451
|
+
# @param opt [Hash]
|
452
452
|
# @return [TrueClass]
|
453
|
-
def handover_room_from_bot_to_division(room_id,
|
453
|
+
def handover_room_from_bot_to_division(room_id, roles, opt = {})
|
454
454
|
post("/#{app_id}/bot/#{room_id}/hand_over_to_role", opt.merge(roles: roles))
|
455
455
|
true
|
456
456
|
end
|
@@ -459,9 +459,9 @@ module Qismo
|
|
459
459
|
#
|
460
460
|
# @param user_id [String]
|
461
461
|
# @param name [String]
|
462
|
-
# @param
|
462
|
+
# @param opt [Hash]
|
463
463
|
# @return [Qismo::DataObject]
|
464
|
-
def initiate_widget_chat(user_id, name,
|
464
|
+
def initiate_widget_chat(user_id, name, opt = {})
|
465
465
|
opt = opt.merge(app_id: app_id, user_id: user_id, name: name)
|
466
466
|
post("/api/v2/qiscus/initiate_chat", opt).data.customer_room
|
467
467
|
end
|
@@ -471,9 +471,9 @@ module Qismo
|
|
471
471
|
# @param identifier_key [String]
|
472
472
|
# @param user_id [String]
|
473
473
|
# @param name [String]
|
474
|
-
# @param
|
474
|
+
# @param opt [Hash]
|
475
475
|
# @return [Qismo::DataObject]
|
476
|
-
def send_message_to_custom_channel(identifier_key, user_id, name,
|
476
|
+
def send_message_to_custom_channel(identifier_key, user_id, name, opt = {})
|
477
477
|
post("/#{app_id}/api/v2/custom_channel/send",
|
478
478
|
opt.merge(identifier_key: identifier_key, user_id: user_id, name: name)).data
|
479
479
|
end
|
data/lib/qismo/client.rb
CHANGED
@@ -28,8 +28,8 @@ module Qismo
|
|
28
28
|
|
29
29
|
# Initialize client
|
30
30
|
#
|
31
|
-
# @param
|
32
|
-
def initialize(
|
31
|
+
# @param opt [Hash]
|
32
|
+
def initialize(opt = {})
|
33
33
|
DEFAULT_OPTIONS.merge(opt).each do |key, value|
|
34
34
|
instance_variable_set("@#{key}", value)
|
35
35
|
end
|
@@ -72,7 +72,7 @@ module Qismo
|
|
72
72
|
# @param path [String]
|
73
73
|
# @param body [Hash]
|
74
74
|
# @return [Qismo::DataObject]
|
75
|
-
def request(method, path,
|
75
|
+
def request(method, path, opt = {})
|
76
76
|
res = connection.request(method, @url + path, opt.compact)
|
77
77
|
if res.status.success?
|
78
78
|
return DataObject.new(JSON.parse(res.to_s))
|
data/lib/qismo/model.rb
CHANGED
data/lib/qismo/version.rb
CHANGED
data/lib/qismo.rb
CHANGED