Module: DemoApi
- Defined in:
- lib/demo_api.rb,
lib/demo_api/version.rb
Constant Summary collapse
- REQUEST_HEADER =
{'Content-Type' => 'application/json'}
- SABEQ_URL =
SABEQ_URL = “sabeq.ps”
"https://localhost:3001/"- VERSION =
"0.1.2"
Class Method Summary collapse
-
.authorize(login_token) ⇒ Object
Authorize the request parameters: login_token return: true, auth_token in case of success false, errors in case of failure, errors contain code and message.
- .print_hello ⇒ Object
Class Method Details
.authorize(login_token) ⇒ Object
Authorize the request parameters: login_token return: true, auth_token in case of success
false, errors in case of failure, errors contain code and message
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/demo_api.rb', line 19 def (login_token) auth_link = SABEQ_URL + "/api/v1/auth" auth_json = { login_token: login_token } json_response = make_post_request(auth_link, auth_json) result, the_response = get_error_or_returned_value(json_response) if result return true, the_response["auth_token"] else return false, the_response end end |
.print_hello ⇒ Object
11 12 13 |
# File 'lib/demo_api.rb', line 11 def print_hello SABEQ_URL end |