Class: OFX::Data::Transaction::Status
- Inherits:
-
Object
- Object
- OFX::Data::Transaction::Status
- Defined in:
- lib/ofx/data/transaction/status.rb
Constant Summary collapse
- SEVERITIES =
[:info, :warn, :error].freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Status
constructor
A new instance of Status.
- #ofx_type ⇒ Object
Constructor Details
#initialize(opts) ⇒ Status
Returns a new instance of Status.
9 10 11 12 13 14 15 16 17 |
# File 'lib/ofx/data/transaction/status.rb', line 9 def initialize(opts) @code = opts.fetch(:code) raise ArgumentError, ":code must be an integer, was #{@code.inspect}" unless @code.is_a?(Fixnum) raise ArgumentError, ":code must be a positive integer < 1000000, was #{@code}" if @code > 999999 @severity = opts.fetch(:severity) raise ArgumentError, ":severity must be one of #{SEVERITIES.inspect}, was #{@severity.inspect}" unless SEVERITIES.include?(@severity) @message = opts.fetch(:message, nil) raise ArgumentError, ":message must be no more than 255 chars, was #{@message.length}" if @message && @message.length > 255 end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/ofx/data/transaction/status.rb', line 7 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/ofx/data/transaction/status.rb', line 7 def @message end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
7 8 9 |
# File 'lib/ofx/data/transaction/status.rb', line 7 def severity @severity end |
Instance Method Details
#ofx_type ⇒ Object
19 20 21 |
# File 'lib/ofx/data/transaction/status.rb', line 19 def ofx_type :"transaction.status" end |