Class: Esse::Import::RequestBody

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

Direct Known Subclasses

RequestBodyAsJson, RequestBodyRaw

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body:) ⇒ RequestBody

Returns a new instance of RequestBody.



6
7
8
9
# File 'lib/esse/import/request_body.rb', line 6

def initialize(body:)
  @body = body # body may be String or Array<Hash>
  @stats = { index: 0, create: 0, delete: 0, update: 0 }
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/esse/import/request_body.rb', line 4

def body
  @body
end

#statsObject (readonly)

Returns the value of attribute stats.



4
5
6
# File 'lib/esse/import/request_body.rb', line 4

def stats
  @stats
end

Instance Method Details

#body?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/esse/import/request_body.rb', line 11

def body?
  !body.empty?
end