C0 code coverage information
Generated on Sun Dec 21 22:36:24 +0000 2008 with
rcov 0.8.1.2
Code reported as executed by Ruby looks like
this... and this: this line is also marked as
covered. Lines considered as run by rcov, but
not reported by Ruby, look like this, and
this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not
executed.
1 module PostalMethods 2 3 class GenericCodeError < Exception 4 def initialize 5 super("You have reached a
code error in the ruby gem. Please report to the forums") 6 end 7 end 8 9 class NoCredentialsException < Exception 10 def initialize 11 super("You have failed to
provide any credentials") 12 end 13 end 14 15
class NoPreparationException < Exception 16 def initialize 17 super("You must prepare the client first with
@client.prepare!") 18 end 19 end 20 21
class InvalidLetterIDsRange < Exception 22 def initialize 23 super("You need to supply an array or a list of
ids, comma seperated.") 24 end 25 end 26 27
class NoConnectionError < Exception 28 def initialize 29 super("Error connecting to the API server. If you
are sure you are online, Please call support.") 30 end 31 end 32 33 ## base api exception - stolen from Halcyon
34 ##
http://github.com/mtodd/halcyon/tree/master/LICENSE 35 36 class APIException < Exception 37 attr_accessor :status, :body
38 def initialize(status,
body) 39 @status = status
40 @body = body
41 super
"[#{@status}] #{@body}" 42 end 43 end 44 45
API_STATUS_CODES = { 46
-3000 => "OK: Successfully received the request", 47 -3001 => "This user is not
authorized to access the specified item", 48 -3003 => "Not
Authenticated", 49
-3004 => "The specified extension is not supported",
50 -3010 =>
"Rejected: no funds available", 51 -3020 => "The file specified is unavailable (it
may still be being processed, please try later)", 52 -3022 => "Cancellation
Denied: The letter was physically processed and cannot be cancelled",
53 -3113 =>
"Rejected: the city field contains more than 30 characters",
54 -3114 =>
"Rejected: the state field contains more than 30 characters",
55 -3115 =>
"There was no data returned for your query", 56 -3116 => "The specified
letter (ID) does not exist in the system", 57 -3117 => "Rejected: the
company field contains more than 45 characters", 58 -3118 => "Rejected: the
address1 field contains more than 45 characters", 59 -3119 => "Rejected: the
address2 field contains more than 45 characters", 60 -3120 => "Rejected: the
AttentionLine1 field contains more than 45 characters", 61 -3121 => "Rejected: the
AttentionLine2 field contains more than 45 characters", 62 -3122 => "Rejected: the
AttentionLine3 field contains more than 45 characters", 63 -3123 => "Rejected: the
PostalCode/ZIP field contains more than 15 characters", 64 -3124 => "Rejected: the
Country field contains more than 30 characters", 65 -3150 => "General System
Error: Contact technical support", 66 -3500 => "Warning: too many attempts were made
for this method", 67 -4001 => "The username field is empty or
missing", 68 -4002
=> "The password field is empty or missing", 69 -4003 => "The
MyDescription field is empty or missing - please contact support",
70 -4004 => "The
FileExtension field is empty or missing - please contact support",
71 -4005 => "The
FileBinaryData field is empty or missing - please contact support",
72 -4006 => "The
Address1 field is empty or missing", 73 -4007 => "The city field is empty or
missing", 74 -4008
=> "The Attention1 or Company fields are empty or missing",
75 -4009 => "The
ID field is empty or missing.", 76 -4010 => "The MinID field is empty or
missing", 77 -4011
=> "The MaxID field is empty or missing", 78 } 79 80 #-- 81 # Classify Status Codes 82 #++ 83 84 API_STATUS_CODES.to_a.each do |http_status|
85 status, body =
http_status 86 class_eval
<<-"end;" 87 class APIStatusCode#{status.to_s.gsub(/(
|\-)/,'')}Exception < PostalMethods::APIException 88 def initialize(body=nil)
89 body = '#{body}' if
body.nil? 90
super(#{status}, body) 91 end 92 end 93 end; 94 end 95 96
97 end
Generated using the rcov
code coverage analysis tool for Ruby version 0.8.1.2.