class Thron::Gateway::AppsAdmin
Constants
- PACKAGE
Public Class Methods
routes()
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 9 def self.routes @routes ||= { add_group_app: Route::factory(name: 'addGroupApp', package: PACKAGE), add_snippet: Route::factory(name: 'addSnippet', package: PACKAGE), add_user_app: Route::factory(name: 'addUserApp', package: PACKAGE), create_app: Route::factory(name: 'create', package: PACKAGE), remove_app: Route::factory(name: 'remove', package: PACKAGE), remove_group_app: Route::factory(name: 'removeGroupApp', package: PACKAGE), remove_snippet: Route::factory(name: 'removeSnippet', package: PACKAGE), remove_user_app: Route::factory(name: 'removeUserApp', package: PACKAGE), update_app: Route::factory(name: 'updateApp', package: PACKAGE), update_snippet: Route::factory(name: 'updateSnippet', package: PACKAGE) } end
Public Instance Methods
add_group_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 24 def add_group_app(options = {}) app_id = options[:app_id] group_id = options[:group_id] capabilities = options[:capabilities] body = { clientId: client_id, appId: app_id, groupId: group_id, userCaps: capabilities } route(to: __callee__, body: body, token_id: token_id) end
add_snippet(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 37 def add_snippet(options = {}) app_id = options[:app_id] data = options[:data] capabilities = options[:capabilities] body = { clientId: client_id, appId: app_id, snippet: data, caps: capabilities } route(to: __callee__, body: body, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('snippet') { {} }) end end
add_user_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 52 def add_user_app(options = {}) app_id = options[:app_id] username = options[:username] capabilities = options[:capabilities] body = { clientId: client_id, appId: app_id, username: username, userCaps: capabilities } route(to: __callee__, body: body, token_id: token_id) end
create_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 65 def create_app(options = {}) data = options[:data] options = options.fetch(:options) { {} } body = { clientId: client_id, app: data, options: options } route(to: __callee__, body: body, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('app') { {} }) end end
remove_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 78 def remove_app(options = {}) app_id = options[:app_id] body = { clientId: client_id, appId: app_id } route(to: __callee__, body: body, token_id: token_id) end
remove_group_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 87 def remove_group_app(options = {}) app_id = options[:app_id] group_id = options[:group_id] body = { clientId: client_id, appId: app_id, groupId: group_id } route(to: __callee__, body: body, token_id: token_id) end
remove_snippet(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 98 def remove_snippet(options = {}) app_id = options[:app_id] snippet_id = options[:snippet_id] body = { clientId: client_id, appId: app_id, snippetId: snippet_id } route(to: __callee__, body: body, token_id: token_id) end
remove_user_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 109 def remove_user_app(options = {}) app_id = options[:app_id] username = options[:username] body = { clientId: client_id, appId: app_id, username: username } route(to: __callee__, body: body, token_id: token_id) end
update_app(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 120 def update_app(options = {}) app_id = options[:app_id] data = options[:data] capabilities = options[:capabilities] body = { clientId: client_id, appId: app_id, update: data, caps: capabilities } route(to: __callee__, body: body, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('app') { {} }) end end
update_snippet(options = {})
click to toggle source
# File lib/thron/gateway/apps_admin.rb, line 135 def update_snippet(options = {}) app_id = options[:app_id] snippet_id = options[:snippet_id] data = options[:data] capabilities = options[:capabilities] body = { clientId: client_id, appId: app_id, snippetId: snippet_id, snippet: data, caps: capabilities } route(to: __callee__, body: body, token_id: token_id) do |response| response.body = Entity::Base::factory(response.body.fetch('snippet') { {} }) end end