Class: OFX::Status
- Inherits:
-
Object
- Object
- OFX::Status
- Defined in:
- lib/ofx/status.rb,
lib/ofx/status.rb,
lib/ofx/1.0.2/status.rb
Overview
build tables of the status subclasses
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#severity ⇒ Object
Returns the value of attribute severity.
Class Method Summary collapse
- .from_numerical_code_severity_and_message(code, severity, message) ⇒ Object
- .from_ofx_102_hash(status_hash) ⇒ Object
Instance Method Summary collapse
-
#initialize(code, severity, message) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(code, severity, message) ⇒ Status
Returns a new instance of Status.
24 25 26 27 28 |
# File 'lib/ofx/status.rb', line 24 def initialize(code, severity, ) @code = code @severity = severity @message = end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
20 21 22 |
# File 'lib/ofx/status.rb', line 20 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
22 23 24 |
# File 'lib/ofx/status.rb', line 22 def @message end |
#severity ⇒ Object
Returns the value of attribute severity.
21 22 23 |
# File 'lib/ofx/status.rb', line 21 def severity @severity end |
Class Method Details
.from_numerical_code_severity_and_message(code, severity, message) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ofx/status.rb', line 30 def self.(code, severity, ) status_class = CODES_TO_OFX_STATUS[code] || SEVERITIES_TO_UNKNOWN_OFX_STATUS[severity] raise unless status_class status_class.new(code, severity, ) end |
.from_ofx_102_hash(status_hash) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ofx/1.0.2/status.rb', line 20 def self.from_ofx_102_hash(status_hash) return OFX::Status.(status_hash['CODE'].to_i, case status_hash['SEVERITY'] when 'INFO' then :information when 'WARN' then :warning when 'ERROR' then :error end, status_hash['MESSAGE']) end |