Class: CanadianTire::StoreAddressesImporter::Result
- Inherits:
-
Data
- Object
- Data
- CanadianTire::StoreAddressesImporter::Result
- Defined in:
- app/services/canadian_tire/store_addresses_importer.rb
Overview
Outcome of a full-refresh run.
Instance Attribute Summary collapse
-
#after_count ⇒ Object
readonly
Returns the value of attribute after_count.
-
#after_count [Integer] rows in the table after the run([Integer]) ⇒ Object
readonly
(equal to +before_count+ on +dry_run+).
-
#before_count ⇒ Object
readonly
Returns the value of attribute before_count.
-
#before_count [Integer] rows in the table before the run.([Integer]) ⇒ Object
readonly
Outcome of a full-refresh run.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#errors [Array<Hash>] read-time failures —([Array<Hash>]) ⇒ Object
readonly
missing headers, etc.
-
#inserted ⇒ Object
readonly
Returns the value of attribute inserted.
-
#inserted [Integer] rows the sheet contained and([Integer]) ⇒ Object
readonly
that would have been inserted (equal to +after_count+ on a live run).
Instance Method Summary collapse
-
#initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
- #summary ⇒ Object
Constructor Details
#initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) ⇒ Result
Returns a new instance of Result.
67 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 67 def initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) = super |
Instance Attribute Details
#after_count ⇒ Object (readonly)
Returns the value of attribute after_count
66 67 68 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 def after_count @after_count end |
#after_count [Integer] rows in the table after the run([Integer]) ⇒ Object (readonly)
(equal to +before_count+ on +dry_run+).
66 67 68 69 70 71 72 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 Result = Data.define(:before_count, :after_count, :inserted, :errors) do def initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) = super def success? = errors.empty? def summary "before=#{before_count} after=#{after_count} inserted=#{inserted} errors=#{errors.length}" end end |
#before_count ⇒ Object (readonly)
Returns the value of attribute before_count
66 67 68 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 def before_count @before_count end |
#before_count [Integer] rows in the table before the run.([Integer]) ⇒ Object (readonly)
Outcome of a full-refresh run.
66 67 68 69 70 71 72 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 Result = Data.define(:before_count, :after_count, :inserted, :errors) do def initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) = super def success? = errors.empty? def summary "before=#{before_count} after=#{after_count} inserted=#{inserted} errors=#{errors.length}" end end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors
66 67 68 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 def errors @errors end |
#errors [Array<Hash>] read-time failures —([Array<Hash>]) ⇒ Object (readonly)
missing headers, etc. Per-row insert failures abort the whole
transaction (we want all-or-nothing for a full refresh).
66 67 68 69 70 71 72 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 Result = Data.define(:before_count, :after_count, :inserted, :errors) do def initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) = super def success? = errors.empty? def summary "before=#{before_count} after=#{after_count} inserted=#{inserted} errors=#{errors.length}" end end |
#inserted ⇒ Object (readonly)
Returns the value of attribute inserted
66 67 68 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 def inserted @inserted end |
#inserted [Integer] rows the sheet contained and([Integer]) ⇒ Object (readonly)
that would have been inserted (equal to +after_count+ on a live run).
66 67 68 69 70 71 72 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 66 Result = Data.define(:before_count, :after_count, :inserted, :errors) do def initialize(before_count: 0, after_count: 0, inserted: 0, errors: []) = super def success? = errors.empty? def summary "before=#{before_count} after=#{after_count} inserted=#{inserted} errors=#{errors.length}" end end |
Instance Method Details
#success? ⇒ Boolean
68 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 68 def success? = errors.empty? |
#summary ⇒ Object
69 70 71 |
# File 'app/services/canadian_tire/store_addresses_importer.rb', line 69 def summary "before=#{before_count} after=#{after_count} inserted=#{inserted} errors=#{errors.length}" end |