Class: WolfCore::SalesforceOauthService
- Inherits:
-
ApplicationService
- Object
- ApplicationService
- WolfCore::SalesforceOauthService
- Defined in:
- lib/wolf_core/application/salesforce_oauth_service.rb
Instance Method Summary collapse
Methods inherited from ApplicationService
#call, #get_salesforce_access_token, #get_salesforce_foreign_object, #get_wolf_token, #raise_failed_result, #remove_non_permitted_parameters, #salesforce_http_get, #validate_presence, #validate_salesforce_response
Methods included from LoggingUtils
Methods included from LambdaFunctionOperations
#deep_parse_json, #get_event_params, #invoke_lambda, #parse_lambda_response, #result_to_response, #validate_lambda_response
Methods included from ExceptionOperations
Methods included from HttpOperations
#async_http_get, #async_http_post, #async_http_put, #http_get, #http_post, #http_put, #parse_http_response, #validate_http_response
Methods included from AsyncUtils
Instance Method Details
#process ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wolf_core/application/salesforce_oauth_service.rb', line 3 def process response = http_post( url: ENV['SALESFORCE_OAUTH_URL'], headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }, body: { grant_type: ENV['SALESFORCE_OAUTH_GRANT_TYPE'], username: ENV['SALESFORCE_OAUTH_USERNAME'], password: ENV['SALESFORCE_OAUTH_PASSWORD'], client_id: ENV['SALESFORCE_OAUTH_CLIENT_ID'], client_secret: ENV['SALESFORCE_OAUTH_CLIENT_SECRET'], } ) if response.code == 200 access_token = JSON.parse(response.body)['access_token'] puts "salesforce access token is #{access_token}" Result.success(data: { access_token: access_token }) else Result.failure(error: { message: response., code: response.code, body: response.body }) end end |