Class: Rack::Webmoney::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/webmoney.rb

Constant Summary collapse

ERROR_MESSAGES =
{
  # -3 unknown response
  :server_not_available => "Unknown response",
  # -2 raised network error
  :server_not_available => "Sorry, the Webmoney Login server is not available",
  # -1
  :internal_error       => "Webmoney Login server internal error",
  # 1
  :invalid_arguments    => "Invalid arguments",
  # 2
  :ticket_invalid       => "Sorry, invalid authorization ticket",
  # 3
  :ticket_expired       => "Sorry, authorization ticket expired",
  # 4
  :user_not_found       => "Sorry, user not found",
  # 5
  :holder_not_found     => "The holder of a site not found",
  # 6
  :website_not_found    => "Website Not Found",
  # 7
  :url_not_found        => "This url is not found, or does not belong to the site",
  # 8
  :settings_not_found   => "Security Settings for the site could not be found",
  # 9
  :invalid_password     => "Access service is not authorized. Invalid password.",
  # 10
  :not_trusted          => "Attempting to gain access to the site, which does not accept you as a trustee",
  # 11
  :pwd_access_blocked   => "Password access to the service blocked",
  # 12
  :user_blocked         => "The user is temporarily blocked. Probably made the selection Ticket",
  # 201
  :ip_differs           => "Ip address in the request differs from the address, which was an authorized user"
}

Instance Method Summary collapse

Constructor Details

#initialize(code, info) ⇒ Response

Returns a new instance of Response.



58
59
60
61
# File 'lib/rack/webmoney.rb', line 58

def initialize(code, info)
  @code = code
  @info = info
end

Instance Method Details

#messageObject



75
76
77
# File 'lib/rack/webmoney.rb', line 75

def message
  ERROR_MESSAGES[@code]
end

#statusObject



63
64
65
# File 'lib/rack/webmoney.rb', line 63

def status
  @code
end

#successful?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/rack/webmoney.rb', line 67

def successful?
  @code == :successful
end

#unsuccessful?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/rack/webmoney.rb', line 71

def unsuccessful?
  ERROR_MESSAGES.keys.include?(@code)
end

#wmidObject



79
80
81
# File 'lib/rack/webmoney.rb', line 79

def wmid
  @info[:WmLogin_WMID]
end