Class: Thron::Gateway::Client
Constant Summary
collapse
- PACKAGE =
Package.new(:xcontents, :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
|
# File 'lib/thron/gateway/client.rb', line 9
def self.routes
@routes ||= {
client_detail: Route::factory(name: 'detailClient', package: PACKAGE, verb: Route::Verbs::GET),
update_audit_duration_days: Route::factory(name: 'updateAuditDurationDays', package: PACKAGE),
enable_secure_connection: Route::factory(name: 'updateSecureConnectionEnabled', package: PACKAGE),
trash_properties_older_than: Route::factory(name: 'updateTrashProperties', package: PACKAGE)
}
end
|
Instance Method Details
#client_detail ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/thron/gateway/client.rb', line 18
def client_detail
query = {
clientId: client_id,
}
route(to: __callee__, query: query, token_id: token_id) do |response|
name = response.body.delete('name')
name_hash = name ? { name: name } : {}
response.body = Entity::Base::factory(response.body.fetch('properties') { {} }.merge!(name_hash))
end
end
|
#enable_secure_connection(options = {}) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/thron/gateway/client.rb', line 38
def enable_secure_connection(options = {})
enabled = options[:enabled]
body = {
clientId: client_id,
secureConnectionEnabled: !!enabled
}
route(to: __callee__, body: body, token_id: token_id)
end
|
#trash_properties_older_than(options = {}) ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/thron/gateway/client.rb', line 47
def trash_properties_older_than(options = {})
days = options[:days]
body = {
clientId: client_id,
properties: {
removeContentsOlderThan: days.to_i
}
}
route(to: __callee__, body: body, token_id: token_id)
end
|
#update_audit_duration_days(options = {}) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/thron/gateway/client.rb', line 29
def update_audit_duration_days(options = {})
days = options[:days]
body = {
clientId: client_id,
auditDurationDays: days.to_i
}
route(to: __callee__, body: body, token_id: token_id)
end
|