Exception: Ratis::Errors::SoapError
- Inherits:
-
Ratis::Error
- Object
- StandardError
- Ratis::Error
- Ratis::Errors::SoapError
- Defined in:
- lib/ratis/errors.rb
Instance Attribute Summary collapse
-
#fault_code ⇒ Object
Returns the value of attribute fault_code.
-
#fault_string ⇒ Object
Returns the value of attribute fault_string.
Instance Method Summary collapse
-
#initialize(savon_soap_fault = nil) ⇒ SoapError
constructor
A new instance of SoapError.
-
#to_s ⇒ Object
def self.version_mismatch(method, version) error = Errors.new error.fault_string = “Unimplemented SOAP method #{ method } #{ version }” error end.
- #verbose_fault_string ⇒ Object
Constructor Details
#initialize(savon_soap_fault = nil) ⇒ SoapError
Returns a new instance of SoapError.
10 11 12 13 14 15 16 |
# File 'lib/ratis/errors.rb', line 10 def initialize(savon_soap_fault = nil) return if savon_soap_fault.nil? or savon_soap_fault.blank? fault = savon_soap_fault.to_hash[:fault] code = fault[:faultcode].scan(/\d+/).first self.fault_code = code.to_i if code self.fault_string = fault[:faultstring] end |
Instance Attribute Details
#fault_code ⇒ Object
Returns the value of attribute fault_code.
8 9 10 |
# File 'lib/ratis/errors.rb', line 8 def fault_code @fault_code end |
#fault_string ⇒ Object
Returns the value of attribute fault_string.
8 9 10 |
# File 'lib/ratis/errors.rb', line 8 def fault_string @fault_string end |
Instance Method Details
#to_s ⇒ Object
def self.version_mismatch(method, version)
error = Errors.new
error.fault_string = "Unimplemented SOAP method #{ method } #{ version }"
error
end
24 25 26 |
# File 'lib/ratis/errors.rb', line 24 def to_s fault_string end |
#verbose_fault_string ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ratis/errors.rb', line 28 def verbose_fault_string case fault_string when /10222|invalid Stopid/i 'Invalid STOP ID number. Please enter a valid five digit stop ID number' when /20003|20046/ 'No stops were found within the walking distance of the origin you specified' when /20004|20047/ 'No stops were found within the walking distance of the destination you specified' when /20048/ 'No stops were found within the walking distance of the destination or origin you specified' when /20005/ 'There is no service at this stop on the date and time specified' when /20006/ 'No services run at the date or time specified for your destination' when /20007/ 'No trips were found matching the criteria you specified' when /20008/ 'No services run at the date or time specified' when /11085/ 'Origin is within trivial distance of the destination' when /15034/ 'No runs available for the stop and times provided' when /1007|no runs available/i 'There is no service at this stop on the date and time specified' when /15035/ 'The route you specified does not serve this stop at the date and time specified' when /invalid Window|15030/i 'The minimum time range is one hour. Please adjust the start and/or end time and try again.' when /invalid Location|20024/i 'Either the origin or destination could not be recognized by the server' when /out of range/i 'The date you entered was out of range - please choose a valid date' else 'The server could not handle your request at this time. Please try again later' end end |