Module: Orderspace::Endpoint::Oauth
Overview
Contains the methods to interact with the oauth endpoint.
Instance Method Summary collapse
-
#obtain_access_token(client_id, client_secret) ⇒ Orderspace::Structs::OauthCredentials
Fetches the orderspace access token to interact with the Orderspace API.
Methods included from Structs
Instance Method Details
#obtain_access_token(client_id, client_secret) ⇒ Orderspace::Structs::OauthCredentials
Fetches the orderspace access token to interact with the Orderspace API
18 19 20 21 22 23 |
# File 'lib/orderspace/endpoint/oauth.rb', line 18 def obtain_access_token(client_id, client_secret) response = client.request(:post, 'https://identity.orderspace.com/oauth/token', { client_id:, client_secret:, grant_type: 'client_credentials' }) Orderspace::Structs.from(JSON.parse(response.body), OauthCredentials) end |