Class: Naviance::AccessToken
- Inherits:
-
Object
- Object
- Naviance::AccessToken
- Includes:
- HTTParty
- Defined in:
- lib/naviance/access_token.rb
Class Method Summary (collapse)
-
+ (Object) get(env, client_id, secret)
Request an access token from Naviance.
Class Method Details
+ (Object) get(env, client_id, secret)
Request an access token from Naviance
Attributes
-
env - The environment you are working in sandbox or production. Also accepts corresponding Rails.env
-
client_id - The Client ID assigned to you by Naviance
-
secret - The secret assigned to you by Naviance
12 13 14 15 16 17 18 19 20 |
# File 'lib/naviance/access_token.rb', line 12 def self.get(env, client_id, secret) resp = HTTParty.get("#{Naviance.base_host(env)}/oauth/access_token?client_id=#{client_id}&client_secret=#{secret}&grant_type=client_credentials") if 200 == resp.code resp.parsed_response['access_token'] else raise resp.parsed_response['error_description'] end end |