Class: Draisine::Auditor::Result
- Inherits:
-
Object
- Object
- Draisine::Auditor::Result
- Defined in:
- lib/draisine/auditor/result.rb
Instance Attribute Summary collapse
-
#discrepancies ⇒ Object
readonly
Returns the value of attribute discrepancies.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #calculate_result! ⇒ Object
- #discrepancy(type:, salesforce_type:, salesforce_id:, local_type: nil, local_id: nil, local_attributes: nil, remote_attributes: nil, diff_keys: nil) ⇒ Object
- #error!(ex) ⇒ Object
- #failure? ⇒ Boolean
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #running? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 |
# File 'lib/draisine/auditor/result.rb', line 7 def initialize @discrepancies = [] @status = :running @error = nil end |
Instance Attribute Details
#discrepancies ⇒ Object (readonly)
Returns the value of attribute discrepancies.
6 7 8 |
# File 'lib/draisine/auditor/result.rb', line 6 def discrepancies @discrepancies end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/draisine/auditor/result.rb', line 6 def error @error end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/draisine/auditor/result.rb', line 6 def status @status end |
Instance Method Details
#calculate_result! ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/draisine/auditor/result.rb', line 13 def calculate_result! if discrepancies.any? @status = :failure else @status = :success end self end |
#discrepancy(type:, salesforce_type:, salesforce_id:, local_type: nil, local_id: nil, local_attributes: nil, remote_attributes: nil, diff_keys: nil) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/draisine/auditor/result.rb', line 40 def discrepancy(type:, salesforce_type:, salesforce_id:, local_type: nil, local_id: nil, local_attributes: nil, remote_attributes: nil, diff_keys: nil) discrepancies << Discrepancy.new(type, salesforce_type, salesforce_id, local_type, local_id, local_attributes, remote_attributes, diff_keys) end |
#error!(ex) ⇒ Object
22 23 24 25 26 |
# File 'lib/draisine/auditor/result.rb', line 22 def error!(ex) @error = ex @status = :failure self end |
#failure? ⇒ Boolean
32 33 34 |
# File 'lib/draisine/auditor/result.rb', line 32 def failure? @status == :failure end |
#running? ⇒ Boolean
36 37 38 |
# File 'lib/draisine/auditor/result.rb', line 36 def running? @status == :running end |
#success? ⇒ Boolean
28 29 30 |
# File 'lib/draisine/auditor/result.rb', line 28 def success? @status == :success end |