Class: SqAuth::SqAuthServer::BasicServer
- Inherits:
-
Object
- Object
- SqAuth::SqAuthServer::BasicServer
- Defined in:
- lib/sq_auth/sq_auth_server_interface/basic_server.rb
Constant Summary collapse
- SERVER_INTERFACE =
{ check_connection: {path: "health", method: :get}, check_role: {path: "check_role", method: :post}, get_roles: {path: "get_roles", method: :get} }
Class Method Summary collapse
- .init_request(specification, host_options = {}) ⇒ Object
- .method_missing(m, *args, &block) ⇒ Object
- .sq_auth_host(host_options) ⇒ Object
- .use_interface(interface, query, host_options = {}) ⇒ Object
Class Method Details
.init_request(specification, host_options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sq_auth/sq_auth_server_interface/basic_server.rb', line 10 def self.init_request specification, = {} = {} [:host] = [:host] [:port] = [:port] [:username] = [:username] [:password] = [:password] [:https] = [:https] [:path] = specification[:path] [:method] = specification[:method] SqAuthRequest.new end |
.method_missing(m, *args, &block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/sq_auth/sq_auth_server_interface/basic_server.rb', line 32 def self.method_missing m, *args, &block if SERVER_INTERFACE[m] use_interface(SERVER_INTERFACE[m], *args) else super end end |
.sq_auth_host(host_options) ⇒ Object
22 23 24 |
# File 'lib/sq_auth/sq_auth_server_interface/basic_server.rb', line 22 def self.sq_auth_host {host: [:host], port: [:port]} end |
.use_interface(interface, query, host_options = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/sq_auth/sq_auth_server_interface/basic_server.rb', line 26 def self.use_interface interface, query, = {} interface[:requests] ||= {} interface[:requests][sq_auth_host()] ||= init_request(interface, ) interface[:requests][sq_auth_host()].request query end |