Class: BatchResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ BatchResponse

Returns a new instance of BatchResponse.



38
39
40
41
42
43
44
45
# File 'lib/batch_response.rb', line 38

def initialize(params = {})
  @updated = params[:updated] || []
  @not_updated = params[:not_updated] || []
  @async = params[:async] || false
  @preview = params[:preview] || false
  @errors = Hash.new(0)
  @total_attempted = params[:total_attempted] || 0
end

Instance Attribute Details

#asyncObject

Returns Boolean processing is handled asyn.

Returns:

  • Boolean processing is handled asyn



15
16
17
# File 'lib/batch_response.rb', line 15

def async
  @async
end

#capObject

#return nil, integer



33
34
35
# File 'lib/batch_response.rb', line 33

def cap
  @cap
end

#cap_reasonObject

Returns String.

Returns:

  • String



36
37
38
# File 'lib/batch_response.rb', line 36

def cap_reason
  @cap_reason
end

#errorsObject

Returns Hash a list of error messages summarized by times encountered (not the objects they were on).

Returns:

  • Hash a list of error messages summarized by times encountered (not the objects they were on)



28
29
30
# File 'lib/batch_response.rb', line 28

def errors
  @errors
end

#klassObject

Name of the class called, if used



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

def klass
  @klass
end

#methodObject

Name of the method called



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

def method
  @method
end

#not_updatedObject

Returns Array ids of the objects not update.

Returns:

  • Array ids of the objects not update



23
24
25
# File 'lib/batch_response.rb', line 23

def not_updated
  @not_updated
end

#previewObject

Returns Boolean no writes were made.

Returns:

  • Boolean no writes were made



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

def preview
  @preview
end

#total_attemptedObject

Returns the value of attribute total_attempted.



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

def total_attempted
  @total_attempted
end

#updatedObject

Returns Array ids of the objects updated.

Returns:

  • Array ids of the objects updated



19
20
21
# File 'lib/batch_response.rb', line 19

def updated
  @updated
end

Instance Method Details

#to_jsonObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/batch_response.rb', line 47

def to_json
  {
    klass:,
    method:,
    preview:,
    async:,
    updated:,
    not_updated:,
    errors:,
    total_attempted:,
    cap:,
    cap_reason:,
  }
end