module Fullscriptapi::AuthenticationEndpoints::RefreshToken

Public Instance Methods

refresh_token() click to toggle source
# File lib/fullscriptapi/authentication_endpoints/refresh_token.rb, line 6
def refresh_token
  response = Excon.post("#{get_server}/api/oauth/token",
    headers: {
      "Content-Type": "application/json"
    },
    body: {
      grant_type: "refresh_token",
      client_id: client_id,
      client_secret: secret,
      redirect_uri: redirect_uri,
      refresh_token: token.refresh_token
    }.to_json
  )
  
  body = JSON.parse(response.body)
  
  use_token(body["oauth"])
end