Class: OAuth2::Provider::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth2/provider/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(message = nil) ⇒ Error

Returns a new instance of Error.



5
6
7
# File 'lib/oauth2/provider/error.rb', line 5

def initialize(message = nil)
  @message = message
end

Instance Method Details

#redirect?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/oauth2/provider/error.rb', line 9

def redirect?
  false
end

#response_bodyObject



13
14
15
16
# File 'lib/oauth2/provider/error.rb', line 13

def response_body
  message = 'Bad request' + (@message ? ": #{@message}" : '')
  JSON.unparse(ERROR => INVALID_REQUEST, ERROR_DESCRIPTION => message)
end

#response_headersObject



18
19
20
# File 'lib/oauth2/provider/error.rb', line 18

def response_headers
  Exchange::RESPONSE_HEADERS
end

#response_statusObject



22
23
24
# File 'lib/oauth2/provider/error.rb', line 22

def response_status
  400
end