Class: Api::Handler
- Inherits:
-
Object
- Object
- Api::Handler
- Defined in:
- lib/api.rb,
lib/api/handler.rb
Overview
Your code goes here…
Class Method Summary collapse
- .condition_read(param) ⇒ Object
- .connect(param, option) ⇒ Object
- .create_object(param) ⇒ Object
- .valid_session(object, token, option) ⇒ Object
Class Method Details
.condition_read(param) ⇒ Object
22 23 24 |
# File 'lib/api/handler.rb', line 22 def self.condition_read(param) DbAccessor::Reader.condition_select(param) end |
.connect(param, option) ⇒ Object
17 18 19 20 |
# File 'lib/api/handler.rb', line 17 def self.connect(param, option) found = AuthManager::Finder.find_object?(param, option) found ? SessionManager::Handler.create_session(param, option) : {code: 400, message: "User not connected"} end |
.create_object(param) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/api/handler.rb', line 8 def self.create_object(param) added = DbAccessor::Writer.write_object(param) if added[:code] == 201 true else false end end |
.valid_session(object, token, option) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/api/handler.rb', line 26 def self.valid_session(object, token, option) login = return_id(object, option) to_verify = {login: login, token: token}.to_json session_response = SessionManager::Handler.verify_session(to_verify, option) if session_response (session_response[:code] == 200) else false end end |