crisp-api 1.0.4 → 1.1.3

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
- SHA1:
3
- metadata.gz: 2c5521904044f6743dfd77b88bba0e920201f5c4
4
- data.tar.gz: 235b04eea4252238684644fa98a7ca98beb3d1a4
2
+ SHA256:
3
+ metadata.gz: 34adf502b882792d271c3b6a3f58a2570ab2ba441a75fcb8da3e719be07dfa8e
4
+ data.tar.gz: ed6a3d8626475bbe5617d39c68fccfc45a86abd8ccaaf32b69ba1b7ad773c9ca
5
5
  SHA512:
6
- metadata.gz: 46c8dd1e093a0b4919b1a59a447191cee259fe034f697fdd3c0df4f34b655164bf1074eb853d7d958f9b427f290d607cc6705a72e3293587c5a02b42a52c7d88
7
- data.tar.gz: b3c9207ffe68d51e78ea15572e34bd7078096b3b4f266ec5daa367c4d18e4589398f66373b542ea3be63b1e81f2fd29e689365395f856040cf133503cf447a07
6
+ metadata.gz: 5cc0ad79b5eda809419e3733c86a48e30f00b91a25240381a853de8a615c4d10cdf6f6101df24f7707e49b3e886c2a7c3aad18e7ae27648d8a921640bc849b6c
7
+ data.tar.gz: 22153279f095e17131241b520e271a1725d9d8f8a0f988df223d3e9a76939d1138d31e515b7995744339e2ce6bf2012525aa497334a41882f152e9ee4dd59e83
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Crisp API Ruby wrapper. Authenticate, send messages, fetch conversations, access your agent accounts from your Ruby code.
4
4
 
5
- Copyright 2018 Crisp IM SARL. See LICENSE for copying information.
5
+ Copyright 2019 Crisp IM SARL. See LICENSE for copying information.
6
6
 
7
7
  * **📝 Implements**: [Crisp Platform - API ~ v1](https://docs.crisp.chat/api/v1/) at reference revision: 12/31/2017
8
8
  * **😘 Maintainer**: [@valeriansaliou](https://github.com/valeriansaliou)
@@ -12,16 +12,16 @@ Copyright 2018 Crisp IM SARL. See LICENSE for copying information.
12
12
  Add the library to your `Gemfile`:
13
13
 
14
14
  ```bash
15
- gem 'crisp-api', '~> 1.0'
15
+ gem "crisp-api", "~> 1.1.3"
16
16
  ```
17
17
 
18
18
  Then, import it:
19
19
 
20
20
  ```ruby
21
- require 'crisp-api'
21
+ require "crisp-api"
22
22
  ```
23
23
 
24
- Construct a new authenticated Crisp client with your `identifier` and `key` tokens.
24
+ Build a new authenticated Crisp client with your `identifier` and `key` tokens.
25
25
 
26
26
  ```ruby
27
27
  client = Crisp::Client.new
@@ -33,18 +33,14 @@ Then, your client is ready to be consumed!
33
33
 
34
34
  ## Authentication
35
35
 
36
- To authenticate against the API, generate your session identifier and session key **once** using the following cURL request in your terminal (replace `YOUR_ACCOUNT_EMAIL` and `YOUR_ACCOUNT_PASSWORD`):
36
+ To authenticate against the API, generate your session identifier and session key **once** using the [Crisp token generation utility](https://go.crisp.chat/account/token/). You'll get a token keypair made of 2 values.
37
37
 
38
- ```bash
39
- curl -H "Content-Type: application/json" -X POST -d '{"email":"YOUR_ACCOUNT_EMAIL","password":"YOUR_ACCOUNT_PASSWORD"}' https://api.crisp.chat/v1/user/session/login
40
- ```
41
-
42
- If authentication succeeds, you will get a JSON response containing your authentication keys: `identifier` and `key`. **Keep those 2 values private, and store them safely for long-term use**.
38
+ **Keep your token keypair values private, and store them safely for long-term use.**
43
39
 
44
40
  Then, add authentication parameters to your `client` instance right after you create it:
45
41
 
46
42
  ```ruby
47
- client = Crisp()
43
+ client = Crisp::Client.new
48
44
 
49
45
  # Authenticate to API (identifier, key)
50
46
  # eg. client.authenticate("5c0595b2-9381-4a76-a2e0-04aa00c1ede7", "3bdb0812d0f5352bf68901ddc731434dade419b98507971905acdd2f967df61c")
@@ -53,7 +49,7 @@ client.authenticate(identifier, key)
53
49
  # Now, you can use authenticated API sections.
54
50
  ```
55
51
 
56
- **🔴 Important: Be sure to login once, and re-use the same authentication keys (same `identifier` + `key`) in all your subsequent requests to the API. Do not generate new tokens from your code for every new request to the API (you will be heavily rate-limited; that will induce HTTP failures for some of your API calls).**
52
+ **🔴 Important: Make sure to generate your token once, and use the same token keys in all your subsequent requests to the API. Do not generate too many tokens, as we may invalidate your older tokens to make room for newer tokens.**
57
53
 
58
54
  ## Resource Methods
59
55
 
@@ -61,7 +57,7 @@ Most useful available Crisp API resources are implemented. **Programmatic method
61
57
 
62
58
  Thus, it is straightforward to look for them in the library while reading the [API Reference](https://docs.crisp.chat/api/v1/).
63
59
 
64
- In the following method prototypes, `crisp` is to be replaced with your Crisp API instance. For example, instanciate `client = Crisp()` and then call eg: `client.user.check_session_validity()`.
60
+ In the following method prototypes, `crisp` is to be replaced with your Crisp API instance. For example, instanciate `client = Crisp()` and then call eg: `client.website.list_conversations(website_id, 1)`.
65
61
 
66
62
  When calling a method that writes data to the API (eg. send a message with: `client.website.send_message_in_conversation()`), you need to submit it this way:
67
63
 
@@ -85,9 +81,10 @@ client.website.send_message_in_conversation(
85
81
 
86
82
  * **Website Conversations**
87
83
  * **List Conversations**: `client.website.list_conversations(website_id, page_number)`
84
+ * **Search Conversations**: `client.website.search_conversations(website_id, page_number, search_query, search_type, search_operator, include_empty, filter_unread, filter_resolved, filter_not_resolved, filter_mention, filter_assigned, filter_unassigned, filter_date_start, filter_date_end, order_date_created", order_date_updated)`
88
85
 
89
86
  * **Website Conversation**
90
- * **Create A New Conversation**: `client.website.create_new_conversation(website_id, data)`
87
+ * **Create A New Conversation**: `client.website.create_new_conversation(website_id)`
91
88
  * **Check If Conversation Exists**: `client.website.check_conversation_exists(website_id, session_id)`
92
89
  * **Get A Conversation**: `client.website.get_conversation(website_id, session_id)`
93
90
  * **Remove A Conversation**: `client.website.remove_conversation(website_id, session_id)`
@@ -118,7 +115,7 @@ client.website.send_message_in_conversation(
118
115
  * **Check If People Profile Exists**: `client.website.check_people_profile_exists(website_id, people_id)`
119
116
  * **Get People Profile**: `client.website.get_people_profile(website_id, people_id)`
120
117
  * **Save People Profile**: `client.website.save_people_profile(website_id, people_id, data)`
121
- * **Find People Profile By Email**: `find_people_profile_by_email(website_id, email)`
118
+ * **Find People Profile By Email**: `client.website.find_people_profile_by_email(website_id, email)`
122
119
  * **Update People Profile**: `client.website.update_people_profile(website_id, people_id, data)`
123
120
  * **Remove People Profile**: `client.website.remove_people_profile(website_id, people_id)`
124
121
  * **List People Conversations**: `client.website.list_people_conversations(website_id, people_id, page_number)`
@@ -153,34 +150,9 @@ client.website.send_message_in_conversation(
153
150
  * **Website Visitors**
154
151
  * **Count Visitors**: `client.website.count_visitors(website_id)`
155
152
  * **List Visitors**: `client.website.list_visitors(website_id, page_number)`
153
+ * **Get Session ID**: `client.website.get_session_id_by_token(website_id, token)`
156
154
 
157
155
  ### Bucket
158
156
 
159
157
  * **Bucket URL**
160
158
  * **Generate Bucket URL**: `client.bucket.generate_bucket_url(data)`
161
-
162
- ### User
163
-
164
- * **User Availability**
165
- * **Get User Availability**: `client.user.get_user_availability()`
166
- * **Update User Availability**: `client.user.update_user_availability(data)`
167
- * **Get User Availability Status**: `client.user.get_user_availability_status()`
168
-
169
- * **User Account Base**
170
- * **Get User Account**: `client.user.get_user_account()`
171
- * **Create User Account**: `client.user.create_user_account(data)`
172
-
173
- * **User Account Websites**
174
- * **List Websites**: `client.user.list_websites()`
175
-
176
- * **User Account Profile**
177
- * **Get Profile**: `client.user.get_profile()`
178
- * **Update Profile**: `client.user.update_profile(data)`
179
-
180
- * **User Session**
181
- * **Check Session Validity**: `client.user.check_session_validity()`
182
- * **Create A New Session**: `client.user.create_new_session(data)`
183
- * **Destroy A Session**: `client.user.destroy_session()`
184
-
185
- * **User Statistics**
186
- * **Count Total Unread Messages**: `client.user.count_total_unread_messages()`
data/crisp-api.gemspec CHANGED
@@ -1,17 +1,17 @@
1
1
  require File.expand_path("../lib/crisp-api", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = 'crisp-api'
5
- s.version = '1.0.4'
4
+ s.name = "crisp-api"
5
+ s.version = "1.1.3"
6
6
  s.date = Date.today
7
7
  s.summary = "Crisp API Ruby"
8
8
  s.description = "Crisp API Ruby"
9
9
  s.authors = ["Valerian Saliou"]
10
- s.email = 'valerian@valeriansaliou.name'
10
+ s.email = "valerian@valeriansaliou.name"
11
11
  s.files = `git ls-files`.split($/)
12
- s.homepage = 'https://github.com/crisp-im/ruby-crisp-api'
13
- s.license = 'MIT'
14
- s.require_paths = ['lib']
12
+ s.homepage = "https://github.com/crisp-im/ruby-crisp-api"
13
+ s.license = "MIT"
14
+ s.require_paths = ["lib"]
15
15
 
16
- s.add_dependency 'rest-client', '~> 2.0.0'
16
+ s.add_dependency "rest-client", "~> 2.0"
17
17
  end
@@ -5,7 +5,7 @@
5
5
  # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
6
  ##
7
7
 
8
- require 'crisp-api'
8
+ require "crisp-api"
9
9
 
10
10
  client = Crisp::Client.new
11
11
 
data/lib/crisp-api.rb CHANGED
@@ -5,13 +5,12 @@
5
5
  # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
6
  ##
7
7
 
8
- require 'rest-client'
9
- require 'json'
8
+ require "rest-client"
9
+ require "json"
10
10
 
11
- require_relative 'errors/route'
12
- require_relative 'resources/bucket'
13
- require_relative 'resources/user'
14
- require_relative 'resources/website'
11
+ require_relative "errors/route"
12
+ require_relative "resources/bucket"
13
+ require_relative "resources/website"
15
14
 
16
15
  module Crisp
17
16
  class Client
@@ -19,14 +18,12 @@ module Crisp
19
18
  attr_writer :rest_base_path
20
19
 
21
20
  attr_accessor :bucket
22
- attr_accessor :user
23
21
  attr_accessor :website
24
22
 
25
23
  def initialize()
26
24
  @auth = {}
27
25
 
28
26
  @bucket = Crisp::BucketResource.new(self)
29
- @user = Crisp::UserResource.new(self)
30
27
  @website = Crisp::WebsiteResource.new(self)
31
28
  end
32
29
 
@@ -89,7 +86,7 @@ module Crisp
89
86
  :payload => (data ? data.to_json : nil),
90
87
 
91
88
  :headers => {
92
- :user_agent => "ruby-crisp-api/1.0.4",
89
+ :user_agent => "ruby-crisp-api/1.1.3",
93
90
  :accept => :json,
94
91
  :content_type => :json,
95
92
  :params => query
@@ -101,8 +98,10 @@ module Crisp
101
98
  response = nil
102
99
  end
103
100
 
104
- if response
101
+ if response && method != :head
105
102
  result = JSON.parse(response)
103
+ elsif response and method == :head and response.code == 200
104
+ result = {}
106
105
  else
107
106
  result = {
108
107
  "error" => true,
@@ -5,7 +5,7 @@
5
5
  # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
6
  ##
7
7
 
8
- require 'rest-client'
8
+ require "rest-client"
9
9
 
10
10
  module Crisp
11
11
  class BucketResource
@@ -5,25 +5,43 @@
5
5
  # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
6
  ##
7
7
 
8
- require 'rest-client'
8
+ require "rest-client"
9
9
 
10
10
  module Crisp
11
11
  class WebsiteResource
12
+ SEARCH_CONVERSATIONS_QUERY_PARAMETERS = [
13
+ "search_query",
14
+ "search_type",
15
+ "search_operator",
16
+ "include_empty",
17
+ "filter_unread",
18
+ "filter_resolved",
19
+ "filter_not_resolved",
20
+ "filter_mention",
21
+ "filter_assigned",
22
+ "filter_unassigned",
23
+ "filter_date_start",
24
+ "filter_date_end",
25
+ "filter_date_end",
26
+ "order_date_created",
27
+ "order_date_updated",
28
+ ]
29
+
12
30
  def initialize(parent)
13
31
  @parent = parent
14
32
  end
15
33
 
16
34
  protected
17
35
 
18
- def _url_website(website_id, resource)
36
+ def _url_website(website_id, resource = "")
19
37
  return "/website/%s%s" % [website_id, resource]
20
38
  end
21
39
 
22
- def _url_conversation(website_id, session_id, resource)
40
+ def _url_conversation(website_id, session_id, resource = "")
23
41
  return self._url_website(website_id, "/conversation/%s%s" % [session_id, resource])
24
42
  end
25
43
 
26
- def _url_people(kind, website_id, people_id, resource)
44
+ def _url_people(kind, website_id, people_id, resource = "")
27
45
  return self._url_website(website_id, "/people/%s/%s%s" % [kind, people_id, resource])
28
46
  end
29
47
 
@@ -34,11 +52,11 @@ module Crisp
34
52
  end
35
53
 
36
54
  def get_website(website_id)
37
- return @parent.get(self._url_website(website_id, ""))
55
+ return @parent.get(self._url_website(website_id))
38
56
  end
39
57
 
40
58
  def delete_website(website_id)
41
- return @parent.delete(self._url_website(website_id, ""))
59
+ return @parent.delete(self._url_website(website_id))
42
60
  end
43
61
 
44
62
  def batch_resolve_items(website_id, data)
@@ -81,8 +99,29 @@ module Crisp
81
99
  return @parent.get(self._url_website(website_id, "/visitors/list/%d" % page_number))
82
100
  end
83
101
 
84
- def list_conversations(website_id, page_number)
85
- return @parent.get(self._url_website(website_id, "/conversations/%d" % page_number))
102
+ def search_conversations(website_id, page_number = 0, search_query = "", search_type = "", search_operator = "", include_empty = "", filter_unread = "", filter_resolved = "", filter_not_resolved = "", filter_mention = "", filter_assigned = "", filter_unassigned = "", filter_date_start = "", filter_date_end = "", order_date_created = "", order_date_updated = "")
103
+ resource_url = ""
104
+ query_parameters = []
105
+
106
+ SEARCH_CONVERSATIONS_QUERY_PARAMETERS.each do |parameter|
107
+ parameter_value = binding.local_variable_get(parameter)
108
+
109
+ if parameter_value != ""
110
+ query_parameters.push("%s=%s" % [parameter, CGI.escape(parameter_value).gsub("+", "%20")])
111
+ end
112
+ end
113
+
114
+ if query_parameters != []
115
+ resource_url = self._url_website(website_id, "/conversations/%d?%s" % [page_number, query_parameters.join("&")])
116
+ else
117
+ resource_url = self._url_website(website_id, "/conversations/%d" % page_number)
118
+ end
119
+
120
+ return @parent.get(resource_url)
121
+ end
122
+
123
+ def list_conversations(website_id, page_number = 0)
124
+ return self.search_conversations(website_id, page_number)
86
125
  end
87
126
 
88
127
  def create_new_conversation(website_id, data)
@@ -90,15 +129,15 @@ module Crisp
90
129
  end
91
130
 
92
131
  def check_conversation_exists(website_id, session_id)
93
- return @parent.head(self._url_conversation(website_id, session_id, ""))
132
+ return @parent.head(self._url_conversation(website_id, session_id))
94
133
  end
95
134
 
96
135
  def get_conversation(website_id, session_id)
97
- return @parent.get(self._url_conversation(website_id, session_id, ""))
136
+ return @parent.get(self._url_conversation(website_id, session_id))
98
137
  end
99
138
 
100
139
  def remove_conversation(website_id, session_id)
101
- return @parent.delete(self._url_conversation(website_id, session_id, ""))
140
+ return @parent.remove(self._url_conversation(website_id, session_id))
102
141
  end
103
142
 
104
143
  def initiate_conversation_with_existing_session(website_id, session_id)
@@ -190,30 +229,27 @@ module Crisp
190
229
  end
191
230
 
192
231
  def check_people_profile_exists(website_id, people_id)
193
- return @parent.head(self._url_people("profile", website_id, people_id, ""))
232
+ return @parent.head(self._url_people("profile", website_id, people_id))
194
233
  end
195
234
 
196
235
  def find_people_profile_by_email(website_id, email)
197
- filter = [{:model => "people", :criterion => "email", :operator => "eq", query: [email]}]
198
- profiles = @parent.get(self._url_website(website_id, "/people/profiles/1?search_filter=%s" % CGI.escape(filter.to_json)))
199
-
200
- return profiles[0]
236
+ return @parent.get(self._url_people("profile", website_id, email))
201
237
  end
202
238
 
203
239
  def get_people_profile(website_id, people_id)
204
- return @parent.get(self._url_people("profile", website_id, people_id, ""))
240
+ return @parent.get(self._url_people("profile", website_id, people_id))
205
241
  end
206
242
 
207
243
  def save_people_profile(website_id, people_id, data)
208
- return @parent.put(self._url_people("profile", website_id, people_id, ""), data: data)
244
+ return @parent.put(self._url_people("profile", website_id, people_id), data: data)
209
245
  end
210
246
 
211
247
  def update_people_profile(website_id, people_id, data)
212
- return @parent.patch(self._url_people("profile", website_id, people_id, ""), data: data)
248
+ return @parent.patch(self._url_people("profile", website_id, people_id), data: data)
213
249
  end
214
250
 
215
251
  def remove_people_profile(website_id, people_id)
216
- return @parent.remove(self._url_people("profile", website_id, people_id, ""))
252
+ return @parent.remove(self._url_people("profile", website_id, people_id))
217
253
  end
218
254
 
219
255
  def list_people_conversations(website_id, people_id, page_number)
@@ -221,7 +257,7 @@ module Crisp
221
257
  end
222
258
 
223
259
  def add_people_event(website_id, people_id, data)
224
- return @parent.post(self._url_people("events", website_id, people_id, ""), data: data)
260
+ return @parent.post(self._url_people("events", website_id, people_id), data: data)
225
261
  end
226
262
 
227
263
  def list_people_events(website_id, people_id, page_number)
@@ -229,19 +265,23 @@ module Crisp
229
265
  end
230
266
 
231
267
  def get_people_data(website_id, people_id)
232
- return @parent.get(self._url_people("data", website_id, people_id, ""))
268
+ return @parent.get(self._url_people("data", website_id, people_id))
233
269
  end
234
270
 
235
271
  def save_people_data(website_id, people_id, data)
236
- return @parent.put(self._url_people("data", website_id, people_id, ""), data: data)
272
+ return @parent.put(self._url_people("data", website_id, people_id), data: data)
237
273
  end
238
274
 
239
275
  def get_people_subscription_status(website_id, people_id)
240
- return @parent.get(self._url_people("subscription", website_id, people_id, ""))
276
+ return @parent.get(self._url_people("subscription", website_id, people_id))
241
277
  end
242
278
 
243
279
  def update_people_subscription_status(website_id, people_id, data)
244
- return @parent.patch(self._url_people("subscription", website_id, people_id, ""), data: data)
280
+ return @parent.patch(self._url_people("subscription", website_id, people_id), data: data)
281
+ end
282
+
283
+ def get_session_id_by_token(website_id, token)
284
+ return @parent.get(self._url_website(website_id, "/visitors/token/#{token}"))
245
285
  end
246
286
  end
247
287
  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.0.4
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valerian Saliou
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: '2.0'
27
27
  description: Crisp API Ruby
28
28
  email: valerian@valeriansaliou.name
29
29
  executables: []
@@ -35,18 +35,16 @@ files:
35
35
  - LICENSE
36
36
  - README.md
37
37
  - crisp-api.gemspec
38
- - examples/user_get_profile.rb
39
38
  - examples/website_send_message_in_conversation.rb
40
39
  - lib/crisp-api.rb
41
40
  - lib/errors/route.rb
42
41
  - lib/resources/bucket.rb
43
- - lib/resources/user.rb
44
42
  - lib/resources/website.rb
45
43
  homepage: https://github.com/crisp-im/ruby-crisp-api
46
44
  licenses:
47
45
  - MIT
48
46
  metadata: {}
49
- post_install_message:
47
+ post_install_message:
50
48
  rdoc_options: []
51
49
  require_paths:
52
50
  - lib
@@ -61,9 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
59
  - !ruby/object:Gem::Version
62
60
  version: '0'
63
61
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.6.11
66
- signing_key:
62
+ rubygems_version: 3.0.3
63
+ signing_key:
67
64
  specification_version: 4
68
65
  summary: Crisp API Ruby
69
66
  test_files: []
@@ -1,19 +0,0 @@
1
- ##
2
- # ruby-crisp-api
3
- #
4
- # Copyright 2018, Valerian Saliou
5
- # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
- ##
7
-
8
- require 'crisp-api'
9
-
10
- client = Crisp::Client.new
11
-
12
- client.authenticate(
13
- "5c0595b2-9381-4a76-a2e0-04aa00c1ede7",
14
- "3bdb0812d0f5352bf68901ddc731434dade419b98507971905acdd2f967df61c"
15
- )
16
-
17
- data = client.user.get_profile()
18
-
19
- puts data.inspect
@@ -1,72 +0,0 @@
1
- ##
2
- # ruby-crisp-api
3
- #
4
- # Copyright 2018, Valerian Saliou
5
- # Author: Valerian Saliou <valerian@valeriansaliou.name>
6
- ##
7
-
8
- require 'rest-client'
9
-
10
- module Crisp
11
- class UserResource
12
- def initialize(parent)
13
- @parent = parent
14
- end
15
-
16
- protected
17
-
18
- def _url_user(resource)
19
- return "/user%s" % resource
20
- end
21
-
22
- public
23
-
24
- def get_user_availability
25
- return @parent.get(self._url_user("/availability"))
26
- end
27
-
28
- def update_user_availability(data)
29
- return @parent.patch(self._url_user("/availability"), data: data)
30
- end
31
-
32
- def get_user_availability_status
33
- return @parent.get(self._url_user("/availability/status"))
34
- end
35
-
36
- def get_user_account
37
- return @parent.get(self._url_user("/account"))
38
- end
39
-
40
- def create_user_account(data)
41
- return @parent.post(self._url_user("/account"), data: data)
42
- end
43
-
44
- def list_websites
45
- return @parent.get(self._url_user("/account/websites"))
46
- end
47
-
48
- def get_profile
49
- return @parent.get(self._url_user("/account/profile"))
50
- end
51
-
52
- def update_profile(data)
53
- return @parent.patch(self._url_user("/account/profile"), data: data)
54
- end
55
-
56
- def check_session_validity
57
- return @parent.head(self._url_user("/session"))
58
- end
59
-
60
- def create_new_session(data)
61
- return @parent.post(self._url_user("/session/login"))
62
- end
63
-
64
- def destroy_session
65
- return @parent.post(self._url_user("/session/logout"))
66
- end
67
-
68
- def count_total_unread_messages
69
- return @parent.get(self._url_user("/stats/unread"))
70
- end
71
- end
72
- end