Class: ElectionBuddy::Importation
- Inherits:
-
Object
- Object
- ElectionBuddy::Importation
- Defined in:
- lib/election_buddy/entities/importation.rb
Overview
Represents an importation operation for voter lists
Instance Method Summary collapse
-
#done? ⇒ Boolean
Checks if the importation completed successfully.
-
#error ⇒ String?
Returns the error message if importation failed.
-
#identifier ⇒ String
Returns the identifier for this importation.
-
#initialize(response) ⇒ Importation
constructor
A new instance of Importation.
Constructor Details
#initialize(response) ⇒ Importation
Returns a new instance of Importation.
16 17 18 |
# File 'lib/election_buddy/entities/importation.rb', line 16 def initialize(response) @response = response end |
Instance Method Details
#done? ⇒ Boolean
Checks if the importation completed successfully
30 31 32 |
# File 'lib/election_buddy/entities/importation.rb', line 30 def done? @response["error"].nil? end |
#error ⇒ String?
Returns the error message if importation failed
37 38 39 40 41 |
# File 'lib/election_buddy/entities/importation.rb', line 37 def error return nil if done? ErrorFormatter.format(@response["error"]) end |
#identifier ⇒ String
Returns the identifier for this importation
23 24 25 |
# File 'lib/election_buddy/entities/importation.rb', line 23 def identifier @response["importation_identifier"] || "Not Available" end |