thron 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +4 -0
- data/.gitignore +13 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/README.md +182 -0
- data/Rakefile +10 -0
- data/Vagrantfile +80 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config/thron.yml +10 -0
- data/lib/thron.rb +3 -0
- data/lib/thron/circuit_breaker.rb +46 -0
- data/lib/thron/config.rb +35 -0
- data/lib/thron/entity/base.rb +78 -0
- data/lib/thron/entity/image.rb +30 -0
- data/lib/thron/gateway/access_manager.rb +69 -0
- data/lib/thron/gateway/apps.rb +91 -0
- data/lib/thron/gateway/apps_admin.rb +153 -0
- data/lib/thron/gateway/base.rb +41 -0
- data/lib/thron/gateway/category.rb +210 -0
- data/lib/thron/gateway/client.rb +59 -0
- data/lib/thron/gateway/comment.rb +76 -0
- data/lib/thron/gateway/contact.rb +120 -0
- data/lib/thron/gateway/content.rb +267 -0
- data/lib/thron/gateway/content_category.rb +32 -0
- data/lib/thron/gateway/content_list.rb +40 -0
- data/lib/thron/gateway/dashboard.rb +120 -0
- data/lib/thron/gateway/delivery.rb +122 -0
- data/lib/thron/gateway/device.rb +58 -0
- data/lib/thron/gateway/metadata.rb +68 -0
- data/lib/thron/gateway/publish_in_weebo_express.rb +39 -0
- data/lib/thron/gateway/publishing_process.rb +141 -0
- data/lib/thron/gateway/repository.rb +111 -0
- data/lib/thron/gateway/session.rb +15 -0
- data/lib/thron/gateway/users_group_manager.rb +117 -0
- data/lib/thron/gateway/v_user_manager.rb +195 -0
- data/lib/thron/logger.rb +25 -0
- data/lib/thron/pageable.rb +26 -0
- data/lib/thron/paginator.rb +82 -0
- data/lib/thron/response.rb +48 -0
- data/lib/thron/root.rb +9 -0
- data/lib/thron/routable.rb +80 -0
- data/lib/thron/route.rb +102 -0
- data/lib/thron/string_extensions.rb +23 -0
- data/lib/thron/user.rb +77 -0
- data/lib/thron/version.rb +3 -0
- data/log/.gitignore +4 -0
- data/thron.gemspec +26 -0
- metadata +176 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'thron/gateway/session'
|
2
|
+
|
3
|
+
module Thron
|
4
|
+
module Gateway
|
5
|
+
class PublishingProcess < Session
|
6
|
+
|
7
|
+
PACKAGE = Package.new(:xadmin, :resources, self.service_name)
|
8
|
+
|
9
|
+
def self.routes
|
10
|
+
@routes ||= {
|
11
|
+
change_channel_status: Route::factory(name: 'changeChannelStatus', package: PACKAGE),
|
12
|
+
create_content_for_channel: Route::factory(name: 'createContentForChannel', package: PACKAGE),
|
13
|
+
get_content_types: Route::factory(name: 'getContentTypes', package: PACKAGE),
|
14
|
+
new_content: Route::factory(name: 'newContent', package: PACKAGE),
|
15
|
+
new_live_event_content: Route::factory(name: 'newLiveEventContent', package: PACKAGE),
|
16
|
+
new_pagelet_content: Route::factory(name: 'newPageletContent', package: PACKAGE),
|
17
|
+
new_playlist_content: Route::factory(name: 'newPlayListContent', package: PACKAGE),
|
18
|
+
publish_channel: Route::factory(name: 'publishChannel', package: PACKAGE),
|
19
|
+
remove_channel: Route::factory(name: 'removeChannel', package: PACKAGE),
|
20
|
+
replace_thumbnail: Route::factory(name: 'replaceThumbnailInPublishedContent', package: PACKAGE),
|
21
|
+
unpublish_content: Route::factory(name: 'unpublishContent', package: PACKAGE),
|
22
|
+
update_pagelet_content: Route::factory(name: 'updatePageletContent', package: PACKAGE),
|
23
|
+
update_publishing_properties: Route::factory(name: 'updatePublishingProperties', package: PACKAGE)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def change_channel_status(options = {})
|
28
|
+
media_content_id = options[:media_content_id]
|
29
|
+
content_id = options[:content_id]
|
30
|
+
channel = options[:channel]
|
31
|
+
active = options.fetch(:active) { false }
|
32
|
+
body = {
|
33
|
+
clientId: client_id,
|
34
|
+
mediaContentId: media_content_id,
|
35
|
+
xcontentId: content_id,
|
36
|
+
channel: channel,
|
37
|
+
active: active
|
38
|
+
}
|
39
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
40
|
+
response.extra(attribute: 'actionsInError')
|
41
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_content_types(options = {})
|
46
|
+
file_names = options[:file_names]
|
47
|
+
body = {
|
48
|
+
clientId: client_id,
|
49
|
+
files: { fileNames: file_names }
|
50
|
+
}
|
51
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
52
|
+
response.body = Entity::Base::factory(response.body.fetch('fileContentTypes') { [] })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def unpublish_content(options = {})
|
57
|
+
media_content_id = options[:media_content_id]
|
58
|
+
content_id = options[:content_id]
|
59
|
+
force = options.fetch(:force) { false }
|
60
|
+
remove_source_files = options.fetch(:remove_source_files) { false }
|
61
|
+
body = {
|
62
|
+
clientId: client_id,
|
63
|
+
mediaContentId: media_content_id,
|
64
|
+
xcontentId: content_id,
|
65
|
+
force: force,
|
66
|
+
removeSourceFiles: remove_source_files
|
67
|
+
}
|
68
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
69
|
+
response.extra(attribute: 'actionsInError')
|
70
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def update_pagelet_content(options = {})
|
75
|
+
media_content_id = options[:media_content_id]
|
76
|
+
content_id = options[:content_id]
|
77
|
+
body = options[:body]
|
78
|
+
mime_type = options[:mime_type]
|
79
|
+
body = {
|
80
|
+
clientId: client_id,
|
81
|
+
mediaContentId: media_content_id,
|
82
|
+
xcontentId: content_id,
|
83
|
+
body: body,
|
84
|
+
mimeType: mime_type
|
85
|
+
}
|
86
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
87
|
+
response.extra(attribute: 'actionsInError')
|
88
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def update_publishing_properties(options = {})
|
93
|
+
media_content_id = options[:media_content_id]
|
94
|
+
content_id = options[:content_id]
|
95
|
+
properties = options[:properties]
|
96
|
+
body = {
|
97
|
+
clientId: client_id,
|
98
|
+
mediaContentId: media_content_id,
|
99
|
+
xcontentId: content_id,
|
100
|
+
properties: properties
|
101
|
+
}
|
102
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
103
|
+
response.extra(attribute: 'actionsInError')
|
104
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
%i[publish remove].each do |action|
|
109
|
+
define_method "#{action}_channel" do |options|
|
110
|
+
media_content_id = options.fetch(:media_content_id)
|
111
|
+
content_id = options.fetch(:content_id)
|
112
|
+
channel = options.fetch(:channel)
|
113
|
+
body = {
|
114
|
+
clientId: client_id,
|
115
|
+
mediaContentId: media_content_id,
|
116
|
+
xcontentId: content_id,
|
117
|
+
channel: channel
|
118
|
+
}
|
119
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
120
|
+
response.extra(attribute: 'actionsInError')
|
121
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
%i[create_content_for_channel new_content new_live_event_content new_pagelet_content new_playlist_content replace_thumbnail].each do |message|
|
127
|
+
define_method(message) do |options|
|
128
|
+
data = options[:data]
|
129
|
+
body = {
|
130
|
+
clientId: client_id,
|
131
|
+
param: data
|
132
|
+
}
|
133
|
+
route(to: message, body: body, token_id: token_id) do |response|
|
134
|
+
response.extra(attribute: 'actionsInError')
|
135
|
+
response.body = Entity::Base::factory(response.body.fetch('content') { {} })
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'thron/gateway/session'
|
2
|
+
|
3
|
+
module Thron
|
4
|
+
module Gateway
|
5
|
+
class Repository < Session
|
6
|
+
|
7
|
+
base_uri "#{Config::thron::protocol}://#{Config::thron::client_id}-view.thron.com/api"
|
8
|
+
|
9
|
+
PACKAGE = Package.new(:xpackager, :resources, self.service_name)
|
10
|
+
|
11
|
+
paginate :get_ftp_file_list, :get_uploaded_file_list
|
12
|
+
|
13
|
+
def self.routes
|
14
|
+
@routes ||= {
|
15
|
+
add_files: Route::factory(name: 'addFilesToPlatform', package: PACKAGE),
|
16
|
+
add_s3_resource: Route::factory(name: 'addS3ResourceToPlatform', package: PACKAGE),
|
17
|
+
add_web_resource: Route::factory(name: 'addWebResourceToPlatform', package: PACKAGE),
|
18
|
+
delete_ftp_file: Route::factory(name: 'deleteFtpFile', package: PACKAGE),
|
19
|
+
delete_uploaded_file: Route::factory(name: 'deleteUploadedFile', package: PACKAGE),
|
20
|
+
get_ftp_file_list: Route::factory(name: 'getFtpFileList', package: PACKAGE),
|
21
|
+
get_quota_usage: Route::factory(name: 'getQuotaUsage', package: PACKAGE, verb: Route::Verbs::GET),
|
22
|
+
get_s3_credentials: Route::factory(name: 'getS3UploadCredentials', package: PACKAGE, verb: Route::Verbs::GET),
|
23
|
+
get_uploaded_file_list: Route::factory(name: 'getUploadedFileList', package: PACKAGE)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_files(options = {})
|
28
|
+
files = options[:files]
|
29
|
+
body = {
|
30
|
+
clientId: client_id,
|
31
|
+
files: { files: files }
|
32
|
+
}
|
33
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
34
|
+
response.body = Entity::Base::factory(response.body)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_s3_resource(options = {})
|
39
|
+
resource = options[:resource]
|
40
|
+
remove_resource = options.fetch(:remove_resource) { false }
|
41
|
+
body = {
|
42
|
+
clientId: client_id,
|
43
|
+
resource: resource,
|
44
|
+
remove_resource_if_possible: remove_resource
|
45
|
+
}
|
46
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
47
|
+
response.body = Entity::Base::factory(response.body)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_web_resource(options = {})
|
52
|
+
resource = options[:resource]
|
53
|
+
body = {
|
54
|
+
clientId: client_id,
|
55
|
+
webResource: resource
|
56
|
+
}
|
57
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
58
|
+
response.body = Entity::Base::factory(response.body)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
%i[delete_ftp_file delete_uploaded_file].each do |message|
|
63
|
+
define_method(message) do |options|
|
64
|
+
file = options.fetch(:file)
|
65
|
+
body = {
|
66
|
+
clientId: client_id,
|
67
|
+
file: file
|
68
|
+
}
|
69
|
+
route(to: __callee__, body: body, token_id: token_id)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
%i[get_ftp_file_list get_uploaded_file_list].each do |message|
|
74
|
+
define_method(message) do |options|
|
75
|
+
criteria = options.fetch(:criteria) { {} }
|
76
|
+
order_by = options[:order_by]
|
77
|
+
offset = options[:offset].to_i
|
78
|
+
limit = options[:limit].to_i
|
79
|
+
body = {
|
80
|
+
clientId: client_id,
|
81
|
+
criteria: criteria,
|
82
|
+
orderByField: order_by,
|
83
|
+
offset: offset.to_i,
|
84
|
+
numberOfResult: limit.to_i
|
85
|
+
}
|
86
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
87
|
+
response.body = Entity::Base::factory(response.body.fetch('uploadedFiles') { [] })
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_quota_usage
|
93
|
+
query = {
|
94
|
+
clientId: client_id,
|
95
|
+
}
|
96
|
+
route(to: __callee__, query: query, token_id: token_id) do |response|
|
97
|
+
response.body = Entity::Base::factory(response.body)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_s3_credentials
|
102
|
+
query = {
|
103
|
+
clientId: client_id,
|
104
|
+
}
|
105
|
+
route(to: __callee__, query: query, token_id: token_id) do |response|
|
106
|
+
response.body = Entity::Base::factory(response.body.fetch('credentials') { {} })
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'thron/gateway/session'
|
2
|
+
|
3
|
+
module Thron
|
4
|
+
module Gateway
|
5
|
+
class UsersGroupManager < Session
|
6
|
+
|
7
|
+
PACKAGE = Package.new(:xsso, :resources, self.service_name)
|
8
|
+
|
9
|
+
paginate :find_groups
|
10
|
+
|
11
|
+
def self.routes
|
12
|
+
@routes ||= {
|
13
|
+
create_group: Route::factory(name: 'createGroup', package: PACKAGE),
|
14
|
+
remove_group: Route::factory(name: 'removeGroup', package: PACKAGE),
|
15
|
+
group_detail: Route::factory(name: 'detailGroup', package: PACKAGE),
|
16
|
+
find_groups: Route::factory(name: 'findGroupsByProperties', package: PACKAGE),
|
17
|
+
link_users_to_group: Route::factory(name: 'linkUserToGroup', package: PACKAGE),
|
18
|
+
unlink_users_to_group: Route::factory(name: 'unlinkUserToGroup', package: PACKAGE),
|
19
|
+
update_group: Route::lazy_factory(name: 'update', package: PACKAGE),
|
20
|
+
update_group_external_id: Route::lazy_factory(name: 'updateExternalId', package: PACKAGE)
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_group(options = {})
|
25
|
+
data = options[:data]
|
26
|
+
body = {
|
27
|
+
clientId: client_id,
|
28
|
+
usersGroup: data
|
29
|
+
}
|
30
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
31
|
+
response.body = Entity::Base::factory(response.body.fetch('group') { {} })
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove_group(options = {})
|
36
|
+
group_id = options[:group_id]
|
37
|
+
force = options.fetch(:force) { false }
|
38
|
+
body = {
|
39
|
+
clientId: client_id,
|
40
|
+
groupId: group_id,
|
41
|
+
force: force
|
42
|
+
}
|
43
|
+
route(to: __callee__, body: body, token_id: token_id)
|
44
|
+
end
|
45
|
+
|
46
|
+
def group_detail(options = {})
|
47
|
+
group_id = options[:group_id]
|
48
|
+
fields_option = options.fetch(:fields_option) { {} }
|
49
|
+
offset = options[:offset].to_i
|
50
|
+
limit = options[:limit].to_i
|
51
|
+
body = {
|
52
|
+
clientId: client_id,
|
53
|
+
groupId: group_id,
|
54
|
+
offset: offset.to_i,
|
55
|
+
numberOfResult: limit.to_i,
|
56
|
+
fieldsOption: fields_option
|
57
|
+
}
|
58
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
59
|
+
group = response.body.delete('group') { {} }
|
60
|
+
response.body = Entity::Base::factory(response.body.merge!(group))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_groups(options = {})
|
65
|
+
criteria = options.fetch(:criteria) { {} }
|
66
|
+
order_by = options[:order_by]
|
67
|
+
fields_option = options.fetch(:fields_option) { {} }
|
68
|
+
offset = options[:offset].to_i
|
69
|
+
limit = options[:limit].to_i
|
70
|
+
body = {
|
71
|
+
clientId: client_id,
|
72
|
+
criteria: criteria,
|
73
|
+
orderBy: order_by,
|
74
|
+
fieldsOption: fields_option,
|
75
|
+
offset: offset.to_i,
|
76
|
+
numberOfResult: limit.to_i
|
77
|
+
}
|
78
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
79
|
+
response.body = Entity::Base::factory(response.body.fetch('groups') { [] })
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
%i[link_users_to_group unlink_users_to_group].each do |name|
|
84
|
+
define_method(name) do |*options|
|
85
|
+
group_id = options.last[:group_id]
|
86
|
+
usernames = options.last[:usernames].to_a
|
87
|
+
body = {
|
88
|
+
clientId: client_id,
|
89
|
+
userList: {
|
90
|
+
usernames: usernames
|
91
|
+
},
|
92
|
+
groupId: group_id
|
93
|
+
}
|
94
|
+
route(to: name, body: body, token_id: token_id)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def update_group(options = {})
|
99
|
+
group_id = options[:group_id]
|
100
|
+
data = options[:data]
|
101
|
+
body = {
|
102
|
+
update: data
|
103
|
+
}
|
104
|
+
route(to: __callee__, body: body, token_id: token_id, params: [client_id, group_id])
|
105
|
+
end
|
106
|
+
|
107
|
+
def update_group_external_id(options = {})
|
108
|
+
group_id = options[:group_id]
|
109
|
+
external_id = options[:external_id]
|
110
|
+
body = {
|
111
|
+
externalId: external_id
|
112
|
+
}
|
113
|
+
route(to: __callee__, body: body, token_id: token_id, params: [client_id, group_id])
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require 'thron/gateway/session'
|
2
|
+
require 'thron/entity/image'
|
3
|
+
|
4
|
+
module Thron
|
5
|
+
module Gateway
|
6
|
+
class VUserManager < Session
|
7
|
+
|
8
|
+
PACKAGE = Package.new(:xsso, :resources, self.service_name)
|
9
|
+
|
10
|
+
paginate :find_users
|
11
|
+
|
12
|
+
def self.routes
|
13
|
+
@routes ||= {
|
14
|
+
create_user: Route::factory(name: 'create', package: PACKAGE),
|
15
|
+
user_detail: Route::factory(name: 'detail', package: PACKAGE, verb: Route::Verbs::GET),
|
16
|
+
find_users: Route::factory(name: 'findByProperties', package: PACKAGE),
|
17
|
+
check_credentials: Route::factory(name: 'login', package: PACKAGE),
|
18
|
+
temporary_token: Route::factory(name: 'resetPassword', package: PACKAGE),
|
19
|
+
update_password: Route::factory(name: 'changePassword', package: PACKAGE),
|
20
|
+
update_status: Route::factory(name: 'changeUserStatus', package: PACKAGE),
|
21
|
+
update_capabilities_and_roles: Route::factory(name: 'updateCapabilitiesAndRoles', package: PACKAGE),
|
22
|
+
update_external_id: Route::lazy_factory(name: 'updateExternalId', package: PACKAGE),
|
23
|
+
update_image: Route::factory(name: 'updateImage', package: PACKAGE),
|
24
|
+
update_settings: Route::factory(name: 'updateSettings', package: PACKAGE),
|
25
|
+
update_user: Route::lazy_factory(name: 'updateUser', package: PACKAGE),
|
26
|
+
upgrade_user: Route::factory(name: 'upgradeUser', package: PACKAGE)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_user(options = {})
|
31
|
+
username = options[:username]
|
32
|
+
password = options[:password]
|
33
|
+
data = options[:data]
|
34
|
+
body = {
|
35
|
+
clientId: client_id,
|
36
|
+
newUser: {
|
37
|
+
username: username,
|
38
|
+
password: password
|
39
|
+
}
|
40
|
+
}.merge(data)
|
41
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
42
|
+
response.body = Entity::Base::factory(response.body.fetch('user') { {} })
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def user_detail(options = {})
|
47
|
+
username = options[:username]
|
48
|
+
extra = options.fetch(:extra) { {} }
|
49
|
+
offset = options[:offset].to_i
|
50
|
+
limit = options[:limit].to_i
|
51
|
+
query = {
|
52
|
+
clientId: client_id,
|
53
|
+
username: username,
|
54
|
+
offset: offset.to_i,
|
55
|
+
numberOfResults: limit.to_i
|
56
|
+
}.merge(extra)
|
57
|
+
route(to: __callee__, query: query, token_id: token_id, dash: false) do |response|
|
58
|
+
user = response.body.delete('user') { {} }
|
59
|
+
response.body = Entity::Base::factory(response.body.merge!(user))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def find_users(options = {})
|
64
|
+
criteria = options.fetch(:criteria) { {} }
|
65
|
+
order_by = options[:order_by]
|
66
|
+
fields_option = options.fetch(:fields_option) { {} }
|
67
|
+
offset = options[:offset].to_i
|
68
|
+
limit = options[:limit].to_i
|
69
|
+
body = {
|
70
|
+
clientId: client_id,
|
71
|
+
criteria: criteria,
|
72
|
+
orderBy: order_by,
|
73
|
+
fieldsOption: fields_option,
|
74
|
+
offset: offset.to_i,
|
75
|
+
numberOfResult: limit.to_i
|
76
|
+
}
|
77
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
78
|
+
response.body = Entity::Base::factory(response.body.fetch('users') { [] })
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def check_credentials(options = {})
|
83
|
+
username = options[:username]
|
84
|
+
password = options[:password]
|
85
|
+
query = {
|
86
|
+
clientId: client_id,
|
87
|
+
username: username,
|
88
|
+
password: password
|
89
|
+
}
|
90
|
+
route(to: __callee__, query: query, token_id: token_id, dash: false) do |response|
|
91
|
+
user = response.body.delete('user') { {} }
|
92
|
+
response.body = Entity::Base::factory(response.body.merge!(user))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def temporary_token(options = {})
|
97
|
+
username = options[:username]
|
98
|
+
body = {
|
99
|
+
clientId: client_id,
|
100
|
+
username: username,
|
101
|
+
}
|
102
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
103
|
+
response.body = response.body['tmpToken']
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def update_password(options = {})
|
108
|
+
username = options[:username]
|
109
|
+
password = options[:password]
|
110
|
+
query = {
|
111
|
+
clientId: client_id,
|
112
|
+
username: username,
|
113
|
+
newpassword: password
|
114
|
+
}
|
115
|
+
route(to: __callee__, query: query, token_id: token_id, dash: false)
|
116
|
+
end
|
117
|
+
|
118
|
+
def update_status(options = {})
|
119
|
+
username = options[:username]
|
120
|
+
data = options[:data]
|
121
|
+
body = {
|
122
|
+
clientId: client_id,
|
123
|
+
username: username,
|
124
|
+
properties: data
|
125
|
+
}
|
126
|
+
route(to: __callee__, body: body, token_id: token_id)
|
127
|
+
end
|
128
|
+
|
129
|
+
def update_capabilities_and_roles(options = {})
|
130
|
+
username = options[:username]
|
131
|
+
capabilities = options[:capabilities]
|
132
|
+
body = {
|
133
|
+
clientId: client_id,
|
134
|
+
username: username,
|
135
|
+
userCapabilities: capabilities
|
136
|
+
}
|
137
|
+
route(to: __callee__, body: body, token_id: token_id)
|
138
|
+
end
|
139
|
+
|
140
|
+
def update_external_id(options = {})
|
141
|
+
username = options[:username]
|
142
|
+
external_id = options[:external_id]
|
143
|
+
body = {
|
144
|
+
externalId: external_id
|
145
|
+
}
|
146
|
+
route(to: __callee__, body: body, token_id: token_id, params: [client_id, username])
|
147
|
+
end
|
148
|
+
|
149
|
+
def update_image(options = {})
|
150
|
+
username = options[:username]
|
151
|
+
image = options[:image]
|
152
|
+
body = {
|
153
|
+
clientId: client_id,
|
154
|
+
username: username,
|
155
|
+
buffer: image
|
156
|
+
}
|
157
|
+
route(to: __callee__, body: body, token_id: token_id)
|
158
|
+
end
|
159
|
+
|
160
|
+
def update_settings(options = {})
|
161
|
+
username = options[:username]
|
162
|
+
settings = options[:settings]
|
163
|
+
body = {
|
164
|
+
clientId: client_id,
|
165
|
+
username: username,
|
166
|
+
settings: settings
|
167
|
+
}
|
168
|
+
route(to: __callee__, body: body, token_id: token_id)
|
169
|
+
end
|
170
|
+
|
171
|
+
def update_user(options = {})
|
172
|
+
username = options[:username]
|
173
|
+
data = options[:data]
|
174
|
+
body = {
|
175
|
+
update: data
|
176
|
+
}
|
177
|
+
route(to: __callee__, body: body, token_id: token_id, params: [client_id, username])
|
178
|
+
end
|
179
|
+
|
180
|
+
def upgrade_user(options = {})
|
181
|
+
username = options[:username]
|
182
|
+
password = options[:password]
|
183
|
+
data = options[:data]
|
184
|
+
body = {
|
185
|
+
clientId: client_id,
|
186
|
+
username: username,
|
187
|
+
newPassword: password
|
188
|
+
}.merge(data)
|
189
|
+
route(to: __callee__, body: body, token_id: token_id) do |response|
|
190
|
+
response.body = Entity::Base::factory(response.body.fetch('user') { {} })
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|