class Thron::Gateway::Client

Constants

PACKAGE

Public Class Methods

routes() click to toggle source
# 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

Public Instance Methods

client_detail() click to toggle source
# 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 = {}) click to toggle source
# 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 = {}) click to toggle source
# 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 = {}) click to toggle source
# 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