Class: Hiya::Oauth
Instance Attribute Summary
Attributes inherited from Base
#api_url, #bearer_token, #response, #source
Class Method Summary collapse
Instance Method Summary collapse
-
#token(params) ⇒ Object
params: Hash: { grant_type: ‘password’, — facebook facebook_token: String, — google google_token: String, google_refresh_token: String, — line line_token: String, — chatbot chatbot_token: String, }.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hiya::Base
Class Method Details
.token(params) ⇒ Object
5 6 7 |
# File 'lib/hiya/oauth.rb', line 5 def self.token(params) new.token(params) end |
Instance Method Details
#token(params) ⇒ Object
params: Hash:
grant_type: 'password',
--- facebook
facebook_token: String,
--- google
google_token: String,
google_refresh_token: String,
--- line
line_token: String,
--- chatbot
chatbot_token: String,
21 22 23 24 25 26 27 28 |
# File 'lib/hiya/oauth.rb', line 21 def token(params) @response = conn.post('/v1/oauth/token') do |req| req.body = params.to_json end Oj.load(response.body, symbol_keys: true) rescue StandardError => _e {} end |