Class: VivaWallet::Authentication
- Inherits:
-
Object
- Object
- VivaWallet::Authentication
- Defined in:
- lib/viva_wallet/authentication.rb
Class Method Summary collapse
Class Method Details
.oauth ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/viva_wallet/authentication.rb', line 7 def oauth RestClient::Request.new({ method: :post, url: VivaWallet.account_api_base + 'connect/token', payload: {grant_type: 'client_credentials'}, headers: { content_type: 'application/x-www-form-urlencoded', Authorization: "Basic #{VivaWallet.client_base64}" } }).execute do |response, request, result| str_response = response.to_str str_response.blank? ? '' : JSON.parse(str_response) end end |