nextcloud 1.3.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 +7 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +172 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +87 -0
- data/LICENSE.txt +21 -0
- data/README.md +668 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nextcloud.rb +47 -0
- data/lib/nextcloud/api.rb +51 -0
- data/lib/nextcloud/errors/nextcloud.rb +5 -0
- data/lib/nextcloud/helpers/nextcloud.rb +101 -0
- data/lib/nextcloud/helpers/properties.rb +73 -0
- data/lib/nextcloud/models/directory.rb +74 -0
- data/lib/nextcloud/models/user.rb +50 -0
- data/lib/nextcloud/ocs/app.rb +90 -0
- data/lib/nextcloud/ocs/file_sharing_api.rb +221 -0
- data/lib/nextcloud/ocs/group.rb +89 -0
- data/lib/nextcloud/ocs/user.rb +225 -0
- data/lib/nextcloud/ocs_api.rb +34 -0
- data/lib/nextcloud/version/nextcloud.rb +5 -0
- data/lib/nextcloud/webdav/directory.rb +174 -0
- data/lib/nextcloud/webdav_api.rb +21 -0
- data/nextcloud.gemspec +45 -0
- metadata +215 -0
@@ -0,0 +1,221 @@
|
|
1
|
+
module Nextcloud
|
2
|
+
module Ocs
|
3
|
+
# File sharing base class used for interfering with sharing, included federated
|
4
|
+
#
|
5
|
+
# @!attribute [rw] meta
|
6
|
+
# @return [Hash] Information about API response
|
7
|
+
# @!attribute [rw] shareid
|
8
|
+
# @return [Integer] Share identifier
|
9
|
+
class FileSharingApi < OcsApi
|
10
|
+
include Helpers
|
11
|
+
|
12
|
+
attr_accessor :meta, :shareid
|
13
|
+
|
14
|
+
# Initializes API with user credentials
|
15
|
+
#
|
16
|
+
# @param [Hash] args authentication credentials.
|
17
|
+
# @option args [String] :url Nextcloud instance URL
|
18
|
+
# @option args [String] :username Nextcloud instance user username
|
19
|
+
# @option args [String] :password Nextcloud instance user password
|
20
|
+
def initialize(args)
|
21
|
+
super(args)
|
22
|
+
|
23
|
+
@url = URI(
|
24
|
+
@url.scheme + "://" + @url.host + "/ocs/v2.php/apps/files_sharing/api/v1/"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get information about specific share
|
29
|
+
#
|
30
|
+
# @param shareid [Integer]
|
31
|
+
# @return [Hash] Information about share with meta
|
32
|
+
def find(shareid)
|
33
|
+
response = request(:get, "shares/#{shareid}")
|
34
|
+
h = doc_to_hash(response, "//data/element").try(:[], "element")
|
35
|
+
add_meta(response, h)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Get all shares
|
39
|
+
#
|
40
|
+
# @return [Array] All shares of authenticated user
|
41
|
+
def all
|
42
|
+
response = request(:get, "shares")
|
43
|
+
h = doc_to_hash(response, "//data").try(:[], "data").try(:[], "element")
|
44
|
+
h = [h] if h.class == Hash
|
45
|
+
add_meta(response, h)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get shares for a file or directory
|
49
|
+
# optionally get shares including re-shares on a resource
|
50
|
+
# or get shares for all the files in a directory
|
51
|
+
#
|
52
|
+
# @param path [String]
|
53
|
+
# @param reshares [Boolean,nil]
|
54
|
+
# @param subfiles [Boolean,nil]
|
55
|
+
# @return [Array] Shares (may include re-shares for a file or directory) of a resource or all reshares of
|
56
|
+
# directory contents
|
57
|
+
def specific(path, reshares = nil, subfiles = nil)
|
58
|
+
response = request(:get, "shares?path=#{path}&reshares=#{reshares}&subfiles=#{subfiles}")
|
59
|
+
h = doc_to_hash(response, "//data").try(:[], "data").try(:[], "element")
|
60
|
+
h = [h] if h.class == Hash
|
61
|
+
add_meta(response, h)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Share an item
|
65
|
+
#
|
66
|
+
# @param path [String] Path of a file or directory to share
|
67
|
+
# @param shareType [Integer] One of four possible values. 0 means an user, 1 means a group, 3 means a public link
|
68
|
+
# 6 stands for federated cloud share
|
69
|
+
# @param shareWith [String,nil] User or group identifier, can be omitted if shareType is neither 0, nor 1
|
70
|
+
# @param publicUpload [Boolean,nil] If true, permits public uploads in directories shared by link
|
71
|
+
# @param password [String,nil] Password-protects a share
|
72
|
+
# @param permissions [Integer,nil] Sets permissions on a resource. 1 gives read rights, 2 update, 4 create,
|
73
|
+
# 8 delete
|
74
|
+
# 16 share, 31 all rights. Value should be one of previously listed.
|
75
|
+
# @return [Object] Instance including meta response
|
76
|
+
def create(path, shareType, shareWith, publicUpload = nil, password = nil, permissions = nil)
|
77
|
+
args = local_variables.reduce({}) { |c, i| c[i] = eval(i.to_s); c }
|
78
|
+
response = request(:post, "/shares", args)
|
79
|
+
(@meta = get_meta(response)) && self
|
80
|
+
end
|
81
|
+
|
82
|
+
# Unshare an item
|
83
|
+
#
|
84
|
+
# @param shareid [Integer] Share ID
|
85
|
+
# @return [Object] Instance with meta response
|
86
|
+
def destroy(shareid)
|
87
|
+
response = request(:delete, "/shares/#{shareid}")
|
88
|
+
(@meta = get_meta(response)) && self
|
89
|
+
end
|
90
|
+
|
91
|
+
# Update permissions for a resource
|
92
|
+
#
|
93
|
+
# @param shareid [Integer] Share identifier
|
94
|
+
# @param permissions [Integer] Must be one of the following: 1: read, 2: update, 4: create, 8: delete, 16: share,
|
95
|
+
# 31: all rights.
|
96
|
+
# @return [Object] Instance with meta response
|
97
|
+
def update_permissions(shareid, permissions)
|
98
|
+
update(shareid, "permissions", permissions)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Update a password for a resource
|
102
|
+
#
|
103
|
+
# @param shareid [Integer] Share identifier
|
104
|
+
# @param password [String] Password string
|
105
|
+
# @return [Object] Instance with meta response
|
106
|
+
def update_password(shareid, password)
|
107
|
+
update(shareid, "password", password)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Allow or disallow public uploads in a directory
|
111
|
+
#
|
112
|
+
# @param shareid [Integer] Share identifier
|
113
|
+
# @param publicUpload [Boolean] True to permit public uploads in a directory, false to disallow
|
114
|
+
# @return [Object] Instance with meta response
|
115
|
+
def update_public_upload(shareid, publicUpload)
|
116
|
+
update(shareid, "publicUpload", publicUpload)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Update resource expiration date
|
120
|
+
#
|
121
|
+
# @param shareid [Integer] Share identifier
|
122
|
+
# @param expireDate [String] Expiration date of a resource. Has to be in format of "YYYY-DD-MM"
|
123
|
+
# @return [Object] Instance with meta response
|
124
|
+
def update_expire_date(shareid, expireDate)
|
125
|
+
update(shareid, "expireDate", expireDate)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Wrapper to Federated Cloud Sharing API
|
129
|
+
#
|
130
|
+
# @!attribute [rw] meta
|
131
|
+
# @return [Hash] Information about API response
|
132
|
+
class FederatedCloudShares
|
133
|
+
include Helpers
|
134
|
+
|
135
|
+
attr_accessor :meta
|
136
|
+
|
137
|
+
# Creates Federated Cloud Sharing class instance
|
138
|
+
#
|
139
|
+
# @param api [Object] Api object
|
140
|
+
def initialize(api)
|
141
|
+
@api = api
|
142
|
+
end
|
143
|
+
|
144
|
+
# List accepted Federated Cloud Shares
|
145
|
+
#
|
146
|
+
# @return [Array] List of accepted Federated Cloud Shares
|
147
|
+
def accepted
|
148
|
+
response = @api.request(:get, "/remote_shares")
|
149
|
+
h = doc_to_hash(response, "//data").try(:[], "data").try(:[], "element")
|
150
|
+
h = [h] if h.class == Hash
|
151
|
+
add_meta(response, h)
|
152
|
+
end
|
153
|
+
|
154
|
+
# List pending requests of Federated Cloud Shares
|
155
|
+
#
|
156
|
+
# @return [Array] List of pending Federated Cloud Shares
|
157
|
+
def pending
|
158
|
+
response = @api.request(:get, "/remote_shares/pending")
|
159
|
+
h = doc_to_hash(response, "//data").try(:[], "data").try(:[], "element")
|
160
|
+
h = [h] if h.class == Hash
|
161
|
+
add_meta(response, h)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Accept a request of a Federated Cloud Share
|
165
|
+
#
|
166
|
+
# @param shareid [Integer] Federated Cloud Share identifier
|
167
|
+
# @return [Object] Instance with meta response
|
168
|
+
def accept(shareid)
|
169
|
+
response = @api.request(:post, "/remote_shares/pending/#{shareid}")
|
170
|
+
(@meta = get_meta(response)) && self
|
171
|
+
end
|
172
|
+
|
173
|
+
# Decline a request of a Federated Cloud Share
|
174
|
+
#
|
175
|
+
# @param shareid [Integer] Federated Cloud Share identifier
|
176
|
+
# @return [Object] Instance with meta response
|
177
|
+
def decline(shareid)
|
178
|
+
response = @api.request(:delete, "/remote_shares/pending/#{shareid}")
|
179
|
+
(@meta = get_meta(response)) && self
|
180
|
+
end
|
181
|
+
|
182
|
+
# Delete an accepted Federated Cloud Share
|
183
|
+
#
|
184
|
+
# @param shareid [Integer] Federated Cloud Share identifier
|
185
|
+
# @return [Object] Instance with meta response
|
186
|
+
def destroy(shareid)
|
187
|
+
response = @api.request(:delete, "/remote_shares/#{shareid}")
|
188
|
+
(@meta = get_meta(response)) && self
|
189
|
+
end
|
190
|
+
|
191
|
+
# Information about accepted Federated Cloud Share
|
192
|
+
#
|
193
|
+
# @param shareid [Integer] Federated Cloud Share identifier
|
194
|
+
# @return [Hash] Information about Federated Cloud Share with meta response
|
195
|
+
def find(shareid)
|
196
|
+
response = @api.request(:get, "/remote_shares/#{shareid}")
|
197
|
+
h = doc_to_hash(response, "//data").try(:[], "data")
|
198
|
+
add_meta(response, h)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Initiates a Federated Cloud Sharing class
|
203
|
+
def federated
|
204
|
+
FederatedCloudShares.new(self)
|
205
|
+
end
|
206
|
+
|
207
|
+
private
|
208
|
+
|
209
|
+
# Update a resource
|
210
|
+
#
|
211
|
+
# @param shareid [Integer] Share identifier
|
212
|
+
# @param key [String] Option to update
|
213
|
+
# @param value [String] Setting to update to
|
214
|
+
# @return [Object] Instance with meta information
|
215
|
+
def update(shareid, key, value)
|
216
|
+
response = request(:put, "/shares/#{shareid}", "#{key}": value)
|
217
|
+
(@meta = get_meta(response)) && self
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Nextcloud
|
2
|
+
module Ocs
|
3
|
+
# Class with Nextcloud group operation features
|
4
|
+
#
|
5
|
+
# @!attribute [rw] meta
|
6
|
+
# @return [Hash] Information about API response
|
7
|
+
# @!attribute [rw] groupid
|
8
|
+
# @return [String,nil] Group identifier
|
9
|
+
class Group < OcsApi
|
10
|
+
include Helpers
|
11
|
+
|
12
|
+
attr_accessor :meta, :groupid
|
13
|
+
|
14
|
+
# Initializes a class
|
15
|
+
#
|
16
|
+
# @param api [Object] Api instance
|
17
|
+
# @param groupid [String,nil] Group identifier
|
18
|
+
def initialize(args, groupid = nil)
|
19
|
+
@groupid = groupid if groupid
|
20
|
+
|
21
|
+
if args.class == Nextcloud::OcsApi
|
22
|
+
@api = args
|
23
|
+
else
|
24
|
+
super(args)
|
25
|
+
@api = self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Sets group (useful if class is initiated without OcsApi.group)
|
30
|
+
#
|
31
|
+
# @param userid [String] User identifier
|
32
|
+
# @return [Obeject] self
|
33
|
+
def set(groupid)
|
34
|
+
@groupid = groupid
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
# Search for a group
|
39
|
+
#
|
40
|
+
# @param str [String] Search query
|
41
|
+
# @return [Array] Found groups list
|
42
|
+
def search(str)
|
43
|
+
response = @api.request(:get, "groups?search=#{str}")
|
44
|
+
parse_with_meta(response, "//data/groups/element")
|
45
|
+
end
|
46
|
+
|
47
|
+
# List all groups
|
48
|
+
#
|
49
|
+
# @return [Array] All groups
|
50
|
+
def all
|
51
|
+
search("")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Create a group
|
55
|
+
#
|
56
|
+
# @param groupid [String] Group identifier
|
57
|
+
# @return [Object] Instance with meta information
|
58
|
+
def create(groupid)
|
59
|
+
response = @api.request(:post, "groups", groupid: groupid)
|
60
|
+
(@meta = get_meta(response)) && self
|
61
|
+
end
|
62
|
+
|
63
|
+
# Get members of a group
|
64
|
+
#
|
65
|
+
# @return [Array] List of group members
|
66
|
+
def members
|
67
|
+
response = @api.request(:get, "groups/#{@groupid}")
|
68
|
+
parse_with_meta(response, "//data/users/element")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Get sub-admins of a group
|
72
|
+
#
|
73
|
+
# @return [Array] List of group sub-admins
|
74
|
+
def subadmins
|
75
|
+
response = @api.request(:get, "groups/#{@groupid}/subadmins")
|
76
|
+
parse_with_meta(response, "//data/element")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Remove a group
|
80
|
+
#
|
81
|
+
# @param groupid [String] Group identifier
|
82
|
+
# @return [Object] Instance with meta information
|
83
|
+
def destroy(groupid)
|
84
|
+
response = @api.request(:delete, "groups/#{groupid}")
|
85
|
+
(@meta = get_meta(response)) && self
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
module Nextcloud
|
2
|
+
module Ocs
|
3
|
+
# Class includes User provisioning fetures, including User group operations
|
4
|
+
#
|
5
|
+
# @!attribute [rw] meta
|
6
|
+
# @return [Hash] Information about API response
|
7
|
+
# @!attribute [rw] userid
|
8
|
+
# @return [String,nil] User identifier
|
9
|
+
class User < OcsApi
|
10
|
+
include Helpers
|
11
|
+
|
12
|
+
attr_accessor :meta, :userid
|
13
|
+
|
14
|
+
# Class initializer
|
15
|
+
#
|
16
|
+
# @param api [Object] Api instance
|
17
|
+
# @param userid [String,nil] User identifier
|
18
|
+
def initialize(args, userid = nil)
|
19
|
+
@userid = userid if userid
|
20
|
+
|
21
|
+
if args.class == Nextcloud::OcsApi
|
22
|
+
@api = args
|
23
|
+
else
|
24
|
+
super(args)
|
25
|
+
@api = self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Sets user (useful if class is initiated without OcsApi.user)
|
30
|
+
#
|
31
|
+
# @param userid [String] User identifier
|
32
|
+
# @return [Obeject] self
|
33
|
+
def set(userid)
|
34
|
+
@userid = userid
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
# Retrieve information about an user
|
39
|
+
#
|
40
|
+
# @param userid [String]
|
41
|
+
# @return [Object] User instance
|
42
|
+
def find(userid)
|
43
|
+
response = @api.request(:get, "users/#{userid}")
|
44
|
+
|
45
|
+
enabled = response.xpath("//data/enabled").text
|
46
|
+
id = response.xpath("//data/id").text
|
47
|
+
quota = response.xpath("//data/quota/*").each_with_object({}) do |node, quota|
|
48
|
+
quota[node.name] = node.text
|
49
|
+
end
|
50
|
+
email = response.xpath("//data/email").text
|
51
|
+
displayname = response.xpath("//data/displayname").text
|
52
|
+
phone = response.xpath("//data/phone").text
|
53
|
+
address = response.xpath("//data/address").text
|
54
|
+
website = response.xpath("//data/website").text
|
55
|
+
twitter = response.xpath("//data/twitter").text
|
56
|
+
groups = []
|
57
|
+
response.xpath("//data/groups/element").each do |prop|
|
58
|
+
groups << prop.text
|
59
|
+
end
|
60
|
+
|
61
|
+
language = response.xpath("//data/language").text
|
62
|
+
|
63
|
+
user = Nextcloud::Models::User.new(enabled: enabled, id: id, quota: quota, email: email,
|
64
|
+
displayname: displayname, phone: phone, address: address, website: website,
|
65
|
+
twitter: twitter, groups: groups, language: language)
|
66
|
+
(user.meta = get_meta(response)) && user
|
67
|
+
end
|
68
|
+
|
69
|
+
# Retrieve all users
|
70
|
+
#
|
71
|
+
# @return [Array] List of all users
|
72
|
+
def all
|
73
|
+
response = @api.request(:get, "users")
|
74
|
+
|
75
|
+
users = [].tap do |users|
|
76
|
+
response.xpath("//element").each do |prop|
|
77
|
+
id = prop.text
|
78
|
+
users << Nextcloud::Models::User.new(id: id)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
meta = get_meta(response)
|
83
|
+
|
84
|
+
users.send(:define_singleton_method, :meta) { meta } && users
|
85
|
+
end
|
86
|
+
|
87
|
+
# Add a new user
|
88
|
+
#
|
89
|
+
# @param userid [String] User identifier
|
90
|
+
# @param password [String] User password
|
91
|
+
# @return [Object] Instance with meta response
|
92
|
+
def create(userid, password)
|
93
|
+
response = @api.request(:post, "users", userid: userid, password: password)
|
94
|
+
(@meta = get_meta(response)) && self
|
95
|
+
end
|
96
|
+
|
97
|
+
# Update a parameter of an user
|
98
|
+
#
|
99
|
+
# @param userid [String] User identifier
|
100
|
+
# @param key [String] Parameter to update. Can be quota, displayname, phone, address, website, twitter or password
|
101
|
+
# @param value [String] Value to update to
|
102
|
+
# @return [Object] Instance with meta information
|
103
|
+
def update(userid, key, value)
|
104
|
+
response = @api.request(:put, "users/#{userid}", key: key, value: value)
|
105
|
+
(@meta = get_meta(response)) && self
|
106
|
+
end
|
107
|
+
|
108
|
+
# Disable an user
|
109
|
+
#
|
110
|
+
# @param userid [String] User identifier
|
111
|
+
# @return [Object] Instance with meta information
|
112
|
+
def disable(userid)
|
113
|
+
response = @api.request(:put, "users/#{userid}/disable")
|
114
|
+
(@meta = get_meta(response)) && self
|
115
|
+
end
|
116
|
+
|
117
|
+
# Enable an user
|
118
|
+
#
|
119
|
+
# @param userid [String] User identifier
|
120
|
+
# @return [Object] Instance with meta information
|
121
|
+
def enable(userid)
|
122
|
+
response = @api.request(:put, "users/#{userid}/enable")
|
123
|
+
(@meta = get_meta(response)) && self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Remove an user account
|
127
|
+
#
|
128
|
+
# @param userid [String] User identifier
|
129
|
+
# @return [Object] Instance with meta information
|
130
|
+
def destroy(userid)
|
131
|
+
response = @api.request(:delete, "users/#{userid}")
|
132
|
+
(@meta = get_meta(response)) && self
|
133
|
+
end
|
134
|
+
|
135
|
+
# Class covering User group operations
|
136
|
+
#
|
137
|
+
# @!attribute [rw] meta
|
138
|
+
# @return [Hash] Information about API response
|
139
|
+
# @!attribute [rw] groupid
|
140
|
+
# @return [String,nil] Group identifier
|
141
|
+
class Group < User
|
142
|
+
include Helpers
|
143
|
+
|
144
|
+
attr_accessor :userid, :groupid, :meta
|
145
|
+
|
146
|
+
# Initializes an User Group instance
|
147
|
+
#
|
148
|
+
# @param api [Object] Api instance
|
149
|
+
# @param userid [String] User identifier
|
150
|
+
# @param groupid [String,nil] Group identifier
|
151
|
+
def initialize(api, userid, groupid = nil)
|
152
|
+
@api = api
|
153
|
+
@userid = userid
|
154
|
+
@groupid = groupid if groupid
|
155
|
+
end
|
156
|
+
|
157
|
+
# Add an user to a group
|
158
|
+
#
|
159
|
+
# @param groupid [String] Group to add user to
|
160
|
+
# @return [Object] Instance with meta information
|
161
|
+
def create(groupid)
|
162
|
+
response = @api.request(:post, "users/#{@userid}/groups", groupid: groupid)
|
163
|
+
(@meta = get_meta(response)) && self
|
164
|
+
end
|
165
|
+
|
166
|
+
# Remove user from a group
|
167
|
+
#
|
168
|
+
# @param groupid [String] Group to remove user from
|
169
|
+
# @return [Object] Instance with meta information
|
170
|
+
def destroy(groupid)
|
171
|
+
response = @api.request(:delete, "users/#{@userid}/groups", groupid: groupid)
|
172
|
+
(@meta = get_meta(response)) && self
|
173
|
+
end
|
174
|
+
|
175
|
+
# Make an user subadmin of a group
|
176
|
+
#
|
177
|
+
# @return [Object] Instance with meta information
|
178
|
+
def promote
|
179
|
+
response = @api.request(:post, "users/#{@userid}/subadmins", groupid: @groupid)
|
180
|
+
(@meta = get_meta(response)) && self
|
181
|
+
end
|
182
|
+
|
183
|
+
# Remove an user from group subadmins
|
184
|
+
#
|
185
|
+
# @return [Object] Instance with meta information
|
186
|
+
def demote
|
187
|
+
response = @api.request(:delete, "users/#{@userid}/subadmins", groupid: @groupid)
|
188
|
+
(@meta = get_meta(response)) && self
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Initialize a group class
|
193
|
+
#
|
194
|
+
# @param groupid [String,nil] Group identifier
|
195
|
+
def group(groupid = nil)
|
196
|
+
Group.new(@api, @userid, groupid)
|
197
|
+
end
|
198
|
+
|
199
|
+
# List groups that user belongs to
|
200
|
+
#
|
201
|
+
# @return [Array] User groups
|
202
|
+
def groups
|
203
|
+
response = @api.request(:get, "users/#{@userid}/groups")
|
204
|
+
parse_with_meta(response, "//data/groups/element")
|
205
|
+
end
|
206
|
+
|
207
|
+
# List groups that user sub-admins
|
208
|
+
#
|
209
|
+
# @return [Array] User sub-admin groups
|
210
|
+
def subadmin_groups
|
211
|
+
response = @api.request(:get, "users/#{@userid}/subadmins")
|
212
|
+
parse_with_meta(response, "//data/element")
|
213
|
+
end
|
214
|
+
|
215
|
+
# Resend welcome e-mail letter to a user
|
216
|
+
#
|
217
|
+
# @param userid [String]
|
218
|
+
# @return [Object] Instance with meta information
|
219
|
+
def resend_welcome(userid)
|
220
|
+
response = @api.request(:post, "users/#{userid}/welcome")
|
221
|
+
(@meta = get_meta(response)) && self
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|