Class: Thron::Gateway::Apps
Constant Summary
collapse
- PACKAGE =
Package.new(:xadmin, :resources, self.service_name)
Constants inherited
from Base
Base::NO_ACTIVE_SESSION
Instance Attribute Summary
Attributes inherited from Base
#token_id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Session
#initialize
Methods included from Pageable
included
Methods inherited from Base
#check_session, client_id, #client_id, service_name
Methods included from Routable
included, info, #route
Class Method Details
.routes ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/thron/gateway/apps.rb', line 9
def self.routes
@routes ||= {
app_detail: Route::factory(name: 'appDetail', package: PACKAGE),
list_apps: Route::factory(name: 'appsList', package: PACKAGE),
find_apps: Route::factory(name: 'findByProperties', package: PACKAGE),
login_app: Route::factory(name: 'loginApp', package: PACKAGE, verb: Route::Verbs::GET),
login_snippet: Route::factory(name: 'loginSnippet', package: PACKAGE, verb: Route::Verbs::GET),
su: Route::factory(name: 'su', package: PACKAGE, accept: Route::Types::PLAIN)
}
end
|
Instance Method Details
#app_detail(options = {}) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/thron/gateway/apps.rb', line 20
def app_detail(options = {})
app_id = options[:app_id]
body = {
clientId: client_id,
appId: app_id
}
route(to: __callee__, body: body, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('app') { {} })
end
end
|
#find_apps(options = {}) ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/thron/gateway/apps.rb', line 42
def find_apps(options = {})
criteria = options.fetch(:criteria) { {} }
body = {
clientId: client_id,
criteria: criteria
}
route(to: __callee__, body: body, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('apps') { [] })
end
end
|
#list_apps(options = {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/thron/gateway/apps.rb', line 31
def list_apps(options = {})
criteria = options.fetch(:criteria) { {} }
body = {
clientId: client_id,
criteria: criteria
}
route(to: __callee__, body: body, token_id: token_id) do |response|
response.body = Entity::Base::factory(response.body.fetch('apps') { [] })
end
end
|
#login_app(options = {}) ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/thron/gateway/apps.rb', line 53
def login_app(options = {})
app_id = options[:app_id]
query = {
clientId: client_id,
appId: app_id
}
route(to: __callee__, query: query, token_id: token_id, dash: false) do |response|
response.body = Entity::Base::factory(response.body.fetch('app') { {} })
end
end
|
#login_snippet(options = {}) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/thron/gateway/apps.rb', line 64
def login_snippet(options = {})
app_id = options[:app_id]
snippet_id = options[:snippet_id]
query = {
clientId: client_id,
appId: app_id,
snippetId: snippet_id,
}
route(to: __callee__, query: query, token_id: token_id, dash: false) do |response|
response.body = Entity::Base::factory(response.body.fetch('snippet') { {} })
end
end
|
#su(options = {}) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/thron/gateway/apps.rb', line 77
def su(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) do |response|
response.body = Entity::Base::factory(response.body)
end
end
|