Class: BulkImports::ExportStatus
- Inherits:
-
Object
- Object
- BulkImports::ExportStatus
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/models/bulk_imports/export_status.rb
Instance Method Summary collapse
- #batch(batch_number) ⇒ Object
- #batched? ⇒ Boolean
- #batches_count ⇒ Object
- #empty? ⇒ Boolean
- #error ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(pipeline_tracker, relation) ⇒ ExportStatus
constructor
A new instance of ExportStatus.
- #started? ⇒ Boolean
Constructor Details
#initialize(pipeline_tracker, relation) ⇒ ExportStatus
Returns a new instance of ExportStatus.
7 8 9 10 11 12 13 |
# File 'app/models/bulk_imports/export_status.rb', line 7 def initialize(pipeline_tracker, relation) @pipeline_tracker = pipeline_tracker @relation = relation @entity = @pipeline_tracker.entity @configuration = @entity.bulk_import.configuration @client = Clients::HTTP.new(url: @configuration.url, token: @configuration.access_token) end |
Instance Method Details
#batch(batch_number) ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/models/bulk_imports/export_status.rb', line 39 def batch(batch_number) raise ArgumentError if batch_number < 1 return unless batched? status['batches'].find { |item| item['batch_number'] == batch_number } end |
#batched? ⇒ Boolean
31 32 33 |
# File 'app/models/bulk_imports/export_status.rb', line 31 def batched? status['batched'] == true end |
#batches_count ⇒ Object
35 36 37 |
# File 'app/models/bulk_imports/export_status.rb', line 35 def batches_count status['batches_count'].to_i end |
#empty? ⇒ Boolean
23 24 25 |
# File 'app/models/bulk_imports/export_status.rb', line 23 def empty? status.nil? end |
#error ⇒ Object
27 28 29 |
# File 'app/models/bulk_imports/export_status.rb', line 27 def error status['error'] end |