Class: OmniAuth::Strategies::Linnworks
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Linnworks
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/linnworks.rb
Instance Method Summary collapse
-
#callback_phase ⇒ Object
rubocop:disable MethodLength.
-
#request_phase ⇒ Object
rubocop:disable MethodLength.
Instance Method Details
#callback_phase ⇒ Object
rubocop:disable MethodLength
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/omniauth/strategies/linnworks.rb', line 31 def callback_phase # rubocop:disable MethodLength @response = Faraday.post('https://api.linnworks.net//api/Auth/AuthorizeByApplication', {"applicationId" => .application_id, "applicationSecret" => .application_secret, "token" => request.params['token']}) fail!(:error, Exception.new(JSON.parse(@response.body))) unless @response.success? super rescue ::Timeout::Error => e fail!(:timeout, e) rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e fail!(:service_unavailable, e) rescue ::OAuth::Unauthorized => e fail!(:invalid_credentials, e) end |
#request_phase ⇒ Object
rubocop:disable MethodLength
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/omniauth/strategies/linnworks.rb', line 20 def request_phase # rubocop:disable MethodLength = "#{..site}#{..}/#{.application_id}" += "?tracking=#{..tracking}" if ..tracking redirect rescue ::Timeout::Error => e fail!(:timeout, e) rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e fail!(:service_unavailable, e) end |