Class: Esse::Import::RequestBodyRaw

Inherits:
RequestBody show all
Defined in:
lib/esse/import/request_body.rb

Instance Attribute Summary

Attributes inherited from RequestBody

#body, #stats

Instance Method Summary collapse

Methods inherited from RequestBody

#body?

Constructor Details

#initializeRequestBodyRaw

Returns a new instance of RequestBodyRaw.



17
18
19
# File 'lib/esse/import/request_body.rb', line 17

def initialize
  super(body: '')
end

Instance Method Details

#add(operation, payload) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/esse/import/request_body.rb', line 25

def add(operation, payload)
  stats[operation] += 1
  if @body.empty?
    @body = payload
  else
    @body << "\n" << payload
  end
end

#bytesizeObject



21
22
23
# File 'lib/esse/import/request_body.rb', line 21

def bytesize
  body.bytesize
end

#finalizeObject



34
35
36
# File 'lib/esse/import/request_body.rb', line 34

def finalize
  @body << "\n"
end