Module: BigDoor::ResponseCodes

Defined in:
lib/big-door/response_codes.rb

Constant Summary collapse

CODES =
[
		{:code => 0,
:response_condition => "Created",
:log => false,
:is_error => false,
:return_objects_url_with_error => false,
:http_response => 201,
:http_code_definition => "Created",
:reason_phrase => "Created",
:header_modifications => "",
:value => ""},
		{:code => 1,
:response_condition => "Updated",
:log => false,
:is_error => false,
:return_objects_url_with_error => false,
:http_response => 200,
:http_code_definition => "OK",
:reason_phrase => "Updated",
:header_modifications => "",
:value => ""},
		{:code => 2,
:response_condition => "Signature Failure Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 401,
:http_code_definition => "Unauthorized",
:reason_phrase => "Invalid signature; review the Request Signature process and retry",
:header_modifications => "WWW-Authenticate",
:value => "auth-scheme = \"Digest\" nonce = \"random number\""},
		{:code => 3,
:response_condition => "User Cap Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 503,
:http_code_definition => "Service Unavailable",
:reason_phrase => "User Cap met; if applicable,
 wait and retry or re-configure caps.",
:header_modifications => "",
:value => ""},
		{:code => 4,
:response_condition => "Replay (pre) Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 503,
:http_code_definition => "Service Unavailable",
:reason_phrase => "Token previously used (pre); use a unique token",
:header_modifications => "",
:value => ""},
		{:code => 5,
:response_condition => "No Named Group Primary Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 409,
:http_code_definition => "Conflict",
:reason_phrase => "No Named Group Primary; set a Primary Named Transaction for this group.",
:header_modifications => "",
:value => ""},
		{:code => 6,
:response_condition => "Variable Amounts Disallowed Error [2]",
:log => false,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 409,
:http_code_definition => "Conflict",
:reason_phrase => "Variable amounts not allowed; retry without passing amount,
 or reconfigure group.",
:header_modifications => "",
:value => ""},
		{:code => 7,
:response_condition => "Balance Exceeded Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 402,
:http_code_definition => "Payment Required",
:reason_phrase => "Balance exceeded for this user; advise end-user",
:header_modifications => "",
:value => ""},
		{:code => 8,
:response_condition => "Transaction Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 500,
:http_code_definition => "Internal Server Error",
:reason_phrase => "Transaction error; alert service provider",
:header_modifications => "",
:value => ""},
		{:code => 9,
:response_condition => "Summary Update Error [3]",
:log => false,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 500,
:http_code_definition => "Internal Server Error",
:reason_phrase => "Summary update error; alert service provider",
:header_modifications => "",
:value => ""},
		{:code => 10,
:response_condition => "Replay (post) Error",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 503,
:http_code_definition => "Service Unavailable",
:reason_phrase => "Token previously used (post); use a unique token",
:header_modifications => "",
:value => ""},
		{:code => 11,
:response_condition => "Method Not Allowed",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 405,
:http_code_definition => "Method Not Allowed",
:reason_phrase => "HTTP Method not allowed on this resource",
:header_modifications => "",
:value => ""},
		{:code => 12,
:response_condition => "Method Not Recognized",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 501,
:http_code_definition => "Not Implemented",
:reason_phrase => "HTTP Method not recognized.",
:header_modifications => "",
:value => ""},
		{:code => 13,
:response_condition => "User Disabled",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 403,
:http_code_definition => "Forbidden",
:reason_phrase => "User has been disabled; contact us to re-enable",
:header_modifications => "",
:value => ""},
		{:code => 14,
:response_condition => "Named Transaction is_source misconfigured",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 409,
:http_code_definition => "Conflict",
:reason_phrase => "Named Transaction has incorrect is_source flag. Sales of goods must not be sources",
:header_modifications => "",
:value => ""},
		{:code => 15,
:response_condition => "Missing Argument",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 405,
:http_code_definition => "Method Not Allowed",
:reason_phrase => "HTTP Method not allowed because it was missing a required argument",
:header_modifications => "",
:value => ""},
		{:code => 16,
:response_condition => "Invalid ID or value in GET",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 405,
:http_code_definition => "Method Not Allowed",
:reason_phrase => "HTTP Method not allowed because it attempted to use a not owned or otherwise invalid resource.",
:header_modifications => "",
:value => ""},
		{:code => 17,
:response_condition => "Invalid ID or value in POST",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 405,
:http_code_definition => "Method Not Allowed",
:reason_phrase => "HTTP Method not allowed because it attempted to use a not owned or otherwise invalid resource.",
:header_modifications => "",
:value => ""},
		{:code => 18,
:response_condition => "Timestamp expired",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 401,
:http_code_definition => "Unauthorized",
:reason_phrase => "Timestamp has expired; create a new request with a current timestamp.",
:header_modifications => "",
:value => ""},
		{:code => 19,
:response_condition => "Challenge-response failure",
:log => true,
:is_error => true,
:return_objects_url_with_error => false,
:http_response => 401,
:http_code_definition => "Unauthorized",
:reason_phrase => "6 challenge response failures",
:header_modifications => "",
:value => ""},
		{:code => 20,
:response_condition => "Challenge-response success",
:log => true,
:is_error => false,
:return_objects_url_with_error => false,
:http_response => 200,
:http_code_definition => "OK",
:reason_phrase => "Challenge-response accepted",
:header_modifications => "",
:value => ""},
		{:code => 21,
:response_condition => "Malformed input parameter",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 400,
:http_code_definition => "Bad Request",
:reason_phrase => "Token must be a valid hexidecimal GUID",
:header_modifications => "",
:value => ""},
		{:code => 22,
:response_condition => "Disabled Named Good Collection",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 409,
:http_code_definition => "Conflict",
:reason_phrase => "An associated NamedGood has been disabled via its NamedGoodCollection; contact service provider",
:header_modifications => "",
:value => ""},
		{:code => 23,
:response_condition => "Disabled Named Good",
:log => true,
:is_error => true,
:return_objects_url_with_error => true,
:http_response => 409,
:http_code_definition => "Conflict",
:reason_phrase => "An associated NamedGood has been disabled; contact service provider",
:header_modifications => "",
:value => ""},
		{:code => 24,
:response_condition => "Resource Found",
:log => true,
:is_error => false,
:return_objects_url_with_error => false,
:http_response => 200,
:http_code_definition => "OK",
:reason_phrase => "The resource was found. Request this resource with verbosity > 0 to retrieve data.",
:header_modifications => "",
:value => ""}]

Class Method Summary collapse

Class Method Details

.find(args) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
# File 'lib/big-door/response_codes.rb', line 4

def self.find(args)
	if args.is_a? Numeric
		args = {:code => args}
	end
	raise ArgumentError, "Expected a Hash but got a #{args.class}" unless args.is_a? Hash
	CODES.find {|x| x[args.keys.first.to_sym] == args.values.first}
end