Class: PinterestSdkClient::OauthApi
- Inherits:
-
Object
- Object
- PinterestSdkClient::OauthApi
- Defined in:
- lib/pinterest_sdk/api/oauth_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ OauthApi
constructor
A new instance of OauthApi.
-
#oauth_conversion_token(opts = {}) ⇒ ConversionAccessToken
Generate OAuth access token for conversion API Generate a new and long-lived OAuth access token dedicated for sending conversions using a valid access token.
-
#oauth_conversion_token_with_http_info(opts = {}) ⇒ Array<(ConversionAccessToken, Integer, Hash)>
Generate OAuth access token for conversion API Generate a new and long-lived OAuth access token dedicated for sending conversions using a valid access token.
-
#oauth_token(grant_type, opts = {}) ⇒ OauthAccessToken
Generate OAuth access token Generate a new OAuth access token using an authorization code; or refresh an existing one using a continuous refresh token.
-
#oauth_token_with_http_info(grant_type, opts = {}) ⇒ Array<(OauthAccessToken, Integer, Hash)>
Generate OAuth access token Generate a new OAuth access token using an authorization code; or refresh an existing one using a continuous refresh token.
-
#token_revoke(token, opts = {}) ⇒ nil
Revoke a token Revokes an access or refresh token.
-
#token_revoke_with_http_info(token, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Revoke a token Revokes an access or refresh token.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ OauthApi
Returns a new instance of OauthApi.
19 20 21 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#oauth_conversion_token(opts = {}) ⇒ ConversionAccessToken
Generate OAuth access token for conversion API Generate a new and long-lived OAuth access token dedicated for sending conversions using a valid access token.
26 27 28 29 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 26 def oauth_conversion_token(opts = {}) data, _status_code, _headers = oauth_conversion_token_with_http_info(opts) data end |
#oauth_conversion_token_with_http_info(opts = {}) ⇒ Array<(ConversionAccessToken, Integer, Hash)>
Generate OAuth access token for conversion API Generate a new and long-lived OAuth access token dedicated for sending conversions using a valid access token.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 35 def oauth_conversion_token_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.oauth_conversion_token ...' end # resource path local_var_path = '/oauth/conversion_token' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ConversionAccessToken' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"OauthApi.oauth_conversion_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#oauth_conversion_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#oauth_token(grant_type, opts = {}) ⇒ OauthAccessToken
Generate OAuth access token
Generate a new OAuth access token using an authorization code; or refresh an existing one using a continuous refresh token. Follow the complete steps for requesting and refreshing tokens. Note: If your app was created before September 25, 2025, make sure to set the continuous_refresh parameter to true to use the continuous refresh token (60-day expiration, refreshable indefinitely). Pinterest no longer supports the legacy refresh token (365-day expiration, hard limit). Disregard this note if your app was activated on or after September 25, 2025. You are automatically using the continuous refresh token. Use Token Debugger to validate and inspect your access token.
89 90 91 92 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 89 def oauth_token(grant_type, opts = {}) data, _status_code, _headers = oauth_token_with_http_info(grant_type, opts) data end |
#oauth_token_with_http_info(grant_type, opts = {}) ⇒ Array<(OauthAccessToken, Integer, Hash)>
Generate OAuth access token Generate a new OAuth access token using an authorization code; or refresh an existing one using a continuous refresh token. Follow the complete steps for requesting and refreshing tokens. Note: If your app was created before September 25, 2025, make sure to set the `continuous_refresh` parameter to `true` to use the continuous refresh token (60-day expiration, refreshable indefinitely). Pinterest no longer supports the legacy refresh token (365-day expiration, hard limit). Disregard this note if your app was activated on or after September 25, 2025. You are automatically using the continuous refresh token. Use Token Debugger to validate and inspect your access token.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 104 def oauth_token_with_http_info(grant_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.oauth_token ...' end # verify the required parameter 'grant_type' is set if @api_client.config.client_side_validation && grant_type.nil? fail ArgumentError, "Missing the required parameter 'grant_type' when calling OauthApi.oauth_token" end # resource path local_var_path = '/oauth/token' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['grant_type'] = grant_type form_params['code'] = opts[:'code'] if !opts[:'code'].nil? form_params['continuous_refresh'] = opts[:'continuous_refresh'] if !opts[:'continuous_refresh'].nil? form_params['redirect_uri'] = opts[:'redirect_uri'] if !opts[:'redirect_uri'].nil? form_params['refresh_token'] = opts[:'refresh_token'] if !opts[:'refresh_token'].nil? form_params['scope'] = opts[:'scope'] if !opts[:'scope'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'OauthAccessToken' # auth_names auth_names = opts[:debug_auth_names] || ['basic'] = opts.merge( :operation => :"OauthApi.oauth_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#oauth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#token_revoke(token, opts = {}) ⇒ nil
Revoke a token Revokes an access or refresh token. Only tokens issued for system users are currently supported. Revoked tokens become immediately invalid and unusable.
169 170 171 172 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 169 def token_revoke(token, opts = {}) token_revoke_with_http_info(token, opts) nil end |
#token_revoke_with_http_info(token, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Revoke a token Revokes an access or refresh token. Only tokens issued for system users are currently supported. Revoked tokens become immediately invalid and unusable.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/pinterest_sdk/api/oauth_api.rb', line 180 def token_revoke_with_http_info(token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OauthApi.token_revoke ...' end # verify the required parameter 'token' is set if @api_client.config.client_side_validation && token.nil? fail ArgumentError, "Missing the required parameter 'token' when calling OauthApi.token_revoke" end # resource path local_var_path = '/oauth/token/revoke' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['token'] = token form_params['token_type_hint'] = opts[:'token_type_hint'] if !opts[:'token_type_hint'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['basic'] = opts.merge( :operation => :"OauthApi.token_revoke", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OauthApi#token_revoke\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |