Class: Thron::Gateway::AppsAdmin
- Defined in:
- lib/thron/gateway/apps_admin.rb
Constant Summary collapse
- PACKAGE =
Package.new(:xadmin, :resources, self.service_name)
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #add_group_app(options = {}) ⇒ Object
- #add_snippet(options = {}) ⇒ Object
- #add_user_app(options = {}) ⇒ Object
- #create_app(options = {}) ⇒ Object
- #remove_app(options = {}) ⇒ Object
- #remove_group_app(options = {}) ⇒ Object
- #remove_snippet(options = {}) ⇒ Object
- #remove_user_app(options = {}) ⇒ Object
- #update_app(options = {}) ⇒ Object
- #update_snippet(options = {}) ⇒ Object
Methods inherited from Session
Methods included from Pageable
Methods inherited from Base
#check_session, client_id, #client_id, service_name
Methods included from Routable
Constructor Details
This class inherits a constructor from Thron::Gateway::Session
Class Method Details
.routes ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 |
Instance Method Details
#add_group_app(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/thron/gateway/apps_admin.rb', line 24 def add_group_app( = {}) app_id = [:app_id] group_id = [:group_id] capabilities = [: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 = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/thron/gateway/apps_admin.rb', line 37 def add_snippet( = {}) app_id = [:app_id] data = [:data] capabilities = [: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 = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/thron/gateway/apps_admin.rb', line 52 def add_user_app( = {}) app_id = [:app_id] username = [:username] capabilities = [: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 = {}) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/thron/gateway/apps_admin.rb', line 65 def create_app( = {}) data = [:data] = .fetch(:options) { {} } body = { clientId: client_id, app: data, 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 = {}) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/thron/gateway/apps_admin.rb', line 78 def remove_app( = {}) app_id = [:app_id] body = { clientId: client_id, appId: app_id } route(to: __callee__, body: body, token_id: token_id) end |
#remove_group_app(options = {}) ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/thron/gateway/apps_admin.rb', line 87 def remove_group_app( = {}) app_id = [:app_id] group_id = [: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 = {}) ⇒ Object
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/thron/gateway/apps_admin.rb', line 98 def remove_snippet( = {}) app_id = [:app_id] snippet_id = [: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 = {}) ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/thron/gateway/apps_admin.rb', line 109 def remove_user_app( = {}) app_id = [:app_id] username = [:username] body = { clientId: client_id, appId: app_id, username: username } route(to: __callee__, body: body, token_id: token_id) end |
#update_app(options = {}) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/thron/gateway/apps_admin.rb', line 120 def update_app( = {}) app_id = [:app_id] data = [:data] capabilities = [: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 = {}) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/thron/gateway/apps_admin.rb', line 135 def update_snippet( = {}) app_id = [:app_id] snippet_id = [:snippet_id] data = [:data] capabilities = [: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 |