Class: OpenID::AX::StoreResponse

Inherits:
AXMessage show all
Defined in:
lib/openid/extensions/ax.rb

Overview

An indication that the store request was processed along with this OpenID transaction.

Constant Summary collapse

SUCCESS_MODE =
'store_response_success'
FAILURE_MODE =
'store_response_failure'

Constants inherited from AXMessage

AXMessage::NS_URI

Instance Attribute Summary collapse

Attributes inherited from AXMessage

#mode, #ns_alias, #ns_uri

Instance Method Summary collapse

Methods inherited from Extension

#to_message

Constructor Details

#initialize(succeeded = true, error_message = nil) ⇒ StoreResponse

Returns a new instance of StoreResponse.



490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/openid/extensions/ax.rb', line 490

def initialize(succeeded = true, error_message = nil)
  super()
  if succeeded and error_message
    raise Error, "Error message included in a success response"
  end
  if succeeded
    @mode = SUCCESS_MODE
  else
    @mode = FAILURE_MODE
  end
  @error_message = error_message
end

Instance Attribute Details

#error_messageObject (readonly)

Returns the value of attribute error_message.



488
489
490
# File 'lib/openid/extensions/ax.rb', line 488

def error_message
  @error_message
end

Instance Method Details

#get_extension_argsObject



507
508
509
510
511
512
513
# File 'lib/openid/extensions/ax.rb', line 507

def get_extension_args
  ax_args = new_args
  if !succeeded? and error_message
    ax_args['error'] = @error_message
  end
  return ax_args
end

#succeeded?Boolean

Returns:

  • (Boolean)


503
504
505
# File 'lib/openid/extensions/ax.rb', line 503

def succeeded?
  @mode == SUCCESS_MODE
end