groupdocs 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +9 -9
- data/CHANGELOG.md +482 -477
- data/Gemfile +3 -3
- data/LICENSE.txt +21 -21
- data/README.md +94 -94
- data/Rakefile +9 -9
- data/examples/README.md +12 -12
- data/examples/api-samples/Gemfile +5 -5
- data/examples/api-samples/Gemfile.lock +49 -49
- data/examples/api-samples/README.md +23 -23
- data/examples/api-samples/public/css/style.css +229 -229
- data/examples/api-samples/public/docs/annotation-sample.html +167 -167
- data/examples/api-samples/public/docs/docco.css +500 -500
- data/examples/api-samples/public/docs/envelope-sample.html +374 -374
- data/examples/api-samples/public/docs/sample01.html +181 -181
- data/examples/api-samples/public/docs/sample02.html +199 -199
- data/examples/api-samples/public/docs/sample03.html +318 -318
- data/examples/api-samples/public/docs/sample04.html +217 -217
- data/examples/api-samples/public/docs/sample05.html +296 -296
- data/examples/api-samples/public/docs/sample06.html +347 -347
- data/examples/api-samples/public/docs/sample07.html +209 -209
- data/examples/api-samples/public/docs/sample08.html +277 -277
- data/examples/api-samples/public/docs/sample09.html +314 -314
- data/examples/api-samples/public/docs/sample10.html +270 -270
- data/examples/api-samples/public/docs/sample11.html +462 -462
- data/examples/api-samples/public/docs/sample12.html +199 -199
- data/examples/api-samples/public/docs/sample13.html +201 -201
- data/examples/api-samples/public/docs/sample14.html +204 -204
- data/examples/api-samples/public/docs/sample15.html +182 -182
- data/examples/api-samples/public/docs/sample16.html +234 -234
- data/examples/api-samples/public/docs/sample17.html +309 -309
- data/examples/api-samples/public/docs/sample18.html +721 -721
- data/examples/api-samples/public/docs/sample19.html +631 -631
- data/examples/api-samples/public/docs/sample20.html +230 -230
- data/examples/api-samples/public/docs/sample21.html +790 -790
- data/examples/api-samples/public/docs/sample22.html +408 -408
- data/examples/api-samples/public/docs/sample25.html +550 -550
- data/examples/api-samples/public/templates/base-simple_source.html +191 -191
- data/examples/api-samples/public/templates/testdocument.html +100 -100
- data/examples/api-samples/public/templates/welcome.htm +137 -137
- data/examples/api-samples/samples/annotation-sample.rb +56 -56
- data/examples/api-samples/samples/envelope-sample.rb +133 -133
- data/examples/api-samples/samples/sample01.rb +44 -44
- data/examples/api-samples/samples/sample02.rb +50 -50
- data/examples/api-samples/samples/sample03.rb +79 -79
- data/examples/api-samples/samples/sample04.rb +54 -54
- data/examples/api-samples/samples/sample05.rb +83 -83
- data/examples/api-samples/samples/sample06.rb +86 -86
- data/examples/api-samples/samples/sample07.rb +59 -59
- data/examples/api-samples/samples/sample08.rb +76 -76
- data/examples/api-samples/samples/sample09.rb +85 -85
- data/examples/api-samples/samples/sample10.rb +70 -70
- data/examples/api-samples/samples/sample11.rb +132 -132
- data/examples/api-samples/samples/sample12.rb +48 -48
- data/examples/api-samples/samples/sample13.rb +49 -49
- data/examples/api-samples/samples/sample14.rb +54 -54
- data/examples/api-samples/samples/sample15.rb +43 -43
- data/examples/api-samples/samples/sample16.rb +57 -57
- data/examples/api-samples/samples/sample17.rb +70 -70
- data/examples/api-samples/samples/sample18.rb +190 -190
- data/examples/api-samples/samples/sample19.rb +188 -188
- data/examples/api-samples/samples/sample20.rb +68 -68
- data/examples/api-samples/samples/sample21.rb +212 -212
- data/examples/api-samples/samples/sample22.rb +109 -109
- data/examples/api-samples/samples/sample25.rb +127 -127
- data/examples/api-samples/views/_others_samples.haml +233 -233
- data/examples/api-samples/views/annotation_sample.haml +63 -63
- data/examples/api-samples/views/envelope_sample.haml +72 -72
- data/examples/api-samples/views/index.haml +235 -235
- data/examples/api-samples/views/layout.haml +3 -3
- data/examples/api-samples/views/sample01.haml +63 -63
- data/examples/api-samples/views/sample02.haml +52 -52
- data/examples/api-samples/views/sample03.haml +87 -87
- data/examples/api-samples/views/sample04.haml +55 -55
- data/examples/api-samples/views/sample05.haml +86 -86
- data/examples/api-samples/views/sample06.haml +58 -58
- data/examples/api-samples/views/sample07.haml +52 -52
- data/examples/api-samples/views/sample08.haml +100 -100
- data/examples/api-samples/views/sample09.haml +95 -95
- data/examples/api-samples/views/sample10.haml +93 -93
- data/examples/api-samples/views/sample11.haml +140 -140
- data/examples/api-samples/views/sample12.haml +68 -68
- data/examples/api-samples/views/sample13.haml +64 -64
- data/examples/api-samples/views/sample14.haml +60 -60
- data/examples/api-samples/views/sample15.haml +51 -51
- data/examples/api-samples/views/sample16.haml +50 -50
- data/examples/api-samples/views/sample17.haml +54 -54
- data/examples/api-samples/views/sample18.haml +143 -143
- data/examples/api-samples/views/sample19.haml +92 -92
- data/examples/api-samples/views/sample20.haml +54 -54
- data/examples/api-samples/views/sample21.haml +123 -123
- data/examples/api-samples/views/sample22.haml +106 -106
- data/examples/api-samples/views/sample25.haml +101 -101
- data/examples/api-samples/views/sample31.haml +2 -2
- data/examples/api-samples/web.rb +20 -20
- data/examples/viewer/Gemfile +5 -5
- data/examples/viewer/app.rb +52 -52
- data/groupdocs.gemspec +31 -31
- data/lib/groupdocs.rb +62 -62
- data/lib/groupdocs/api.rb +6 -6
- data/lib/groupdocs/api/entity.rb +112 -112
- data/lib/groupdocs/api/helpers.rb +11 -11
- data/lib/groupdocs/api/helpers/access_mode_helper.rb +27 -27
- data/lib/groupdocs/api/helpers/access_rights_helper.rb +55 -55
- data/lib/groupdocs/api/helpers/accessor_helper.rb +30 -30
- data/lib/groupdocs/api/helpers/byte_flag_helper.rb +49 -49
- data/lib/groupdocs/api/helpers/credentials_helper.rb +35 -35
- data/lib/groupdocs/api/helpers/mime_helper.rb +21 -21
- data/lib/groupdocs/api/helpers/path_helper.rb +28 -28
- data/lib/groupdocs/api/helpers/rest_helper.rb +99 -99
- data/lib/groupdocs/api/helpers/signature_public_helper.rb +22 -22
- data/lib/groupdocs/api/helpers/status_helper.rb +27 -27
- data/lib/groupdocs/api/helpers/url_helper.rb +101 -101
- data/lib/groupdocs/api/request.rb +91 -91
- data/lib/groupdocs/datasource.rb +249 -249
- data/lib/groupdocs/datasource/field.rb +39 -39
- data/lib/groupdocs/document.rb +1550 -1550
- data/lib/groupdocs/document/annotation.rb +421 -421
- data/lib/groupdocs/document/annotation/reply.rb +173 -173
- data/lib/groupdocs/document/annotation/reviewer.rb +66 -66
- data/lib/groupdocs/document/change.rb +56 -56
- data/lib/groupdocs/document/field.rb +53 -53
- data/lib/groupdocs/document/metadata.rb +32 -32
- data/lib/groupdocs/document/rectangle.rb +18 -18
- data/lib/groupdocs/document/view.rb +36 -36
- data/lib/groupdocs/errors.rb +8 -8
- data/lib/groupdocs/job.rb +468 -468
- data/lib/groupdocs/questionnaire.rb +530 -530
- data/lib/groupdocs/questionnaire/collector.rb +335 -335
- data/lib/groupdocs/questionnaire/execution.rb +181 -181
- data/lib/groupdocs/questionnaire/page.rb +43 -43
- data/lib/groupdocs/questionnaire/question.rb +108 -108
- data/lib/groupdocs/questionnaire/question/answer.rb +15 -15
- data/lib/groupdocs/signature.rb +380 -380
- data/lib/groupdocs/signature/contact.rb +181 -181
- data/lib/groupdocs/signature/envelope.rb +747 -747
- data/lib/groupdocs/signature/envelope/log.rb +20 -20
- data/lib/groupdocs/signature/field.rb +286 -286
- data/lib/groupdocs/signature/field/location.rb +71 -71
- data/lib/groupdocs/signature/form.rb +804 -804
- data/lib/groupdocs/signature/list.rb +92 -92
- data/lib/groupdocs/signature/recipient.rb +79 -79
- data/lib/groupdocs/signature/role.rb +54 -54
- data/lib/groupdocs/signature/shared.rb +6 -6
- data/lib/groupdocs/signature/shared/document_methods.rb +158 -158
- data/lib/groupdocs/signature/shared/entity_fields.rb +76 -76
- data/lib/groupdocs/signature/shared/entity_methods.rb +144 -144
- data/lib/groupdocs/signature/shared/field_methods.rb +354 -354
- data/lib/groupdocs/signature/shared/recipient_methods.rb +75 -75
- data/lib/groupdocs/signature/shared/resource_methods.rb +65 -65
- data/lib/groupdocs/signature/template.rb +124 -124
- data/lib/groupdocs/storage.rb +44 -44
- data/lib/groupdocs/storage/file.rb +432 -432
- data/lib/groupdocs/storage/folder.rb +288 -288
- data/lib/groupdocs/storage/package.rb +48 -48
- data/lib/groupdocs/storage/provider.rb +32 -32
- data/lib/groupdocs/subscription.rb +323 -323
- data/lib/groupdocs/subscription/limit.rb +20 -20
- data/lib/groupdocs/user.rb +955 -930
- data/lib/groupdocs/version.rb +3 -3
- data/spec/groupdocs/api/entity_spec.rb +55 -55
- data/spec/groupdocs/api/helpers/access_mode_helper_spec.rb +21 -21
- data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +43 -43
- data/spec/groupdocs/api/helpers/accessor_helper_spec.rb +16 -16
- data/spec/groupdocs/api/helpers/byte_flag_helper_spec.rb +23 -23
- data/spec/groupdocs/api/helpers/credentials_helpers_spec.rb +48 -48
- data/spec/groupdocs/api/helpers/mime_helper_spec.rb +16 -16
- data/spec/groupdocs/api/helpers/path_helper_spec.rb +15 -15
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +161 -161
- data/spec/groupdocs/api/helpers/signature_public_helper_spec.rb +21 -21
- data/spec/groupdocs/api/helpers/status_helper_spec.rb +22 -22
- data/spec/groupdocs/api/helpers/url_helper_spec.rb +112 -112
- data/spec/groupdocs/api/request_spec.rb +112 -112
- data/spec/groupdocs/datasource/field_spec.rb +29 -29
- data/spec/groupdocs/datasource_spec.rb +145 -145
- data/spec/groupdocs/document/annotation/reply_spec.rb +154 -154
- data/spec/groupdocs/document/annotation/reviewer_spec.rb +51 -51
- data/spec/groupdocs/document/annotation_spec.rb +234 -234
- data/spec/groupdocs/document/change_spec.rb +39 -39
- data/spec/groupdocs/document/field_spec.rb +28 -28
- data/spec/groupdocs/document/metadata_spec.rb +21 -21
- data/spec/groupdocs/document/rectangle_spec.rb +14 -14
- data/spec/groupdocs/document/view_spec.rb +33 -33
- data/spec/groupdocs/document_spec.rb +859 -859
- data/spec/groupdocs/errors_spec.rb +7 -7
- data/spec/groupdocs/job_spec.rb +323 -323
- data/spec/groupdocs/questionnaire/collector_spec.rb +197 -197
- data/spec/groupdocs/questionnaire/execution_spec.rb +162 -162
- data/spec/groupdocs/questionnaire/page_spec.rb +47 -47
- data/spec/groupdocs/questionnaire/question/answer_spec.rb +9 -9
- data/spec/groupdocs/questionnaire/question_spec.rb +75 -75
- data/spec/groupdocs/questionnaire_spec.rb +295 -295
- data/spec/groupdocs/signature/contact_spec.rb +142 -142
- data/spec/groupdocs/signature/envelope/log_spec.rb +15 -15
- data/spec/groupdocs/signature/envelope_spec.rb +384 -384
- data/spec/groupdocs/signature/field/location_spec.rb +40 -40
- data/spec/groupdocs/signature/field_spec.rb +235 -235
- data/spec/groupdocs/signature/form_spec.rb +205 -205
- data/spec/groupdocs/signature/list_spec.rb +87 -87
- data/spec/groupdocs/signature/recipient_spec.rb +26 -26
- data/spec/groupdocs/signature/role_spec.rb +47 -47
- data/spec/groupdocs/signature/template_spec.rb +80 -80
- data/spec/groupdocs/signature_spec.rb +194 -194
- data/spec/groupdocs/storage/file_spec.rb +303 -303
- data/spec/groupdocs/storage/folder_spec.rb +270 -270
- data/spec/groupdocs/storage/package_spec.rb +38 -38
- data/spec/groupdocs/storage/provider_spec.rb +21 -21
- data/spec/groupdocs/storage_spec.rb +27 -27
- data/spec/groupdocs/subscription/limit_spec.rb +16 -16
- data/spec/groupdocs/subscription_spec.rb +74 -74
- data/spec/groupdocs/user_spec.rb +257 -257
- data/spec/groupdocs_spec.rb +63 -63
- data/spec/spec_helper.rb +73 -73
- data/spec/support/json/annotation_access_set.json +11 -11
- data/spec/support/json/annotation_collaborators_get.json +16 -16
- data/spec/support/json/annotation_collaborators_set.json +16 -16
- data/spec/support/json/annotation_create.json +12 -12
- data/spec/support/json/annotation_list.json +32 -32
- data/spec/support/json/annotation_marker_move.json +10 -10
- data/spec/support/json/annotation_move.json +8 -8
- data/spec/support/json/annotation_remove.json +9 -9
- data/spec/support/json/annotation_replies_create.json +9 -9
- data/spec/support/json/annotation_replies_get.json +25 -25
- data/spec/support/json/annotation_reviewers_get.json +18 -18
- data/spec/support/json/comparison_changes.json +46 -46
- data/spec/support/json/comparison_compare.json +8 -8
- data/spec/support/json/comparison_document.json +10 -10
- data/spec/support/json/contact_add.json +12 -12
- data/spec/support/json/contacts_get.json +19 -19
- data/spec/support/json/contacts_import.json +8 -8
- data/spec/support/json/datasource_add.json +8 -8
- data/spec/support/json/datasource_get.json +22 -22
- data/spec/support/json/datasource_remove.json +8 -8
- data/spec/support/json/datasource_update.json +8 -8
- data/spec/support/json/delete_account.json +9 -9
- data/spec/support/json/document_access_info_get.json +14 -14
- data/spec/support/json/document_convert.json +8 -8
- data/spec/support/json/document_datasource.json +10 -10
- data/spec/support/json/document_fields.json +34 -34
- data/spec/support/json/document_formats.json +8 -8
- data/spec/support/json/document_metadata.json +15 -15
- data/spec/support/json/document_page_images_get.json +20 -20
- data/spec/support/json/document_questionnaire_create.json +9 -9
- data/spec/support/json/document_questionnaires.json +23 -23
- data/spec/support/json/document_sharers_remove.json +8 -8
- data/spec/support/json/document_sharers_set.json +16 -16
- data/spec/support/json/document_thumbnails.json +24 -24
- data/spec/support/json/document_views.json +32 -32
- data/spec/support/json/envelope_get.json +46 -46
- data/spec/support/json/envelope_logs.json +16 -16
- data/spec/support/json/envelope_recipient_add.json +26 -26
- data/spec/support/json/envelopes_all.json +48 -48
- data/spec/support/json/envelopes_resources.json +31 -31
- data/spec/support/json/file_compress.json +8 -8
- data/spec/support/json/file_copy.json +14 -14
- data/spec/support/json/file_delete.json +5 -5
- data/spec/support/json/file_move.json +14 -14
- data/spec/support/json/file_upload.json +8 -8
- data/spec/support/json/folder_create.json +8 -8
- data/spec/support/json/folder_delete.json +5 -5
- data/spec/support/json/folder_list.json +22 -22
- data/spec/support/json/folder_move.json +8 -8
- data/spec/support/json/folder_sharers_get.json +16 -16
- data/spec/support/json/folder_sharers_remove.json +8 -8
- data/spec/support/json/folder_sharers_set.json +16 -16
- data/spec/support/json/form_get.json +21 -21
- data/spec/support/json/forms_all.json +23 -23
- data/spec/support/json/job_add_url.json +8 -8
- data/spec/support/json/job_create.json +8 -8
- data/spec/support/json/job_documents.json +40 -40
- data/spec/support/json/job_file_add.json +8 -8
- data/spec/support/json/job_get.json +30 -30
- data/spec/support/json/job_update.json +7 -7
- data/spec/support/json/jobs_get.json +58 -58
- data/spec/support/json/list_add.json +12 -12
- data/spec/support/json/lists_get.json +19 -19
- data/spec/support/json/package_create.json +7 -7
- data/spec/support/json/questionnaire_collector.json +17 -17
- data/spec/support/json/questionnaire_collectors.json +38 -38
- data/spec/support/json/questionnaire_collectors_add.json +10 -10
- data/spec/support/json/questionnaire_create.json +10 -10
- data/spec/support/json/questionnaire_datasources.json +26 -26
- data/spec/support/json/questionnaire_execution_add.json +9 -9
- data/spec/support/json/questionnaire_execution_status_set.json +8 -8
- data/spec/support/json/questionnaire_execution_update.json +8 -8
- data/spec/support/json/questionnaire_executions.json +28 -28
- data/spec/support/json/questionnaire_get.json +17 -17
- data/spec/support/json/questionnaire_remove.json +8 -8
- data/spec/support/json/questionnaire_update.json +8 -8
- data/spec/support/json/questionnaires_get.json +40 -40
- data/spec/support/json/sign_documents.json +16 -16
- data/spec/support/json/signature_create.json +12 -12
- data/spec/support/json/signature_field_add.json +25 -25
- data/spec/support/json/signature_fields_get.json +27 -27
- data/spec/support/json/signature_roles_get.json +17 -17
- data/spec/support/json/signatures_get.json +19 -19
- data/spec/support/json/storage_info.json +10 -10
- data/spec/support/json/subscription_plan_get.json +9 -9
- data/spec/support/json/subscription_plans_get.json +17 -17
- data/spec/support/json/template_get.json +35 -35
- data/spec/support/json/template_get_documents.json +15 -15
- data/spec/support/json/template_get_recipients.json +20 -20
- data/spec/support/json/templates_all.json +37 -37
- data/spec/support/json/templates_get.json +21 -21
- data/spec/support/json/update_account.json +10 -10
- data/spec/support/json/user_area.json +67 -67
- data/spec/support/json/user_embed_key.json +38 -38
- data/spec/support/json/user_get_embed_key.json +67 -67
- data/spec/support/json/user_login.json +67 -67
- data/spec/support/json/user_profile_get.json +24 -24
- data/spec/support/json/user_providers.json +31 -31
- data/spec/support/json/user_roles.json +25 -25
- data/spec/support/json/user_users_get.json +27 -27
- data/spec/support/shared_examples/api/entity.rb +39 -39
- data/spec/support/shared_examples/api/helpers/access_mode_helper.rb +11 -11
- data/spec/support/shared_examples/api/helpers/status_helper.rb +11 -11
- data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -68
- data/spec/support/shared_examples/signature/shared/entity_fields.rb +56 -56
- data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -116
- data/spec/support/shared_examples/signature/shared/field_methods.rb +220 -220
- data/spec/support/shared_examples/signature/shared/recipient_methods.rb +46 -46
- data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -46
- metadata +35 -55
@@ -1,20 +1,20 @@
|
|
1
|
-
module GroupDocs
|
2
|
-
class Subscription::Limit < Api::Entity
|
3
|
-
|
4
|
-
# @attr [Integer] Id
|
5
|
-
attr_accessor :Id
|
6
|
-
# @attr [Integer] Min
|
7
|
-
attr_accessor :Min
|
8
|
-
# @attr [Integer] Max
|
9
|
-
attr_accessor :Max
|
10
|
-
# @attr [String] Description
|
11
|
-
attr_accessor :Description
|
12
|
-
|
13
|
-
# Human-readable accessors
|
14
|
-
alias_accessor :id, :Id
|
15
|
-
alias_accessor :min, :Min
|
16
|
-
alias_accessor :max, :Max
|
17
|
-
alias_accessor :description, :Description
|
18
|
-
|
19
|
-
end # Subscription::Limit
|
20
|
-
end # GroupDocs
|
1
|
+
module GroupDocs
|
2
|
+
class Subscription::Limit < Api::Entity
|
3
|
+
|
4
|
+
# @attr [Integer] Id
|
5
|
+
attr_accessor :Id
|
6
|
+
# @attr [Integer] Min
|
7
|
+
attr_accessor :Min
|
8
|
+
# @attr [Integer] Max
|
9
|
+
attr_accessor :Max
|
10
|
+
# @attr [String] Description
|
11
|
+
attr_accessor :Description
|
12
|
+
|
13
|
+
# Human-readable accessors
|
14
|
+
alias_accessor :id, :Id
|
15
|
+
alias_accessor :min, :Min
|
16
|
+
alias_accessor :max, :Max
|
17
|
+
alias_accessor :description, :Description
|
18
|
+
|
19
|
+
end # Subscription::Limit
|
20
|
+
end # GroupDocs
|
data/lib/groupdocs/user.rb
CHANGED
@@ -1,930 +1,955 @@
|
|
1
|
-
module GroupDocs
|
2
|
-
class User < Api::Entity
|
3
|
-
|
4
|
-
include Api::Helpers::AccessRights
|
5
|
-
|
6
|
-
#
|
7
|
-
# Returns current user profile.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# user = GroupDocs::User.get!
|
11
|
-
# user.first_name
|
12
|
-
# #=> "John"
|
13
|
-
#
|
14
|
-
# @param [Hash] access Access credentials
|
15
|
-
# @option access [String] :client_id
|
16
|
-
# @option access [String] :private_key
|
17
|
-
# @return [GroupDocs::User]
|
18
|
-
#
|
19
|
-
def self.get!(access = {})
|
20
|
-
json = Api::Request.new do |request|
|
21
|
-
request[:access] = access
|
22
|
-
request[:method] = :GET
|
23
|
-
request[:path] = '/mgmt/{{client_id}}/profile'
|
24
|
-
end.execute!
|
25
|
-
|
26
|
-
new(json[:user])
|
27
|
-
end
|
28
|
-
|
29
|
-
#
|
30
|
-
# Updates user account if it's created, otherwise creates new.
|
31
|
-
#
|
32
|
-
# @example
|
33
|
-
# user = GroupDocs::User.new
|
34
|
-
# user.primary_email = 'john@smith.com'
|
35
|
-
# user.nickname = 'johnsmith'
|
36
|
-
# user.first_name = 'John'
|
37
|
-
# user.last_name = 'Smith'
|
38
|
-
# # make sure to save user as it has updated attributes
|
39
|
-
# user = GroupDocs::User.update_account!(user)
|
40
|
-
#
|
41
|
-
# @param [GroupDocs::User] user
|
42
|
-
# @param [Hash] access Access credentials
|
43
|
-
# @option access [String] :client_id
|
44
|
-
# @option access [String] :private_key
|
45
|
-
# @return [GroupDocs::User]
|
46
|
-
#
|
47
|
-
def self.update_account!(user, access = {})
|
48
|
-
user.is_a?(GroupDocs::User) or raise ArgumentError,
|
49
|
-
"User should be GroupDocs::User object, received: #{user.inspect}"
|
50
|
-
|
51
|
-
data = user.to_hash
|
52
|
-
|
53
|
-
json = Api::Request.new do |request|
|
54
|
-
request[:access] = access
|
55
|
-
request[:method] = :PUT
|
56
|
-
request[:path] = "/mgmt/{{client_id}}/account/users/#{user.nickname}"
|
57
|
-
request[:request_body] = data
|
58
|
-
end.execute!
|
59
|
-
|
60
|
-
GroupDocs::User.new data.merge(json)
|
61
|
-
end
|
62
|
-
|
63
|
-
#
|
64
|
-
# Delete account user.
|
65
|
-
#
|
66
|
-
# @example
|
67
|
-
# user = GroupDocs::User.get!
|
68
|
-
# GroupDocs::User.delete!(user.users!.last)
|
69
|
-
# #=> "826e3b54e009ce51"
|
70
|
-
#
|
71
|
-
# @param [GroupDocs::User] user
|
72
|
-
# @param [Hash] access Access credentials
|
73
|
-
# @option access [String] :client_id
|
74
|
-
# @option access [String] :private_key
|
75
|
-
# @return [String]
|
76
|
-
#
|
77
|
-
# @raise [ArgumentError] if user is not GroupDocs::User object
|
78
|
-
#
|
79
|
-
def self.delete!(user, access = {})
|
80
|
-
user.is_a?(GroupDocs::User) or raise ArgumentError,
|
81
|
-
"User should be GroupDocs::User object, received: #{user.inspect}"
|
82
|
-
|
83
|
-
json = Api::Request.new do |request|
|
84
|
-
request[:access] = access
|
85
|
-
request[:method] = :DELETE
|
86
|
-
request[:path] = "/mgmt/{{client_id}}/account/users/#{user.primary_email}"
|
87
|
-
end.execute!
|
88
|
-
|
89
|
-
json[:guid]
|
90
|
-
end
|
91
|
-
|
92
|
-
#
|
93
|
-
# Generates new user embed key.
|
94
|
-
#
|
95
|
-
# @example
|
96
|
-
# GroupDocs::User.generate_embed_key!('test-area')
|
97
|
-
# #=> "60a06ef8f23a49cf807977f1444fbdd8"
|
98
|
-
#
|
99
|
-
# @param [String] area
|
100
|
-
# @param [Hash] access Access credentials
|
101
|
-
# @option access [String] :client_id
|
102
|
-
# @option access [String] :private_key
|
103
|
-
# @return [String]
|
104
|
-
#
|
105
|
-
def self.generate_embed_key!(area, access = {})
|
106
|
-
json = Api::Request.new do |request|
|
107
|
-
request[:access] = access
|
108
|
-
request[:method] = :GET
|
109
|
-
request[:path] = "/mgmt/{{client_id}}/embedkey/new/#{area}"
|
110
|
-
end.execute!
|
111
|
-
|
112
|
-
json[:key][:guid]
|
113
|
-
end
|
114
|
-
|
115
|
-
#
|
116
|
-
# Get user embed key. Generate new embed key if area not exists.
|
117
|
-
#
|
118
|
-
# @example
|
119
|
-
# GroupDocs::User.get_embed_key!('test-area')
|
120
|
-
# #=> "60a06ef8f23a49cf807977f1444fbdd8"
|
121
|
-
#
|
122
|
-
# @param [String] area
|
123
|
-
# @param [Hash] access Access credentials
|
124
|
-
# @option access [String] :client_id
|
125
|
-
# @option access [String] :private_key
|
126
|
-
# @return [String]
|
127
|
-
#
|
128
|
-
def self.get_embed_key!(area, access = {})
|
129
|
-
json = Api::Request.new do |request|
|
130
|
-
request[:access] = access
|
131
|
-
request[:method] = :GET
|
132
|
-
request[:path] = "/mgmt/{{client_id}}/embedkey/#{area}"
|
133
|
-
end.execute!
|
134
|
-
|
135
|
-
json[:key][:guid]
|
136
|
-
end
|
137
|
-
|
138
|
-
#
|
139
|
-
# Get area name by embed key.
|
140
|
-
#
|
141
|
-
# @example
|
142
|
-
# GroupDocs::User.area!('60a06eg8f23a49cf807977f1444fbdd8')
|
143
|
-
# #=> "test-area"
|
144
|
-
#
|
145
|
-
# @param [String] embed_key
|
146
|
-
# @param [Hash] access Access credentials
|
147
|
-
# @option access [String] :client_id
|
148
|
-
# @option access [String] :private_key
|
149
|
-
# @return [String]
|
150
|
-
#
|
151
|
-
def self.area!(embed_key, access = {})
|
152
|
-
json = Api::Request.new do |request|
|
153
|
-
request[:access] = access
|
154
|
-
request[:method] = :GET
|
155
|
-
request[:path] = "/mgmt/{{client_id}}/embedkey/guid/#{embed_key}"
|
156
|
-
end.execute!
|
157
|
-
|
158
|
-
json[:key][:area]
|
159
|
-
end
|
160
|
-
|
161
|
-
#
|
162
|
-
# Returns an array of storage providers.
|
163
|
-
#
|
164
|
-
# @example
|
165
|
-
# providers = GroupDocs::User.providers!
|
166
|
-
# providers.first.provider
|
167
|
-
# #=> "Dropbox"
|
168
|
-
#
|
169
|
-
# @param [Hash] access Access credentials
|
170
|
-
# @option access [String] :client_id
|
171
|
-
# @option access [String] :private_key
|
172
|
-
# @return [Array<GroupDocs::Storage::Provider>]
|
173
|
-
#
|
174
|
-
def self.providers!(access = {})
|
175
|
-
json = Api::Request.new do |request|
|
176
|
-
request[:access] = access
|
177
|
-
request[:method] = :GET
|
178
|
-
request[:path] = '/mgmt/{{client_id}}/storages'
|
179
|
-
end.execute!
|
180
|
-
|
181
|
-
json[:providers].map do |provider|
|
182
|
-
Storage::Provider.new(provider)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
#
|
187
|
-
# Adds a new storage provider configuration.
|
188
|
-
#
|
189
|
-
# @param [String] provider Storage provider name
|
190
|
-
# @param [Hash] access Access credentials
|
191
|
-
# @param [Array] provider_info
|
192
|
-
# @option access [String] :client_id
|
193
|
-
# @option access [String] :private_key
|
194
|
-
#
|
195
|
-
def add_provider!(provider, provider_info = {}, access = {})
|
196
|
-
Api::Request.new do |request|
|
197
|
-
request[:access] = access
|
198
|
-
request[:method] = :POST
|
199
|
-
request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
|
200
|
-
request[:request_body] = provider_info
|
201
|
-
end.execute!
|
202
|
-
|
203
|
-
end
|
204
|
-
|
205
|
-
#
|
206
|
-
# Updates user's storage provider configuration.
|
207
|
-
#
|
208
|
-
# @param [String] provider Storage provider name
|
209
|
-
# @param [Hash] access Access credentials
|
210
|
-
# @param [Array] provider_info
|
211
|
-
# @option access [String] :client_id
|
212
|
-
# @option access [String] :private_key
|
213
|
-
#
|
214
|
-
def update_provider!(provider, provider_info = {}, access = {})
|
215
|
-
Api::Request.new do |request|
|
216
|
-
request[:access] = access
|
217
|
-
request[:method] = :PUT
|
218
|
-
request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
|
219
|
-
request[:request_body] = provider_info
|
220
|
-
end.execute!
|
221
|
-
|
222
|
-
end
|
223
|
-
|
224
|
-
|
225
|
-
#
|
226
|
-
# Revoke.
|
227
|
-
#
|
228
|
-
# @param [Hash] access Access credentials
|
229
|
-
# @option access [String] :client_id
|
230
|
-
# @option access [String] :private_key
|
231
|
-
#
|
232
|
-
def self.revoke!(access = {})
|
233
|
-
Api::Request.new do |request|
|
234
|
-
request[:access] = access
|
235
|
-
request[:method] = :PUT
|
236
|
-
request[:path] = "/mgmt/{{client_id}}/revoke"
|
237
|
-
end.execute!
|
238
|
-
|
239
|
-
end
|
240
|
-
#
|
241
|
-
# Logins user using user name and password.
|
242
|
-
#
|
243
|
-
# @example
|
244
|
-
# user = GroupDocs::User.login!('doe@john.com', 'password')
|
245
|
-
# user.first_name
|
246
|
-
# #=> "John"
|
247
|
-
#
|
248
|
-
# @return [GroupDocs::User]
|
249
|
-
#
|
250
|
-
def self.login!(email, password)
|
251
|
-
json = Api::Request.new do |request|
|
252
|
-
request[:sign] = false
|
253
|
-
request[:method] = :POST
|
254
|
-
request[:path] = "/shared/users/#{email}/logins"
|
255
|
-
request[:request_body] = password
|
256
|
-
end.execute!
|
257
|
-
|
258
|
-
new(json[:user])
|
259
|
-
end
|
260
|
-
|
261
|
-
#
|
262
|
-
# Logins user using user name and password.
|
263
|
-
#
|
264
|
-
# @param [String]guid
|
265
|
-
# @param [Hash] options
|
266
|
-
# @option [String] :filename File name
|
267
|
-
# @option [Boolean] :render Render
|
268
|
-
#
|
269
|
-
def self.download!(path, name, guid, options = {})
|
270
|
-
api = Api::Request.new do |request|
|
271
|
-
request[:sign] = false
|
272
|
-
request[:method] = :DOWNLOAD
|
273
|
-
request[:path] = "/shared/files/#{guid}"
|
274
|
-
end
|
275
|
-
api.add_params(options)
|
276
|
-
response = api.execute!
|
277
|
-
|
278
|
-
filepath = "#{path}/#{name}"
|
279
|
-
Object::File.open(filepath, 'wb') do |file|
|
280
|
-
file.write(response)
|
281
|
-
end
|
282
|
-
|
283
|
-
filepath
|
284
|
-
end
|
285
|
-
|
286
|
-
#
|
287
|
-
# Get file in xml.
|
288
|
-
#
|
289
|
-
#@param [String] guid
|
290
|
-
#
|
291
|
-
def self.get_xml!(path, name, guid)
|
292
|
-
response = Api::Request.new do |request|
|
293
|
-
request[:sign] = false
|
294
|
-
request[:method] = :DOWNLOAD
|
295
|
-
request[:path] = "/shared/files/#{guid}/xml"
|
296
|
-
end.execute!
|
297
|
-
|
298
|
-
filepath = "#{path}/#{name}"
|
299
|
-
Object::File.open(filepath, 'wb') do |file|
|
300
|
-
file.write(response)
|
301
|
-
end
|
302
|
-
|
303
|
-
filepath
|
304
|
-
end
|
305
|
-
|
306
|
-
#
|
307
|
-
# Get file in html.
|
308
|
-
#
|
309
|
-
#@param [String] guid
|
310
|
-
#
|
311
|
-
def self.get_html!(path, name, guid)
|
312
|
-
response = Api::Request.new do |request|
|
313
|
-
request[:sign] = false
|
314
|
-
request[:method] = :DOWNLOAD
|
315
|
-
request[:path] = "/shared/files/#{guid}/html"
|
316
|
-
end.execute!
|
317
|
-
|
318
|
-
filepath = "#{path}/#{name}"
|
319
|
-
Object::File.open(filepath, 'wb') do |file|
|
320
|
-
file.write(response)
|
321
|
-
end
|
322
|
-
|
323
|
-
filepath
|
324
|
-
end
|
325
|
-
|
326
|
-
#
|
327
|
-
# Get file in html.
|
328
|
-
#
|
329
|
-
#@param [String] path
|
330
|
-
#
|
331
|
-
def get_packages!(path)
|
332
|
-
response = Api::Request.new do |request|
|
333
|
-
request[:sign] = false
|
334
|
-
request[:method] = :GET
|
335
|
-
request[:path] = "/shared/packages/#{path}"
|
336
|
-
end.execute!
|
337
|
-
|
338
|
-
Object::File.open(path, 'wb') do |file|
|
339
|
-
file.write(response)
|
340
|
-
end
|
341
|
-
|
342
|
-
path
|
343
|
-
end
|
344
|
-
|
345
|
-
# @attr [Integer] id
|
346
|
-
attr_accessor :id
|
347
|
-
# @attr [String] guid
|
348
|
-
attr_accessor :guid
|
349
|
-
# @attr [String] nickname
|
350
|
-
attr_accessor :nickname
|
351
|
-
# @attr [String] firstname
|
352
|
-
attr_accessor :firstname
|
353
|
-
# @attr [String] lastname
|
354
|
-
attr_accessor :lastname
|
355
|
-
# @attr [String] primary_email
|
356
|
-
attr_accessor :primary_email
|
357
|
-
# @attr [String] private_key
|
358
|
-
attr_accessor :private_key
|
359
|
-
# @attr [String] password_salt
|
360
|
-
attr_accessor :password_salt
|
361
|
-
# @attr [Integer] claimed_id
|
362
|
-
attr_accessor :claimed_id
|
363
|
-
# @attr [String] token
|
364
|
-
attr_accessor :token
|
365
|
-
# @attr [String] storage
|
366
|
-
attr_accessor :storage
|
367
|
-
# @attr [String] photo
|
368
|
-
attr_accessor :photo
|
369
|
-
# @attr [Boolean] active
|
370
|
-
attr_accessor :active
|
371
|
-
# @attr [Boolean] news_enabled
|
372
|
-
attr_accessor :news_enabled
|
373
|
-
# @attr [Time] signed_up_on
|
374
|
-
attr_accessor :signed_up_on
|
375
|
-
# @attr [Integer] color
|
376
|
-
attr_accessor :color
|
377
|
-
# @attr [String] customEmailMessage
|
378
|
-
attr_accessor :customEmailMessage
|
379
|
-
# @attr [Array] roles
|
380
|
-
attr_accessor :roles
|
381
|
-
|
382
|
-
# added in release 1.5.8
|
383
|
-
# @attr [List] avatar
|
384
|
-
attr_accessor :avatar
|
385
|
-
|
386
|
-
# added in release 1.7.0
|
387
|
-
# @attr [Boolean] trial
|
388
|
-
attr_accessor :trial
|
389
|
-
# @attr [Boolean] news_eanbled
|
390
|
-
attr_accessor :news_eanbled
|
391
|
-
# @attr [Boolean] alerts_eanbled
|
392
|
-
attr_accessor :alerts_eanbled
|
393
|
-
# @attr [Boolean] support_eanbled
|
394
|
-
attr_accessor :support_eanbled
|
395
|
-
# @attr [Boolean] support_email
|
396
|
-
attr_accessor :support_email
|
397
|
-
# @attr [String] apps
|
398
|
-
attr_accessor :apps
|
399
|
-
# @attr [Boolean] annotation_branded
|
400
|
-
attr_accessor :annotation_branded
|
401
|
-
# @attr [Boolean] viewer_branded
|
402
|
-
attr_accessor :viewer_branded
|
403
|
-
# @attr [Boolean] is_real_time_broadcast_enabled
|
404
|
-
attr_accessor :is_real_time_broadcast_enabled
|
405
|
-
# @attr [Boolean] is_scroll_broadcast_enabled
|
406
|
-
attr_accessor :is_scroll_broadcast_enabled
|
407
|
-
# @attr [Boolean] is_zoom_broadcast_enabled
|
408
|
-
attr_accessor :is_zoom_broadcast_enabled
|
409
|
-
# @attr [List] annotation_logo
|
410
|
-
attr_accessor :annotation_logo
|
411
|
-
# @attr [List] pointer_tool_cursor
|
412
|
-
attr_accessor :pointer_tool_cursor
|
413
|
-
# @attr [Integer] annotation_header_options
|
414
|
-
attr_accessor :annotation_header_options
|
415
|
-
# @attr [Boolean] is_annotation_navigation_widget_enabled
|
416
|
-
attr_accessor :is_annotation_navigation_widget_enabled
|
417
|
-
# @attr [Boolean] is_annotation_zoom_widget_enabled
|
418
|
-
attr_accessor :is_annotation_zoom_widget_enabled
|
419
|
-
# @attr [Boolean] is_annotation_download_widget_enabled
|
420
|
-
attr_accessor :is_annotation_download_widget_enabled
|
421
|
-
# @attr [Boolean] is_annotation_print_widget_enabled
|
422
|
-
attr_accessor :is_annotation_print_widget_enabled
|
423
|
-
# @attr [Boolean] is_annotation_help_widget_enabled
|
424
|
-
attr_accessor :is_annotation_help_widget_enabled
|
425
|
-
# @attr [Boolean] is_right_panel_enabled
|
426
|
-
attr_accessor :is_right_panel_enabled
|
427
|
-
# @attr [Boolean] is_thumbnails_panel_enabled
|
428
|
-
attr_accessor :is_thumbnails_panel_enabled
|
429
|
-
# @attr [Boolean] is_standard_header_always_shown
|
430
|
-
attr_accessor :is_standard_header_always_shown
|
431
|
-
# @attr [Boolean] is_toolbar_enabled
|
432
|
-
attr_accessor :is_toolbar_enabled
|
433
|
-
# @attr [Boolean] is_text_annotation_button_enabled
|
434
|
-
attr_accessor :is_text_annotation_button_enabled
|
435
|
-
# @attr [Boolean] is_rectangle_annotation_button_enabled
|
436
|
-
attr_accessor :is_rectangle_annotation_button_enabled
|
437
|
-
# @attr [Boolean] is_point_annotation_button_enabled
|
438
|
-
attr_accessor :is_point_annotation_button_enabled
|
439
|
-
# @attr [Boolean] is_strikeout_annotation_button_enabled
|
440
|
-
attr_accessor :is_strikeout_annotation_button_enabled
|
441
|
-
# @attr [Boolean] is_polyline_annotation_button_enabled
|
442
|
-
attr_accessor :is_polyline_annotation_button_enabled
|
443
|
-
# @attr [Boolean] is_typewriter_annotation_button_enabled
|
444
|
-
attr_accessor :is_typewriter_annotation_button_enabled
|
445
|
-
# @attr [Boolean] is_watermark_annotation_button_enabled
|
446
|
-
attr_accessor :is_watermark_annotation_button_enabled
|
447
|
-
# @attr [Boolean] is_annotation_document_name_shown
|
448
|
-
attr_accessor :is_annotation_document_name_shown
|
449
|
-
# @attr [List] annotation_navigation_icons
|
450
|
-
attr_accessor :annotation_navigation_icons
|
451
|
-
# @attr [List] annotation_tool_icons
|
452
|
-
attr_accessor :annotation_tool_icons
|
453
|
-
# @attr [Integer] annotation_background_color
|
454
|
-
attr_accessor :annotation_background_color
|
455
|
-
# @attr [Integer] viewer_logo
|
456
|
-
attr_accessor :viewer_logo
|
457
|
-
# @attr [Integer] viewer_options
|
458
|
-
attr_accessor :viewer_options
|
459
|
-
# @attr [Boolean] is_viewer_navigation_widget_enabled
|
460
|
-
attr_accessor :is_viewer_navigation_widget_enabled
|
461
|
-
# @attr [Boolean] is_viewer_zoom_widget_enabled
|
462
|
-
attr_accessor :is_viewer_zoom_widget_enabled
|
463
|
-
# @attr [Boolean] is_viewer_download_widget_enabled
|
464
|
-
attr_accessor :is_viewer_download_widget_enabled
|
465
|
-
# @attr [Boolean] is_viewer_print_widget_enabled
|
466
|
-
attr_accessor :is_viewer_print_widget_enabled
|
467
|
-
# @attr [Boolean] is_viewer_help_widget_enabled
|
468
|
-
attr_accessor :is_viewer_help_widget_enabled
|
469
|
-
# @attr [Boolean] is_viewer_document_name_shown
|
470
|
-
attr_accessor :is_viewer_document_name_shown
|
471
|
-
# @attr [Boolean] isviewer_right_mouse_button_menu_enabled
|
472
|
-
attr_accessor :isviewer_right_mouse_button_menu_enabled
|
473
|
-
# @attr [Time] signedinOn
|
474
|
-
attr_accessor :signedinOn
|
475
|
-
# @attr [Integer] signin_count
|
476
|
-
attr_accessor :signin_count
|
477
|
-
# @attr [Boolean] signature_watermark_enabled
|
478
|
-
attr_accessor :signature_watermark_enabled
|
479
|
-
# @attr [Boolean] signature_desktop_notifications
|
480
|
-
attr_accessor :signature_desktop_notifications
|
481
|
-
# @attr [Integer] webhook_notification_retries
|
482
|
-
attr_accessor :webhook_notification_retries
|
483
|
-
# @attr [String] webhook_notification_failed_recipients
|
484
|
-
attr_accessor :webhook_notification_failed_recipients
|
485
|
-
# @attr [String] signature_color
|
486
|
-
attr_accessor :signature_color
|
487
|
-
# @attr [Boolean] signature_save_field_changes_automatically
|
488
|
-
attr_accessor :signature_save_field_changes_automatically
|
489
|
-
# @attr [Boolean] signature_use_custom_email_templates
|
490
|
-
attr_accessor :signature_use_custom_email_templates
|
491
|
-
# @attr [String] signature_envelope_sent_owner_template
|
492
|
-
attr_accessor :signature_envelope_sent_owner_template
|
493
|
-
# @attr [String] signature_envelope_sent_other_template
|
494
|
-
attr_accessor :signature_envelope_sent_other_template
|
495
|
-
# @attr [String] signature_envelope_completed_template
|
496
|
-
attr_accessor :signature_envelope_completed_template
|
497
|
-
# @attr [String] signature_envelope_signed_template
|
498
|
-
attr_accessor :signature_envelope_signed_template
|
499
|
-
# @attr [String] signature_envelope_declined_template
|
500
|
-
attr_accessor :signature_envelope_declined_template
|
501
|
-
# @attr [String] signature_envelope_failed_template
|
502
|
-
attr_accessor :signature_envelope_failed_template
|
503
|
-
# @attr [String] signature_envelope_cancelled_template
|
504
|
-
attr_accessor :signature_envelope_cancelled_template
|
505
|
-
# @attr [String] signature_envelope_expired_template
|
506
|
-
attr_accessor :signature_envelope_expired_template
|
507
|
-
# @attr [String] signature_envelope_step_expired_template
|
508
|
-
attr_accessor :signature_envelope_step_expired_template
|
509
|
-
# @attr [String] signature_envelope_recipient_reminder_template
|
510
|
-
attr_accessor :signature_envelope_recipient_reminder_template
|
511
|
-
# @attr [String] signature_form_signed_template
|
512
|
-
attr_accessor :signature_form_signed_template
|
513
|
-
# @attr [Boolean] signature_form_require_user_auth_for_sign
|
514
|
-
attr_accessor :signature_form_require_user_auth_for_sign
|
515
|
-
# @attr [Boolean] signature_form_request_user_auth_by_photo
|
516
|
-
attr_accessor :signature_form_request_user_auth_by_photo
|
517
|
-
# @attr [Boolean] signature_form_require_user_identity_validation
|
518
|
-
attr_accessor :signature_form_require_user_identity_validation
|
519
|
-
# @attr [Boolean] signature_envelope_require_user_auth_for_sign
|
520
|
-
attr_accessor :signature_envelope_require_user_auth_for_sign
|
521
|
-
# @attr [Boolean] signature_envelope_request_user_auth_by_photo
|
522
|
-
attr_accessor :signature_envelope_request_user_auth_by_photo
|
523
|
-
# @attr [Boolean] signature_enable_uploaded_signature
|
524
|
-
attr_accessor :signature_enable_uploaded_signature
|
525
|
-
# @attr [Boolean] signature_enable_typed_signature
|
526
|
-
attr_accessor :signature_enable_typed_signature
|
527
|
-
# @attr [Boolean] signature_enable_envelope_comment
|
528
|
-
attr_accessor :signature_enable_envelope_comment
|
529
|
-
# @attr [Boolean] signature_enable_form_comment
|
530
|
-
attr_accessor :signature_enable_form_comment
|
531
|
-
|
532
|
-
# added in release 1.9.0
|
533
|
-
# @attr [Boolean] is_text_replacement_annotation_button_enabled
|
534
|
-
attr_accessor :is_text_replacement_annotation_button_enabled
|
535
|
-
# @attr [Boolean] is_arrow_annotation_button_enabled
|
536
|
-
attr_accessor :is_arrow_annotation_button_enabled
|
537
|
-
# @attr [Boolean] is_text_redaction_annotation_button_enabled
|
538
|
-
attr_accessor :is_text_redaction_annotation_button_enabled
|
539
|
-
# @attr [Boolean] is_resource_redaction_annotation_button_enabled
|
540
|
-
attr_accessor :is_resource_redaction_annotation_button_enabled
|
541
|
-
# @attr [Boolean] is_text_underline_annotation_button_enabled
|
542
|
-
attr_accessor :is_text_underline_annotation_button_enabled
|
543
|
-
# @attr [Boolean] is_distance_annotation_button_enabled
|
544
|
-
attr_accessor :is_distance_annotation_button_enabled
|
545
|
-
|
546
|
-
|
547
|
-
#
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
#
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
#
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
#
|
576
|
-
#
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
592
|
-
#
|
593
|
-
# user.
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
#
|
598
|
-
#
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
request[:
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
#
|
612
|
-
#
|
613
|
-
#
|
614
|
-
#
|
615
|
-
# user.
|
616
|
-
#
|
617
|
-
#
|
618
|
-
#
|
619
|
-
# @
|
620
|
-
#
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
request[:
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
#
|
634
|
-
#
|
635
|
-
#
|
636
|
-
# @param [
|
637
|
-
# @
|
638
|
-
# @option
|
639
|
-
# @
|
640
|
-
#
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
#
|
656
|
-
#
|
657
|
-
#
|
658
|
-
# @param [
|
659
|
-
# @
|
660
|
-
# @option
|
661
|
-
# @
|
662
|
-
#
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
#
|
678
|
-
#
|
679
|
-
#
|
680
|
-
# @
|
681
|
-
#
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
#
|
698
|
-
#
|
699
|
-
#
|
700
|
-
# @param [
|
701
|
-
# @
|
702
|
-
# @option
|
703
|
-
# @
|
704
|
-
#
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
#
|
720
|
-
#
|
721
|
-
#
|
722
|
-
# @
|
723
|
-
# @
|
724
|
-
#
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
#
|
739
|
-
#
|
740
|
-
#
|
741
|
-
# @
|
742
|
-
# @
|
743
|
-
#
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
request[:
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
#
|
759
|
-
#
|
760
|
-
#
|
761
|
-
# @
|
762
|
-
# @
|
763
|
-
#
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
request[:
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
#
|
778
|
-
#
|
779
|
-
#
|
780
|
-
# @param [
|
781
|
-
# @
|
782
|
-
# @option
|
783
|
-
# @
|
784
|
-
#
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
#
|
800
|
-
#
|
801
|
-
#
|
802
|
-
#
|
803
|
-
# user.
|
804
|
-
#
|
805
|
-
#
|
806
|
-
#
|
807
|
-
#
|
808
|
-
# @
|
809
|
-
# @
|
810
|
-
#
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
request[:
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
#
|
826
|
-
#
|
827
|
-
#
|
828
|
-
# @
|
829
|
-
#
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
#
|
844
|
-
#
|
845
|
-
#
|
846
|
-
# @
|
847
|
-
#
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
#
|
862
|
-
#
|
863
|
-
#
|
864
|
-
# @
|
865
|
-
# @
|
866
|
-
#
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
#
|
881
|
-
#
|
882
|
-
#
|
883
|
-
# @
|
884
|
-
# @
|
885
|
-
# @
|
886
|
-
#
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
request[:
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
#
|
901
|
-
#
|
902
|
-
#
|
903
|
-
# @
|
904
|
-
#
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
#
|
917
|
-
#
|
918
|
-
#
|
919
|
-
# @
|
920
|
-
#
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
end
|
1
|
+
module GroupDocs
|
2
|
+
class User < Api::Entity
|
3
|
+
|
4
|
+
include Api::Helpers::AccessRights
|
5
|
+
|
6
|
+
#
|
7
|
+
# Returns current user profile.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# user = GroupDocs::User.get!
|
11
|
+
# user.first_name
|
12
|
+
# #=> "John"
|
13
|
+
#
|
14
|
+
# @param [Hash] access Access credentials
|
15
|
+
# @option access [String] :client_id
|
16
|
+
# @option access [String] :private_key
|
17
|
+
# @return [GroupDocs::User]
|
18
|
+
#
|
19
|
+
def self.get!(access = {})
|
20
|
+
json = Api::Request.new do |request|
|
21
|
+
request[:access] = access
|
22
|
+
request[:method] = :GET
|
23
|
+
request[:path] = '/mgmt/{{client_id}}/profile'
|
24
|
+
end.execute!
|
25
|
+
|
26
|
+
new(json[:user])
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Updates user account if it's created, otherwise creates new.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# user = GroupDocs::User.new
|
34
|
+
# user.primary_email = 'john@smith.com'
|
35
|
+
# user.nickname = 'johnsmith'
|
36
|
+
# user.first_name = 'John'
|
37
|
+
# user.last_name = 'Smith'
|
38
|
+
# # make sure to save user as it has updated attributes
|
39
|
+
# user = GroupDocs::User.update_account!(user)
|
40
|
+
#
|
41
|
+
# @param [GroupDocs::User] user
|
42
|
+
# @param [Hash] access Access credentials
|
43
|
+
# @option access [String] :client_id
|
44
|
+
# @option access [String] :private_key
|
45
|
+
# @return [GroupDocs::User]
|
46
|
+
#
|
47
|
+
def self.update_account!(user, access = {})
|
48
|
+
user.is_a?(GroupDocs::User) or raise ArgumentError,
|
49
|
+
"User should be GroupDocs::User object, received: #{user.inspect}"
|
50
|
+
|
51
|
+
data = user.to_hash
|
52
|
+
|
53
|
+
json = Api::Request.new do |request|
|
54
|
+
request[:access] = access
|
55
|
+
request[:method] = :PUT
|
56
|
+
request[:path] = "/mgmt/{{client_id}}/account/users/#{user.nickname}"
|
57
|
+
request[:request_body] = data
|
58
|
+
end.execute!
|
59
|
+
|
60
|
+
GroupDocs::User.new data.merge(json)
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Delete account user.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# user = GroupDocs::User.get!
|
68
|
+
# GroupDocs::User.delete!(user.users!.last)
|
69
|
+
# #=> "826e3b54e009ce51"
|
70
|
+
#
|
71
|
+
# @param [GroupDocs::User] user
|
72
|
+
# @param [Hash] access Access credentials
|
73
|
+
# @option access [String] :client_id
|
74
|
+
# @option access [String] :private_key
|
75
|
+
# @return [String]
|
76
|
+
#
|
77
|
+
# @raise [ArgumentError] if user is not GroupDocs::User object
|
78
|
+
#
|
79
|
+
def self.delete!(user, access = {})
|
80
|
+
user.is_a?(GroupDocs::User) or raise ArgumentError,
|
81
|
+
"User should be GroupDocs::User object, received: #{user.inspect}"
|
82
|
+
|
83
|
+
json = Api::Request.new do |request|
|
84
|
+
request[:access] = access
|
85
|
+
request[:method] = :DELETE
|
86
|
+
request[:path] = "/mgmt/{{client_id}}/account/users/#{user.primary_email}"
|
87
|
+
end.execute!
|
88
|
+
|
89
|
+
json[:guid]
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Generates new user embed key.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# GroupDocs::User.generate_embed_key!('test-area')
|
97
|
+
# #=> "60a06ef8f23a49cf807977f1444fbdd8"
|
98
|
+
#
|
99
|
+
# @param [String] area
|
100
|
+
# @param [Hash] access Access credentials
|
101
|
+
# @option access [String] :client_id
|
102
|
+
# @option access [String] :private_key
|
103
|
+
# @return [String]
|
104
|
+
#
|
105
|
+
def self.generate_embed_key!(area, access = {})
|
106
|
+
json = Api::Request.new do |request|
|
107
|
+
request[:access] = access
|
108
|
+
request[:method] = :GET
|
109
|
+
request[:path] = "/mgmt/{{client_id}}/embedkey/new/#{area}"
|
110
|
+
end.execute!
|
111
|
+
|
112
|
+
json[:key][:guid]
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# Get user embed key. Generate new embed key if area not exists.
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
# GroupDocs::User.get_embed_key!('test-area')
|
120
|
+
# #=> "60a06ef8f23a49cf807977f1444fbdd8"
|
121
|
+
#
|
122
|
+
# @param [String] area
|
123
|
+
# @param [Hash] access Access credentials
|
124
|
+
# @option access [String] :client_id
|
125
|
+
# @option access [String] :private_key
|
126
|
+
# @return [String]
|
127
|
+
#
|
128
|
+
def self.get_embed_key!(area, access = {})
|
129
|
+
json = Api::Request.new do |request|
|
130
|
+
request[:access] = access
|
131
|
+
request[:method] = :GET
|
132
|
+
request[:path] = "/mgmt/{{client_id}}/embedkey/#{area}"
|
133
|
+
end.execute!
|
134
|
+
|
135
|
+
json[:key][:guid]
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Get area name by embed key.
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# GroupDocs::User.area!('60a06eg8f23a49cf807977f1444fbdd8')
|
143
|
+
# #=> "test-area"
|
144
|
+
#
|
145
|
+
# @param [String] embed_key
|
146
|
+
# @param [Hash] access Access credentials
|
147
|
+
# @option access [String] :client_id
|
148
|
+
# @option access [String] :private_key
|
149
|
+
# @return [String]
|
150
|
+
#
|
151
|
+
def self.area!(embed_key, access = {})
|
152
|
+
json = Api::Request.new do |request|
|
153
|
+
request[:access] = access
|
154
|
+
request[:method] = :GET
|
155
|
+
request[:path] = "/mgmt/{{client_id}}/embedkey/guid/#{embed_key}"
|
156
|
+
end.execute!
|
157
|
+
|
158
|
+
json[:key][:area]
|
159
|
+
end
|
160
|
+
|
161
|
+
#
|
162
|
+
# Returns an array of storage providers.
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# providers = GroupDocs::User.providers!
|
166
|
+
# providers.first.provider
|
167
|
+
# #=> "Dropbox"
|
168
|
+
#
|
169
|
+
# @param [Hash] access Access credentials
|
170
|
+
# @option access [String] :client_id
|
171
|
+
# @option access [String] :private_key
|
172
|
+
# @return [Array<GroupDocs::Storage::Provider>]
|
173
|
+
#
|
174
|
+
def self.providers!(access = {})
|
175
|
+
json = Api::Request.new do |request|
|
176
|
+
request[:access] = access
|
177
|
+
request[:method] = :GET
|
178
|
+
request[:path] = '/mgmt/{{client_id}}/storages'
|
179
|
+
end.execute!
|
180
|
+
|
181
|
+
json[:providers].map do |provider|
|
182
|
+
Storage::Provider.new(provider)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
#
|
187
|
+
# Adds a new storage provider configuration.
|
188
|
+
#
|
189
|
+
# @param [String] provider Storage provider name
|
190
|
+
# @param [Hash] access Access credentials
|
191
|
+
# @param [Array] provider_info
|
192
|
+
# @option access [String] :client_id
|
193
|
+
# @option access [String] :private_key
|
194
|
+
#
|
195
|
+
def add_provider!(provider, provider_info = {}, access = {})
|
196
|
+
Api::Request.new do |request|
|
197
|
+
request[:access] = access
|
198
|
+
request[:method] = :POST
|
199
|
+
request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
|
200
|
+
request[:request_body] = provider_info
|
201
|
+
end.execute!
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
#
|
206
|
+
# Updates user's storage provider configuration.
|
207
|
+
#
|
208
|
+
# @param [String] provider Storage provider name
|
209
|
+
# @param [Hash] access Access credentials
|
210
|
+
# @param [Array] provider_info
|
211
|
+
# @option access [String] :client_id
|
212
|
+
# @option access [String] :private_key
|
213
|
+
#
|
214
|
+
def update_provider!(provider, provider_info = {}, access = {})
|
215
|
+
Api::Request.new do |request|
|
216
|
+
request[:access] = access
|
217
|
+
request[:method] = :PUT
|
218
|
+
request[:path] = "/mgmt/{{client_id}}/storages/#{provider}"
|
219
|
+
request[:request_body] = provider_info
|
220
|
+
end.execute!
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
#
|
226
|
+
# Revoke.
|
227
|
+
#
|
228
|
+
# @param [Hash] access Access credentials
|
229
|
+
# @option access [String] :client_id
|
230
|
+
# @option access [String] :private_key
|
231
|
+
#
|
232
|
+
def self.revoke!(access = {})
|
233
|
+
Api::Request.new do |request|
|
234
|
+
request[:access] = access
|
235
|
+
request[:method] = :PUT
|
236
|
+
request[:path] = "/mgmt/{{client_id}}/revoke"
|
237
|
+
end.execute!
|
238
|
+
|
239
|
+
end
|
240
|
+
#
|
241
|
+
# Logins user using user name and password.
|
242
|
+
#
|
243
|
+
# @example
|
244
|
+
# user = GroupDocs::User.login!('doe@john.com', 'password')
|
245
|
+
# user.first_name
|
246
|
+
# #=> "John"
|
247
|
+
#
|
248
|
+
# @return [GroupDocs::User]
|
249
|
+
#
|
250
|
+
def self.login!(email, password)
|
251
|
+
json = Api::Request.new do |request|
|
252
|
+
request[:sign] = false
|
253
|
+
request[:method] = :POST
|
254
|
+
request[:path] = "/shared/users/#{email}/logins"
|
255
|
+
request[:request_body] = password
|
256
|
+
end.execute!
|
257
|
+
|
258
|
+
new(json[:user])
|
259
|
+
end
|
260
|
+
|
261
|
+
#
|
262
|
+
# Logins user using user name and password.
|
263
|
+
#
|
264
|
+
# @param [String]guid
|
265
|
+
# @param [Hash] options
|
266
|
+
# @option [String] :filename File name
|
267
|
+
# @option [Boolean] :render Render
|
268
|
+
#
|
269
|
+
def self.download!(path, name, guid, options = {})
|
270
|
+
api = Api::Request.new do |request|
|
271
|
+
request[:sign] = false
|
272
|
+
request[:method] = :DOWNLOAD
|
273
|
+
request[:path] = "/shared/files/#{guid}"
|
274
|
+
end
|
275
|
+
api.add_params(options)
|
276
|
+
response = api.execute!
|
277
|
+
|
278
|
+
filepath = "#{path}/#{name}"
|
279
|
+
Object::File.open(filepath, 'wb') do |file|
|
280
|
+
file.write(response)
|
281
|
+
end
|
282
|
+
|
283
|
+
filepath
|
284
|
+
end
|
285
|
+
|
286
|
+
#
|
287
|
+
# Get file in xml.
|
288
|
+
#
|
289
|
+
#@param [String] guid
|
290
|
+
#
|
291
|
+
def self.get_xml!(path, name, guid)
|
292
|
+
response = Api::Request.new do |request|
|
293
|
+
request[:sign] = false
|
294
|
+
request[:method] = :DOWNLOAD
|
295
|
+
request[:path] = "/shared/files/#{guid}/xml"
|
296
|
+
end.execute!
|
297
|
+
|
298
|
+
filepath = "#{path}/#{name}"
|
299
|
+
Object::File.open(filepath, 'wb') do |file|
|
300
|
+
file.write(response)
|
301
|
+
end
|
302
|
+
|
303
|
+
filepath
|
304
|
+
end
|
305
|
+
|
306
|
+
#
|
307
|
+
# Get file in html.
|
308
|
+
#
|
309
|
+
#@param [String] guid
|
310
|
+
#
|
311
|
+
def self.get_html!(path, name, guid)
|
312
|
+
response = Api::Request.new do |request|
|
313
|
+
request[:sign] = false
|
314
|
+
request[:method] = :DOWNLOAD
|
315
|
+
request[:path] = "/shared/files/#{guid}/html"
|
316
|
+
end.execute!
|
317
|
+
|
318
|
+
filepath = "#{path}/#{name}"
|
319
|
+
Object::File.open(filepath, 'wb') do |file|
|
320
|
+
file.write(response)
|
321
|
+
end
|
322
|
+
|
323
|
+
filepath
|
324
|
+
end
|
325
|
+
|
326
|
+
#
|
327
|
+
# Get file in html.
|
328
|
+
#
|
329
|
+
#@param [String] path
|
330
|
+
#
|
331
|
+
def get_packages!(path)
|
332
|
+
response = Api::Request.new do |request|
|
333
|
+
request[:sign] = false
|
334
|
+
request[:method] = :GET
|
335
|
+
request[:path] = "/shared/packages/#{path}"
|
336
|
+
end.execute!
|
337
|
+
|
338
|
+
Object::File.open(path, 'wb') do |file|
|
339
|
+
file.write(response)
|
340
|
+
end
|
341
|
+
|
342
|
+
path
|
343
|
+
end
|
344
|
+
|
345
|
+
# @attr [Integer] id
|
346
|
+
attr_accessor :id
|
347
|
+
# @attr [String] guid
|
348
|
+
attr_accessor :guid
|
349
|
+
# @attr [String] nickname
|
350
|
+
attr_accessor :nickname
|
351
|
+
# @attr [String] firstname
|
352
|
+
attr_accessor :firstname
|
353
|
+
# @attr [String] lastname
|
354
|
+
attr_accessor :lastname
|
355
|
+
# @attr [String] primary_email
|
356
|
+
attr_accessor :primary_email
|
357
|
+
# @attr [String] private_key
|
358
|
+
attr_accessor :private_key
|
359
|
+
# @attr [String] password_salt
|
360
|
+
attr_accessor :password_salt
|
361
|
+
# @attr [Integer] claimed_id
|
362
|
+
attr_accessor :claimed_id
|
363
|
+
# @attr [String] token
|
364
|
+
attr_accessor :token
|
365
|
+
# @attr [String] storage
|
366
|
+
attr_accessor :storage
|
367
|
+
# @attr [String] photo
|
368
|
+
attr_accessor :photo
|
369
|
+
# @attr [Boolean] active
|
370
|
+
attr_accessor :active
|
371
|
+
# @attr [Boolean] news_enabled
|
372
|
+
attr_accessor :news_enabled
|
373
|
+
# @attr [Time] signed_up_on
|
374
|
+
attr_accessor :signed_up_on
|
375
|
+
# @attr [Integer] color
|
376
|
+
attr_accessor :color
|
377
|
+
# @attr [String] customEmailMessage
|
378
|
+
attr_accessor :customEmailMessage
|
379
|
+
# @attr [Array] roles
|
380
|
+
attr_accessor :roles
|
381
|
+
|
382
|
+
# added in release 1.5.8
|
383
|
+
# @attr [List] avatar
|
384
|
+
attr_accessor :avatar
|
385
|
+
|
386
|
+
# added in release 1.7.0
|
387
|
+
# @attr [Boolean] trial
|
388
|
+
attr_accessor :trial
|
389
|
+
# @attr [Boolean] news_eanbled
|
390
|
+
attr_accessor :news_eanbled
|
391
|
+
# @attr [Boolean] alerts_eanbled
|
392
|
+
attr_accessor :alerts_eanbled
|
393
|
+
# @attr [Boolean] support_eanbled
|
394
|
+
attr_accessor :support_eanbled
|
395
|
+
# @attr [Boolean] support_email
|
396
|
+
attr_accessor :support_email
|
397
|
+
# @attr [String] apps
|
398
|
+
attr_accessor :apps
|
399
|
+
# @attr [Boolean] annotation_branded
|
400
|
+
attr_accessor :annotation_branded
|
401
|
+
# @attr [Boolean] viewer_branded
|
402
|
+
attr_accessor :viewer_branded
|
403
|
+
# @attr [Boolean] is_real_time_broadcast_enabled
|
404
|
+
attr_accessor :is_real_time_broadcast_enabled
|
405
|
+
# @attr [Boolean] is_scroll_broadcast_enabled
|
406
|
+
attr_accessor :is_scroll_broadcast_enabled
|
407
|
+
# @attr [Boolean] is_zoom_broadcast_enabled
|
408
|
+
attr_accessor :is_zoom_broadcast_enabled
|
409
|
+
# @attr [List] annotation_logo
|
410
|
+
attr_accessor :annotation_logo
|
411
|
+
# @attr [List] pointer_tool_cursor
|
412
|
+
attr_accessor :pointer_tool_cursor
|
413
|
+
# @attr [Integer] annotation_header_options
|
414
|
+
attr_accessor :annotation_header_options
|
415
|
+
# @attr [Boolean] is_annotation_navigation_widget_enabled
|
416
|
+
attr_accessor :is_annotation_navigation_widget_enabled
|
417
|
+
# @attr [Boolean] is_annotation_zoom_widget_enabled
|
418
|
+
attr_accessor :is_annotation_zoom_widget_enabled
|
419
|
+
# @attr [Boolean] is_annotation_download_widget_enabled
|
420
|
+
attr_accessor :is_annotation_download_widget_enabled
|
421
|
+
# @attr [Boolean] is_annotation_print_widget_enabled
|
422
|
+
attr_accessor :is_annotation_print_widget_enabled
|
423
|
+
# @attr [Boolean] is_annotation_help_widget_enabled
|
424
|
+
attr_accessor :is_annotation_help_widget_enabled
|
425
|
+
# @attr [Boolean] is_right_panel_enabled
|
426
|
+
attr_accessor :is_right_panel_enabled
|
427
|
+
# @attr [Boolean] is_thumbnails_panel_enabled
|
428
|
+
attr_accessor :is_thumbnails_panel_enabled
|
429
|
+
# @attr [Boolean] is_standard_header_always_shown
|
430
|
+
attr_accessor :is_standard_header_always_shown
|
431
|
+
# @attr [Boolean] is_toolbar_enabled
|
432
|
+
attr_accessor :is_toolbar_enabled
|
433
|
+
# @attr [Boolean] is_text_annotation_button_enabled
|
434
|
+
attr_accessor :is_text_annotation_button_enabled
|
435
|
+
# @attr [Boolean] is_rectangle_annotation_button_enabled
|
436
|
+
attr_accessor :is_rectangle_annotation_button_enabled
|
437
|
+
# @attr [Boolean] is_point_annotation_button_enabled
|
438
|
+
attr_accessor :is_point_annotation_button_enabled
|
439
|
+
# @attr [Boolean] is_strikeout_annotation_button_enabled
|
440
|
+
attr_accessor :is_strikeout_annotation_button_enabled
|
441
|
+
# @attr [Boolean] is_polyline_annotation_button_enabled
|
442
|
+
attr_accessor :is_polyline_annotation_button_enabled
|
443
|
+
# @attr [Boolean] is_typewriter_annotation_button_enabled
|
444
|
+
attr_accessor :is_typewriter_annotation_button_enabled
|
445
|
+
# @attr [Boolean] is_watermark_annotation_button_enabled
|
446
|
+
attr_accessor :is_watermark_annotation_button_enabled
|
447
|
+
# @attr [Boolean] is_annotation_document_name_shown
|
448
|
+
attr_accessor :is_annotation_document_name_shown
|
449
|
+
# @attr [List] annotation_navigation_icons
|
450
|
+
attr_accessor :annotation_navigation_icons
|
451
|
+
# @attr [List] annotation_tool_icons
|
452
|
+
attr_accessor :annotation_tool_icons
|
453
|
+
# @attr [Integer] annotation_background_color
|
454
|
+
attr_accessor :annotation_background_color
|
455
|
+
# @attr [Integer] viewer_logo
|
456
|
+
attr_accessor :viewer_logo
|
457
|
+
# @attr [Integer] viewer_options
|
458
|
+
attr_accessor :viewer_options
|
459
|
+
# @attr [Boolean] is_viewer_navigation_widget_enabled
|
460
|
+
attr_accessor :is_viewer_navigation_widget_enabled
|
461
|
+
# @attr [Boolean] is_viewer_zoom_widget_enabled
|
462
|
+
attr_accessor :is_viewer_zoom_widget_enabled
|
463
|
+
# @attr [Boolean] is_viewer_download_widget_enabled
|
464
|
+
attr_accessor :is_viewer_download_widget_enabled
|
465
|
+
# @attr [Boolean] is_viewer_print_widget_enabled
|
466
|
+
attr_accessor :is_viewer_print_widget_enabled
|
467
|
+
# @attr [Boolean] is_viewer_help_widget_enabled
|
468
|
+
attr_accessor :is_viewer_help_widget_enabled
|
469
|
+
# @attr [Boolean] is_viewer_document_name_shown
|
470
|
+
attr_accessor :is_viewer_document_name_shown
|
471
|
+
# @attr [Boolean] isviewer_right_mouse_button_menu_enabled
|
472
|
+
attr_accessor :isviewer_right_mouse_button_menu_enabled
|
473
|
+
# @attr [Time] signedinOn
|
474
|
+
attr_accessor :signedinOn
|
475
|
+
# @attr [Integer] signin_count
|
476
|
+
attr_accessor :signin_count
|
477
|
+
# @attr [Boolean] signature_watermark_enabled
|
478
|
+
attr_accessor :signature_watermark_enabled
|
479
|
+
# @attr [Boolean] signature_desktop_notifications
|
480
|
+
attr_accessor :signature_desktop_notifications
|
481
|
+
# @attr [Integer] webhook_notification_retries
|
482
|
+
attr_accessor :webhook_notification_retries
|
483
|
+
# @attr [String] webhook_notification_failed_recipients
|
484
|
+
attr_accessor :webhook_notification_failed_recipients
|
485
|
+
# @attr [String] signature_color
|
486
|
+
attr_accessor :signature_color
|
487
|
+
# @attr [Boolean] signature_save_field_changes_automatically
|
488
|
+
attr_accessor :signature_save_field_changes_automatically
|
489
|
+
# @attr [Boolean] signature_use_custom_email_templates
|
490
|
+
attr_accessor :signature_use_custom_email_templates
|
491
|
+
# @attr [String] signature_envelope_sent_owner_template
|
492
|
+
attr_accessor :signature_envelope_sent_owner_template
|
493
|
+
# @attr [String] signature_envelope_sent_other_template
|
494
|
+
attr_accessor :signature_envelope_sent_other_template
|
495
|
+
# @attr [String] signature_envelope_completed_template
|
496
|
+
attr_accessor :signature_envelope_completed_template
|
497
|
+
# @attr [String] signature_envelope_signed_template
|
498
|
+
attr_accessor :signature_envelope_signed_template
|
499
|
+
# @attr [String] signature_envelope_declined_template
|
500
|
+
attr_accessor :signature_envelope_declined_template
|
501
|
+
# @attr [String] signature_envelope_failed_template
|
502
|
+
attr_accessor :signature_envelope_failed_template
|
503
|
+
# @attr [String] signature_envelope_cancelled_template
|
504
|
+
attr_accessor :signature_envelope_cancelled_template
|
505
|
+
# @attr [String] signature_envelope_expired_template
|
506
|
+
attr_accessor :signature_envelope_expired_template
|
507
|
+
# @attr [String] signature_envelope_step_expired_template
|
508
|
+
attr_accessor :signature_envelope_step_expired_template
|
509
|
+
# @attr [String] signature_envelope_recipient_reminder_template
|
510
|
+
attr_accessor :signature_envelope_recipient_reminder_template
|
511
|
+
# @attr [String] signature_form_signed_template
|
512
|
+
attr_accessor :signature_form_signed_template
|
513
|
+
# @attr [Boolean] signature_form_require_user_auth_for_sign
|
514
|
+
attr_accessor :signature_form_require_user_auth_for_sign
|
515
|
+
# @attr [Boolean] signature_form_request_user_auth_by_photo
|
516
|
+
attr_accessor :signature_form_request_user_auth_by_photo
|
517
|
+
# @attr [Boolean] signature_form_require_user_identity_validation
|
518
|
+
attr_accessor :signature_form_require_user_identity_validation
|
519
|
+
# @attr [Boolean] signature_envelope_require_user_auth_for_sign
|
520
|
+
attr_accessor :signature_envelope_require_user_auth_for_sign
|
521
|
+
# @attr [Boolean] signature_envelope_request_user_auth_by_photo
|
522
|
+
attr_accessor :signature_envelope_request_user_auth_by_photo
|
523
|
+
# @attr [Boolean] signature_enable_uploaded_signature
|
524
|
+
attr_accessor :signature_enable_uploaded_signature
|
525
|
+
# @attr [Boolean] signature_enable_typed_signature
|
526
|
+
attr_accessor :signature_enable_typed_signature
|
527
|
+
# @attr [Boolean] signature_enable_envelope_comment
|
528
|
+
attr_accessor :signature_enable_envelope_comment
|
529
|
+
# @attr [Boolean] signature_enable_form_comment
|
530
|
+
attr_accessor :signature_enable_form_comment
|
531
|
+
|
532
|
+
# added in release 1.9.0
|
533
|
+
# @attr [Boolean] is_text_replacement_annotation_button_enabled
|
534
|
+
attr_accessor :is_text_replacement_annotation_button_enabled
|
535
|
+
# @attr [Boolean] is_arrow_annotation_button_enabled
|
536
|
+
attr_accessor :is_arrow_annotation_button_enabled
|
537
|
+
# @attr [Boolean] is_text_redaction_annotation_button_enabled
|
538
|
+
attr_accessor :is_text_redaction_annotation_button_enabled
|
539
|
+
# @attr [Boolean] is_resource_redaction_annotation_button_enabled
|
540
|
+
attr_accessor :is_resource_redaction_annotation_button_enabled
|
541
|
+
# @attr [Boolean] is_text_underline_annotation_button_enabled
|
542
|
+
attr_accessor :is_text_underline_annotation_button_enabled
|
543
|
+
# @attr [Boolean] is_distance_annotation_button_enabled
|
544
|
+
attr_accessor :is_distance_annotation_button_enabled
|
545
|
+
|
546
|
+
# added in release 2.3.0
|
547
|
+
# @attr [Boolean] is_viewer_search_widget_enabled
|
548
|
+
attr_accessor :is_viewer_search_widget_enabled
|
549
|
+
|
550
|
+
# Human-readable accessors
|
551
|
+
alias_accessor :first_name, :firstname
|
552
|
+
alias_accessor :last_name, :lastname
|
553
|
+
alias_accessor :custom_email_message, :customEmailMessage
|
554
|
+
|
555
|
+
|
556
|
+
#
|
557
|
+
# Converts access rights to human-readable format flag.
|
558
|
+
# @return [Array<Symbol>]
|
559
|
+
#
|
560
|
+
def access_rights
|
561
|
+
convert_byte_to_access_rights @access_rights if @access_rights
|
562
|
+
end
|
563
|
+
|
564
|
+
#
|
565
|
+
# Converts access rights to machine-readable format flag.
|
566
|
+
# @param [Array<Symbol>] rights
|
567
|
+
#
|
568
|
+
def access_rights=(rights)
|
569
|
+
if rights.is_a?(Array)
|
570
|
+
rights = convert_access_rights_to_byte(rights)
|
571
|
+
end
|
572
|
+
@access_rights = rights
|
573
|
+
end
|
574
|
+
|
575
|
+
#
|
576
|
+
# Converts timestamp which is return by API server to Time object.
|
577
|
+
#
|
578
|
+
# @return [Time]
|
579
|
+
#
|
580
|
+
def signed_up_on
|
581
|
+
Time.at(@signed_up_on / 1000)
|
582
|
+
end
|
583
|
+
|
584
|
+
# Compatibility with response JSON
|
585
|
+
alias_method :pkey=, :private_key=
|
586
|
+
alias_method :pswd_salt=, :password_salt=
|
587
|
+
alias_method :signedupOn=, :signed_up_on=
|
588
|
+
|
589
|
+
#
|
590
|
+
# Updates user profile.
|
591
|
+
#
|
592
|
+
# @example
|
593
|
+
# user = GroupDocs::User.get!
|
594
|
+
# user.first_name = 'John'
|
595
|
+
# user.last_name = 'Smith'
|
596
|
+
# user.update!
|
597
|
+
#
|
598
|
+
# @param [Hash] access Access credentials
|
599
|
+
# @option access [String] :client_id
|
600
|
+
# @option access [String] :private_key
|
601
|
+
#
|
602
|
+
def update!(access = {})
|
603
|
+
Api::Request.new do |request|
|
604
|
+
request[:access] = access
|
605
|
+
request[:method] = :PUT
|
606
|
+
request[:path] = '/mgmt/{{client_id}}/profile'
|
607
|
+
request[:request_body] = to_hash
|
608
|
+
end.execute!
|
609
|
+
end
|
610
|
+
|
611
|
+
#
|
612
|
+
# Updates user profile.
|
613
|
+
#
|
614
|
+
# @example
|
615
|
+
# user = GroupDocs::User.get!
|
616
|
+
# old_password = user.password_salt
|
617
|
+
# new_password = 'Smith'
|
618
|
+
# user.update_password!
|
619
|
+
# @param [Array] pas_info ([old_password, new_password, reset_token])
|
620
|
+
# @param [Hash] access Access credentials
|
621
|
+
# @option access [String] :client_id
|
622
|
+
# @option access [String] :private_key
|
623
|
+
#
|
624
|
+
def self.update_password!(pas_info = {}, access = {})
|
625
|
+
Api::Request.new do |request|
|
626
|
+
request[:access] = access
|
627
|
+
request[:method] = :PUT
|
628
|
+
request[:path] = '/mgmt/{{client_id}}/profile/password'
|
629
|
+
request[:request_body] = pas_info
|
630
|
+
end.execute!
|
631
|
+
end
|
632
|
+
|
633
|
+
#
|
634
|
+
# Get user profile by reset token
|
635
|
+
#
|
636
|
+
# @param [String] callerId
|
637
|
+
# @param [Array] options
|
638
|
+
# @option [Hash] :token
|
639
|
+
# @param [Hash] access Access credentials
|
640
|
+
# @option access [String] :client_id
|
641
|
+
# @option access [String] :private_key
|
642
|
+
# @return [String]
|
643
|
+
#
|
644
|
+
def self.reset_token!(caller_id, options ={}, access = {})
|
645
|
+
api = Api::Request.new do |request|
|
646
|
+
request[:access] = access
|
647
|
+
request[:method] = :GET
|
648
|
+
request[:path] = "/mgmt/#{caller_id}/reset-tokens"
|
649
|
+
end
|
650
|
+
api.add_params(options)
|
651
|
+
api.execute!
|
652
|
+
|
653
|
+
end
|
654
|
+
|
655
|
+
#
|
656
|
+
# Get user profile by reset token
|
657
|
+
#
|
658
|
+
# @param [String] callerId
|
659
|
+
# @param [Array] options
|
660
|
+
# @option [Hash] :token
|
661
|
+
# @param [Hash] access Access credentials
|
662
|
+
# @option access [String] :client_id
|
663
|
+
# @option access [String] :private_key
|
664
|
+
# @return [String]
|
665
|
+
#
|
666
|
+
def self.verif_token!(caller_id, options ={}, access = {})
|
667
|
+
api = Api::Request.new do |request|
|
668
|
+
request[:access] = access
|
669
|
+
request[:method] = :GET
|
670
|
+
request[:path] = "/mgmt/#{caller_id}/verif-tokens"
|
671
|
+
end
|
672
|
+
api.add_params(options)
|
673
|
+
api.execute!
|
674
|
+
|
675
|
+
end
|
676
|
+
|
677
|
+
#
|
678
|
+
# Get user profile by verif token
|
679
|
+
#
|
680
|
+
# @param [Hash] access Access credentials
|
681
|
+
# @option access [String] :client_id
|
682
|
+
# @option access [String] :private_key
|
683
|
+
# @return [Array<GroupDocs::User>]
|
684
|
+
#
|
685
|
+
def users!(access = {})
|
686
|
+
json = Api::Request.new do |request|
|
687
|
+
request[:access] = access
|
688
|
+
request[:method] = :GET
|
689
|
+
request[:path] = '/mgmt/{{client_id}}/account/users'
|
690
|
+
end.execute!
|
691
|
+
|
692
|
+
json[:users].map do |user|
|
693
|
+
GroupDocs::User.new(user)
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
#
|
698
|
+
# Get user profile by claimed token
|
699
|
+
#
|
700
|
+
# @param [String] callerId
|
701
|
+
# @param [Array] options
|
702
|
+
# @option [Hash] :token
|
703
|
+
# @param [Hash] access Access credentials
|
704
|
+
# @option access [String] :client_id
|
705
|
+
# @option access [String] :private_key
|
706
|
+
# @return [String]
|
707
|
+
#
|
708
|
+
def self.claimed_token!(caller_id, options ={}, access = {})
|
709
|
+
api = Api::Request.new do |request|
|
710
|
+
request[:access] = access
|
711
|
+
request[:method] = :GET
|
712
|
+
request[:path] = "/mgmt/#{caller_id}/claimed-tokens"
|
713
|
+
end
|
714
|
+
api.add_params(options)
|
715
|
+
api.execute!
|
716
|
+
|
717
|
+
end
|
718
|
+
|
719
|
+
#
|
720
|
+
# Get alien user profile
|
721
|
+
#
|
722
|
+
# @param [String] callerId
|
723
|
+
# @param [Hash] access Access credentials
|
724
|
+
# @option access [String] :client_id
|
725
|
+
# @option access [String] :private_key
|
726
|
+
# @return [String]
|
727
|
+
#
|
728
|
+
def self.get_profile!(caller_id, access = {})
|
729
|
+
json = Api::Request.new do |request|
|
730
|
+
request[:access] = access
|
731
|
+
request[:method] = :GET
|
732
|
+
request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/profile"
|
733
|
+
end.execute!
|
734
|
+
|
735
|
+
json[:user]
|
736
|
+
end
|
737
|
+
|
738
|
+
#
|
739
|
+
# Update alien user profile
|
740
|
+
#
|
741
|
+
# @param [String] callerId
|
742
|
+
# @param [Hash] access Access credentials
|
743
|
+
# @option access [String] :client_id
|
744
|
+
# @option access [String] :private_key
|
745
|
+
# @return [String]
|
746
|
+
#
|
747
|
+
def update_profile!(caller_id, access = {})
|
748
|
+
json = Api::Request.new do |request|
|
749
|
+
request[:access] = access
|
750
|
+
request[:method] = :PUT
|
751
|
+
request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/profile"
|
752
|
+
request[:request_body] = to_hash
|
753
|
+
end.execute!
|
754
|
+
|
755
|
+
json[:user_guid]
|
756
|
+
end
|
757
|
+
|
758
|
+
#
|
759
|
+
# Create new user
|
760
|
+
#
|
761
|
+
# @param [String] callerId
|
762
|
+
# @param [Hash] access Access credentials
|
763
|
+
# @option access [String] :client_id
|
764
|
+
# @option access [String] :private_key
|
765
|
+
# @return [GroupDocs::User]
|
766
|
+
#
|
767
|
+
def create_user!(caller_id, access = {})
|
768
|
+
json = Api::Request.new do |request|
|
769
|
+
request[:access] = access
|
770
|
+
request[:method] = :POST
|
771
|
+
request[:path] = "/mgmt/#{caller_id}/user"
|
772
|
+
request[:request_body] = to_hash
|
773
|
+
end.execute!
|
774
|
+
|
775
|
+
end
|
776
|
+
|
777
|
+
#
|
778
|
+
# Create new login
|
779
|
+
#
|
780
|
+
# @param [String] callerId
|
781
|
+
# @param [Hash] options
|
782
|
+
# @option options [String] :password
|
783
|
+
# @param [Hash] access Access credentials
|
784
|
+
# @option access [String] :client_id
|
785
|
+
# @option access [String] :private_key
|
786
|
+
# @return [GroupDocs::User]
|
787
|
+
#
|
788
|
+
def self.create_login!(caller_id, options = {}, access = {})
|
789
|
+
api = Api::Request.new do |request|
|
790
|
+
request[:access] = access
|
791
|
+
request[:method] = :POST
|
792
|
+
request[:path] = "/mgmt/#{caller_id}/user/{{client_id}}/logins"
|
793
|
+
end
|
794
|
+
api.add_params(options)
|
795
|
+
api.execute!
|
796
|
+
|
797
|
+
end
|
798
|
+
|
799
|
+
#
|
800
|
+
# Change alien user password.
|
801
|
+
#
|
802
|
+
# @example
|
803
|
+
# user = GroupDocs::User.get!
|
804
|
+
# old_password = user.password_salt
|
805
|
+
# new_password = 'Smith'
|
806
|
+
# user.update_password!
|
807
|
+
#
|
808
|
+
# @param [String] callerId
|
809
|
+
# @param [Array] pas_info ([old_password, new_password, reset_token])
|
810
|
+
# @param [Hash] access Access credentials
|
811
|
+
# @option access [String] :client_id
|
812
|
+
# @option access [String] :private_key
|
813
|
+
#
|
814
|
+
def self.update_alien_password!(caller_id, pas_info = {}, access = {})
|
815
|
+
json = Api::Request.new do |request|
|
816
|
+
request[:access] = access
|
817
|
+
request[:method] = :PUT
|
818
|
+
request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}password"
|
819
|
+
request[:request_body] = pas_info
|
820
|
+
end.execute!
|
821
|
+
|
822
|
+
json[:user_guid]
|
823
|
+
end
|
824
|
+
|
825
|
+
#
|
826
|
+
# Change alien user password.
|
827
|
+
#
|
828
|
+
# @param [String] callerId
|
829
|
+
# @param [Hash] access Access credentials
|
830
|
+
# @option access [String] :client_id
|
831
|
+
# @option access [String] :private_key
|
832
|
+
#
|
833
|
+
def self.reset_alien_password!(caller_id, access = {})
|
834
|
+
json = Api::Request.new do |request|
|
835
|
+
request[:access] = access
|
836
|
+
request[:method] = :DELETE
|
837
|
+
request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}password"
|
838
|
+
end.execute!
|
839
|
+
|
840
|
+
json[:user_name]
|
841
|
+
end
|
842
|
+
|
843
|
+
#
|
844
|
+
# Returns an array of roles.
|
845
|
+
#
|
846
|
+
# @param [Hash] access Access credentials
|
847
|
+
# @option access [String] :client_id
|
848
|
+
# @option access [String] :private_key
|
849
|
+
# @return [Array]
|
850
|
+
#
|
851
|
+
def roles!(access = {})
|
852
|
+
json = Api::Request.new do |request|
|
853
|
+
request[:access] = access
|
854
|
+
request[:method] = :GET
|
855
|
+
request[:path] = '/mgmt/{{client_id}}/roles'
|
856
|
+
end.execute!
|
857
|
+
|
858
|
+
json[:roles]
|
859
|
+
end
|
860
|
+
|
861
|
+
#
|
862
|
+
# Returns an array of roles.
|
863
|
+
#
|
864
|
+
# # @param [String] callerId
|
865
|
+
# @param [Hash] access Access credentials
|
866
|
+
# @option access [String] :client_id
|
867
|
+
# @option access [String] :private_key
|
868
|
+
# @return [Array]
|
869
|
+
#
|
870
|
+
def self.user_roles!(caller_id, access = {})
|
871
|
+
json = Api::Request.new do |request|
|
872
|
+
request[:access] = access
|
873
|
+
request[:method] = :GET
|
874
|
+
request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}/roles"
|
875
|
+
end.execute!
|
876
|
+
|
877
|
+
json[:roles]
|
878
|
+
end
|
879
|
+
|
880
|
+
#
|
881
|
+
# Set user roles.
|
882
|
+
#
|
883
|
+
# @param [String] callerId
|
884
|
+
# @param [Hash] role_info (:id, :name)
|
885
|
+
# @param [Hash] access Access credentials
|
886
|
+
# @option access [String] :client_id
|
887
|
+
# @option access [String] :private_key
|
888
|
+
# @return [Array]
|
889
|
+
#
|
890
|
+
def self.set_user_roles!(caller_id, role_info = {}, access = {})
|
891
|
+
Api::Request.new do |request|
|
892
|
+
request[:access] = access
|
893
|
+
request[:method] = :GET
|
894
|
+
request[:path] = "/mgmt/#{caller_id}/users/{{client_id}}/roles"
|
895
|
+
request[:request_body] = role_info
|
896
|
+
end.execute!
|
897
|
+
|
898
|
+
end
|
899
|
+
|
900
|
+
#
|
901
|
+
# Returns an account information
|
902
|
+
#
|
903
|
+
# @param [Hash] access Access credentials
|
904
|
+
# @option access [String] :client_id
|
905
|
+
# @option access [String] :private_key
|
906
|
+
# @return [Array]
|
907
|
+
#
|
908
|
+
def self.get_account!(access = {})
|
909
|
+
Api::Request.new do |request|
|
910
|
+
request[:access] = access
|
911
|
+
request[:method] = :GET
|
912
|
+
request[:path] = "/mgmt/{{client_id}}/account"
|
913
|
+
end.execute!
|
914
|
+
end
|
915
|
+
|
916
|
+
#
|
917
|
+
# Remove account user.
|
918
|
+
#
|
919
|
+
# @param [Hash] access Access credentials
|
920
|
+
# @option access [String] :client_id
|
921
|
+
# @option access [String] :private_key
|
922
|
+
# @return [String]
|
923
|
+
#
|
924
|
+
def self.remove_account!(access = {})
|
925
|
+
Api::Request.new do |request|
|
926
|
+
request[:access] = access
|
927
|
+
request[:method] = :DELETE
|
928
|
+
request[:path] = "/mgmt/{{client_id}}/account"
|
929
|
+
end.execute!
|
930
|
+
end
|
931
|
+
|
932
|
+
|
933
|
+
# added in release 2.3.0
|
934
|
+
#
|
935
|
+
# Remove account by request.
|
936
|
+
#
|
937
|
+
# @param [String] email User email
|
938
|
+
# @param [String] nonce Removal nonce
|
939
|
+
# @param [Hash] access Access credentials
|
940
|
+
# @option access [String] :client_id
|
941
|
+
# @option access [String] :private_key
|
942
|
+
# @return [String]
|
943
|
+
#
|
944
|
+
def self.delete_account!(email, nonce, access = {})
|
945
|
+
api = Api::Request.new do |request|
|
946
|
+
request[:access] = access
|
947
|
+
request[:method] = :DELETE
|
948
|
+
request[:path] = "/mgmt/{{client_id}}/account/users/removeaccount/#{email}"
|
949
|
+
end
|
950
|
+
api.add_params(nonce)
|
951
|
+
api.execute!
|
952
|
+
end
|
953
|
+
|
954
|
+
end # User
|
955
|
+
end # GroupDocs
|