qismo 0.8.8 → 0.9.0

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
  SHA256:
3
- metadata.gz: e196e01cac13d44aad35e83f177ee216652905168e7a2a429530ccabe45ecdde
4
- data.tar.gz: 05400a68bed6f50255d058d77faa6e53bc8d84b86d0b1b6c9624481734bf771a
3
+ metadata.gz: dbfbe5dc426f29f2bab1875e42889d559b0fb0936d471343e6dd2088ac1c0cc1
4
+ data.tar.gz: ca61c1154a98b662dbe05b87d6340a5a423b7665908b7ae7baa1f296ff03b8df
5
5
  SHA512:
6
- metadata.gz: 5e5981fd67c309df024443376ed65e782d4f906197a3f40d942388cfa6f0ffc8e00f109a18ad56632cdb76fc60022a6e89a50e2955fd7343e2c20e04736c93d2
7
- data.tar.gz: 88de21e6afd13aa6b88659d686c1f3a316c800d4c18618e886a99002d13a1b29266d1e09b35099dc0d3b21e84ebdb9b17cb3bce8c594bd1c05b507931c8b2e14
6
+ metadata.gz: 58b646f0e706c9193f46f60c6aa31aa1572539bbb098718e75725c6f7b197436a68c52e001b7bc9a46ea4fe04dd258eee8e2fcbe3a656c1364a6375ad231907d
7
+ data.tar.gz: 3d154d41d5a1a763da397b3b245b6087e8a2456028cfdabe32076471956491ca314931c9fc4d5d4340bbd2bd9c1b39281808310b664ad7e934d36ff4cea1dde8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qismo (0.8.7)
4
+ qismo (0.8.8)
5
5
  activesupport
6
6
  http
7
7
 
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(**opt)
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 **opt [Hash]
94
+ # @param opt [Hash]
95
95
  # @return [Qismo::Collection]
96
- def room_broadcast_history(room_id, **opt)
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 **opt [Hash]
115
+ # @param opt [Hash]
116
116
  # @return [Qismo::DataObject]
117
- def assign_agent(room_id, agent_id, **opt)
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 **opt [Hash]
136
+ # @param opt [Hash]
137
137
  # @return [Qismo::DataObject]
138
- def resolve_room(room_id, last_comment_id, **opt)
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 **opt [Hash]
149
+ # @param opt [Hash]
150
150
  # @return [Qismo::DataObject]
151
- def allocate_agent(source, **opt)
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 **opt [Hash]
159
+ # @param opt [Hash]
160
160
  # @return [Qismo::DataObject]
161
- def allocate_and_assign_agent(room_id, **opt)
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 **opt [Hash]
169
+ # @param opt [Hash]
170
170
  # @return [Qismo::Collection]
171
- def other_agents(room_id, **opt)
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 **opt [Hash]
185
+ # @param opt [Hash]
186
186
  # @return [Qismo::Collection]
187
- def available_agents(room_id, **opt)
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 **opt [Hash]
208
+ # @param opt [Hash]
209
209
  # @return [Qismo::DataObject]
210
- def set_new_session_webhook(url, **opt)
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 **opt [Hash]
224
+ # @param opt [Hash]
225
225
  # @return [Qismo::DataObject]
226
- def set_auth_webhook(url, **opt)
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 **opt [Hash]
240
+ # @param opt [Hash]
241
241
  # @return [Qismo::DataObject]
242
- def set_resolve_webhook(url, **opt)
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 **opt [Hash]
248
+ # @param opt [Hash]
249
249
  # @return [Qismo::Collection]
250
- def agents(**opt)
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 **opt [Hash]
281
+ # @param opt [Hash]
282
282
  # @return [Qismo::Collection]
283
- def agents_by_divisions(*division_ids, **opt)
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 **opt [Hash]
319
+ # @param opt [Hash]
320
320
  # @return [Qismo::Collection]
321
- def wa_broadcast_templates(**opt)
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 **opt [Hash]
339
+ # @param opt [Hash]
340
340
  # @return [Qismo::DataObject]
341
- def send_wa_outbound(**opt)
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 **opt [Hash]
358
+ # @param opt [Hash]
359
359
  # @return [Qismo::DataObject]
360
- def send_wa_broadcast(**opt)
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 **opt [Hash]
366
+ # @param opt [Hash]
367
367
  # @return [Qismo::Collection]
368
- def wa_broadcast_jobs(**opt)
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 **opt [Hash]
394
+ # @param opt [Hash]
395
395
  # @return [Qismo::Collection]
396
- def wa_broadcast_logs(broadcast_job_id, **opt)
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 **opt [Hash]
413
+ # @param opt [Hash]
414
414
  # @return [TrueClass]
415
- def send_bot_message(**opt)
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 **opt [Hash]
451
+ # @param opt [Hash]
452
452
  # @return [TrueClass]
453
- def handover_room_from_bot_to_division(room_id, *roles, **opt)
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 **opt [Hash]
462
+ # @param opt [Hash]
463
463
  # @return [Qismo::DataObject]
464
- def initiate_widget_chat(user_id, name, **opt)
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 **opt [Hash]
474
+ # @param opt [Hash]
475
475
  # @return [Qismo::DataObject]
476
- def send_message_to_custom_channel(identifier_key, user_id, name, **opt)
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 **opt [Hash]
32
- def initialize(**opt)
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, **opt)
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
@@ -6,8 +6,8 @@ module Qismo
6
6
  class DataObject
7
7
  # Initiate data object
8
8
  #
9
- # @param **opt [Hash]
10
- def initialize(**opt)
9
+ # @param opt [Hash]
10
+ def initialize(opt = {})
11
11
  opt.each do |key, value|
12
12
  value = if value.is_a?(Array)
13
13
  handle_array(value)
data/lib/qismo/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Qismo
4
4
  # @return [String]
5
- VERSION = "0.8.8"
5
+ VERSION = "0.9.0"
6
6
  end
data/lib/qismo.rb CHANGED
@@ -21,9 +21,9 @@ module Qismo
21
21
 
22
22
  # Initiate Qismo ruby client
23
23
  #
24
- # @param **opt [Hash]
24
+ # @param opt [Hash]
25
25
  # @return [Qismo::Client]
26
- def new(**opt)
26
+ def new(opt = {})
27
27
  @client = Client.new(opt)
28
28
  end
29
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qismo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qiscus Integration