Class: Dibs::Results::DibsResult
- Inherits:
-
Object
- Object
- Dibs::Results::DibsResult
- Defined in:
- lib/results/dibs_result.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#result_parsed ⇒ Object
readonly
Returns the value of attribute result_parsed.
Instance Method Summary collapse
- #accepted? ⇒ Boolean
- #declined? ⇒ Boolean
-
#initialize(result_string) ⇒ DibsResult
constructor
A new instance of DibsResult.
- #method_missing(sym, *args, &block) ⇒ Object
- #result_text ⇒ Object
Constructor Details
#initialize(result_string) ⇒ DibsResult
Returns a new instance of DibsResult.
8 9 10 11 12 13 |
# File 'lib/results/dibs_result.rb', line 8 def initialize(result_string) @result = result_string parts = @result.split(/&|=/) @result_parsed = Hash[*parts] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
23 24 25 26 |
# File 'lib/results/dibs_result.rb', line 23 def method_missing(sym, *args, &block) return @result_parsed[sym.to_s] if @result_parsed.has_key?(sym.to_s) super(sym, *args, &block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/results/dibs_result.rb', line 6 def result @result end |
#result_parsed ⇒ Object (readonly)
Returns the value of attribute result_parsed.
5 6 7 |
# File 'lib/results/dibs_result.rb', line 5 def result_parsed @result_parsed end |
Instance Method Details
#accepted? ⇒ Boolean
15 16 17 |
# File 'lib/results/dibs_result.rb', line 15 def accepted? @result_parsed['status'] == 'ACCEPTED' end |
#declined? ⇒ Boolean
19 20 21 |
# File 'lib/results/dibs_result.rb', line 19 def declined? not self.accepted? end |
#result_text ⇒ Object
28 29 30 |
# File 'lib/results/dibs_result.rb', line 28 def result_text "not implemented" end |