crisp-api 1.1.10 → 1.1.12
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 +4 -4
- data/.github/workflows/build.yml +6 -1
- data/EXAMPLES.md +17 -2
- data/README.md +19 -4
- data/crisp-api.gemspec +1 -1
- data/lib/crisp-api.rb +1 -1
- data/lib/resources/website.rb +42 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2a58efb0f1724208bdaafc199d5d3a2e7a7e414d92f633a439a76fcb137c70c
|
4
|
+
data.tar.gz: d69db7101c6076cc3ca4a3ab36a805919bb13cc1dae8e5340678103e6780a765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 682305e208688c767aaf2732eb95fe9ccf20656e8c3cc6d832bb619d5fa6f73f6cf287abff3cd027234f1ae0c74102bc96190fc0322d12cad4b9491f42e69ae3
|
7
|
+
data.tar.gz: '029b2f184d2e21cf058d756dbb2124d6904db79aa0a0649c7b250f0e4f8a9f67d89afd362d513bb3950ce4ad63ba2cfbd0f7833e9d42f6793ad8d110ff14c756'
|
data/.github/workflows/build.yml
CHANGED
@@ -8,6 +8,11 @@ name: Build and Release
|
|
8
8
|
jobs:
|
9
9
|
release:
|
10
10
|
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ["2.7", "3.0", "3.1", "3.2"]
|
15
|
+
|
11
16
|
steps:
|
12
17
|
- name: Checkout
|
13
18
|
id: checkout
|
@@ -17,7 +22,7 @@ jobs:
|
|
17
22
|
id: install_ruby
|
18
23
|
uses: ruby/setup-ruby@v1
|
19
24
|
with:
|
20
|
-
ruby-version:
|
25
|
+
ruby-version: ${{ matrix.ruby-version }}
|
21
26
|
|
22
27
|
- name: Install dependencies
|
23
28
|
id: install_dependencies
|
data/EXAMPLES.md
CHANGED
@@ -65,6 +65,10 @@ https://docs.crisp.chat/references/rest-api/v1/#get-messages-in-conversation
|
|
65
65
|
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
66
66
|
session_id = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
|
67
67
|
|
68
|
+
query = {
|
69
|
+
"timestamp_before" => "1687314763164"
|
70
|
+
}
|
71
|
+
|
68
72
|
client.website.get_messages_in_conversation(website_id, session_id, query);
|
69
73
|
|
70
74
|
=========================
|
@@ -74,12 +78,12 @@ https://docs.crisp.chat/references/rest-api/v1/#send-a-message-in-conversation
|
|
74
78
|
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
75
79
|
session_id = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
|
76
80
|
|
77
|
-
query =
|
81
|
+
query = {
|
78
82
|
"type" => "text",
|
79
83
|
"from" => "operator",
|
80
84
|
"origin" => "chat",
|
81
85
|
"content" => "Hey there! Need help?"
|
82
|
-
|
86
|
+
}
|
83
87
|
|
84
88
|
client.website.send_message_in_conversation(website_id, session_id, query);
|
85
89
|
|
@@ -221,6 +225,16 @@ client.website.list_conversation_events(website_id, session_id, page_number);
|
|
221
225
|
|
222
226
|
=========================
|
223
227
|
|
228
|
+
https://docs.crisp.chat/references/rest-api/v1/#list-conversation-files
|
229
|
+
|
230
|
+
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
231
|
+
session_id = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
|
232
|
+
page_number = 1
|
233
|
+
|
234
|
+
client.website.list_conversation_files(website_id, session_id, page_number);
|
235
|
+
|
236
|
+
=========================
|
237
|
+
|
224
238
|
https://docs.crisp.chat/references/rest-api/v1/#get-conversation-state
|
225
239
|
|
226
240
|
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
@@ -517,6 +531,7 @@ data = [
|
|
517
531
|
"visitor_compose" => false,
|
518
532
|
"file_transfer" => true,
|
519
533
|
"helpdesk_link" => true,
|
534
|
+
"helpdesk_only" => false,
|
520
535
|
"status_health_dead" => true,
|
521
536
|
"check_domain" => false,
|
522
537
|
"color_theme" => "blue",
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ The Crisp API Ruby wrapper. Authenticate, send messages, fetch conversations, ac
|
|
6
6
|
|
7
7
|
Copyright 2023 Crisp IM SAS. See LICENSE for copying information.
|
8
8
|
|
9
|
-
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision:
|
9
|
+
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 16/01/2023
|
10
10
|
* **😘 Maintainer**: [@valeriansaliou](https://github.com/valeriansaliou), [@eliottvincent](https://github.com/eliottvincent)
|
11
11
|
|
12
12
|
## Usage
|
@@ -16,7 +16,7 @@ You may follow the [REST API Quickstart](https://docs.crisp.chat/guides/rest-api
|
|
16
16
|
Add the library to your `Gemfile`:
|
17
17
|
|
18
18
|
```bash
|
19
|
-
gem "crisp-api", "~> 1.1.
|
19
|
+
gem "crisp-api", "~> 1.1.12"
|
20
20
|
```
|
21
21
|
|
22
22
|
Then, import it:
|
@@ -200,12 +200,12 @@ client.website.send_message_in_conversation(
|
|
200
200
|
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
201
201
|
session_id = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
|
202
202
|
|
203
|
-
query =
|
203
|
+
query = {
|
204
204
|
"type" => "text",
|
205
205
|
"from" => "operator",
|
206
206
|
"origin" => "chat",
|
207
207
|
"content" => "Hey there! Need help?"
|
208
|
-
|
208
|
+
}
|
209
209
|
|
210
210
|
client.website.send_message_in_conversation(website_id, session_id, query);
|
211
211
|
```
|
@@ -387,6 +387,20 @@ client.website.send_message_in_conversation(
|
|
387
387
|
```
|
388
388
|
</details>
|
389
389
|
|
390
|
+
* **List Conversation Files** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-conversation-files)
|
391
|
+
* `client.website.list_conversation_files(website_id, session_id, page_number)`
|
392
|
+
* <details>
|
393
|
+
<summary>See Example</summary>
|
394
|
+
|
395
|
+
```ruby
|
396
|
+
website_id = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"
|
397
|
+
session_id = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
|
398
|
+
page_number = 1
|
399
|
+
|
400
|
+
client.website.list_conversation_files(website_id, session_id, page_number);
|
401
|
+
```
|
402
|
+
</details>
|
403
|
+
|
390
404
|
* **Get Conversation State** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-conversation-state)
|
391
405
|
* `client.website.get_conversation_state(website_id, session_id)`
|
392
406
|
* <details>
|
@@ -820,6 +834,7 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
|
|
820
834
|
"visitor_compose" => false,
|
821
835
|
"file_transfer" => true,
|
822
836
|
"helpdesk_link" => true,
|
837
|
+
"helpdesk_only" => false,
|
823
838
|
"status_health_dead" => true,
|
824
839
|
"check_domain" => false,
|
825
840
|
"color_theme" => "blue",
|
data/crisp-api.gemspec
CHANGED
data/lib/crisp-api.rb
CHANGED
data/lib/resources/website.rb
CHANGED
@@ -22,11 +22,23 @@ module Crisp
|
|
22
22
|
"filter_unassigned",
|
23
23
|
"filter_date_start",
|
24
24
|
"filter_date_end",
|
25
|
-
"filter_date_end",
|
26
25
|
"order_date_created",
|
27
26
|
"order_date_updated",
|
28
27
|
]
|
29
28
|
|
29
|
+
SEARCH_HELPDESK_ARTICLES_QUERY_PARAMETERS = [
|
30
|
+
"order_visits",
|
31
|
+
"search_title",
|
32
|
+
"filter_category_id",
|
33
|
+
"filter_section_id",
|
34
|
+
"filter_status_published",
|
35
|
+
"filter_status_draft",
|
36
|
+
"filter_visibility_visible",
|
37
|
+
"filter_visibility_hidden",
|
38
|
+
"filter_date_start",
|
39
|
+
"filter_date_end",
|
40
|
+
]
|
41
|
+
|
30
42
|
def initialize(parent)
|
31
43
|
@parent = parent
|
32
44
|
end
|
@@ -192,6 +204,10 @@ module Crisp
|
|
192
204
|
return @parent.get(self._url_conversation(website_id, session_id, "/events/%d" % page_number))
|
193
205
|
end
|
194
206
|
|
207
|
+
def list_conversation_files(website_id, session_id, page_number)
|
208
|
+
return @parent.get(self._url_conversation(website_id, session_id, "/files/%d" % page_number))
|
209
|
+
end
|
210
|
+
|
195
211
|
def get_conversation_state(website_id, session_id)
|
196
212
|
return @parent.get(self._url_conversation(website_id, session_id, "/state"))
|
197
213
|
end
|
@@ -287,5 +303,30 @@ module Crisp
|
|
287
303
|
def get_session_id_by_token(website_id, token)
|
288
304
|
return @parent.get(self._url_website(website_id, "/visitors/token/#{token}"))
|
289
305
|
end
|
306
|
+
|
307
|
+
def search_helpdesk_articles(website_id, locale, page_number = 1, order_visits = "", search_title = "", filter_category_id = "", filter_section_id = "", filter_status_published = "", filter_status_draft = "", filter_visibility_visible = "", filter_visibility_hidden = "", filter_date_start = "", filter_date_end="")
|
308
|
+
resource_url = ""
|
309
|
+
query_parameters = []
|
310
|
+
|
311
|
+
SEARCH_HELPDESK_ARTICLES_QUERY_PARAMETERS.each do |parameter|
|
312
|
+
parameter_value = binding.local_variable_get(parameter)
|
313
|
+
|
314
|
+
if parameter_value != ""
|
315
|
+
query_parameters.push("%s=%s" % [parameter, CGI.escape(parameter_value).gsub("+", "%20")])
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
if query_parameters != []
|
320
|
+
resource_url = self._url_website(website_id, "/helpdesk/locale/%s/articles/%d?%s" % [locale, page_number, query_parameters.join("&")])
|
321
|
+
else
|
322
|
+
resource_url = self._url_website(website_id, "/helpdesk/locale/%s/articles/%d" % [locale, page_number])
|
323
|
+
end
|
324
|
+
|
325
|
+
return @parent.get(resource_url)
|
326
|
+
end
|
327
|
+
|
328
|
+
def list_helpdesk_articles(website_id, locale, page_number = 1)
|
329
|
+
return self.search_helpdesk_articles(website_id, locale, page_number)
|
330
|
+
end
|
290
331
|
end
|
291
332
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crisp-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valerian Saliou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
64
|
+
rubygems_version: 3.4.10
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Crisp API Ruby
|