Class: SalesforceBulk::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/salesforce_bulk/batch.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#apex_processing_timeObject

Returns the value of attribute apex_processing_time.



4
5
6
# File 'lib/salesforce_bulk/batch.rb', line 4

def apex_processing_time
  @apex_processing_time
end

#api_active_processing_timeObject

Returns the value of attribute api_active_processing_time.



5
6
7
# File 'lib/salesforce_bulk/batch.rb', line 5

def api_active_processing_time
  @api_active_processing_time
end

#completed_atObject

Returns the value of attribute completed_at.



6
7
8
# File 'lib/salesforce_bulk/batch.rb', line 6

def completed_at
  @completed_at
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/salesforce_bulk/batch.rb', line 7

def created_at
  @created_at
end

#failed_recordsObject

Returns the value of attribute failed_records.



8
9
10
# File 'lib/salesforce_bulk/batch.rb', line 8

def failed_records
  @failed_records
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/salesforce_bulk/batch.rb', line 9

def id
  @id
end

#job_idObject

Returns the value of attribute job_id.



10
11
12
# File 'lib/salesforce_bulk/batch.rb', line 10

def job_id
  @job_id
end

#processed_recordsObject

Returns the value of attribute processed_records.



11
12
13
# File 'lib/salesforce_bulk/batch.rb', line 11

def processed_records
  @processed_records
end

#stateObject

Returns the value of attribute state.



12
13
14
# File 'lib/salesforce_bulk/batch.rb', line 12

def state
  @state
end

#total_processing_timeObject

Returns the value of attribute total_processing_time.



13
14
15
# File 'lib/salesforce_bulk/batch.rb', line 13

def total_processing_time
  @total_processing_time
end

Class Method Details

.new_from_xml(data) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/salesforce_bulk/batch.rb', line 15

def self.new_from_xml(data)
  batch = self.new
  batch.id = data['id']
  batch.job_id = data['jobId']
  batch.state = data['state']
  batch.created_at = DateTime.parse(data['createdDate'])
  batch.completed_at = DateTime.parse(data['systemModstamp'])
  batch.processed_records = data['numberRecordsProcessed'].to_i
  batch.failed_records = data['numberRecordsFailed'].to_i
  batch.total_processing_time = data['totalProcessingTime'].to_i
  batch.api_active_processing_time = data['apiActiveProcessingTime'].to_i
  batch.apex_processing_time = data['apex_processing_time'].to_i
  batch
end

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/salesforce_bulk/batch.rb', line 38

def completed?
  state? 'Completed'
end

#failed?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/salesforce_bulk/batch.rb', line 42

def failed?
  state? 'Failed'
end

#in_progress?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/salesforce_bulk/batch.rb', line 30

def in_progress?
  state? 'InProgress'
end

#queued?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/salesforce_bulk/batch.rb', line 34

def queued?
  state? 'Queued'
end

#state?(value) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/salesforce_bulk/batch.rb', line 46

def state?(value)
  self.state.present? && self.state.casecmp(value) == 0
end