Module: BulkProcessor::PayloadSerializer

Defined in:
lib/bulk_processor/payload_serializer.rb

Overview

The payload must be serialized to be command line friendly (since Dynosaur runs a rake task with command-line args)

Class Method Summary collapse

Class Method Details

.deserialize(string) ⇒ Hash

Returns the original Hash payload (with all keys and values stringified).

Parameters:

  • payload (String)

    a serialized version of the payload

Returns:

  • (Hash)

    the original Hash payload (with all keys and values stringified)



20
21
22
# File 'lib/bulk_processor/payload_serializer.rb', line 20

def deserialize(string)
  Rack::Utils.parse_nested_query(string)
end

.serialize(payload) ⇒ String

Returns a serialized version of the string that can be passed to any of the back-ends.

Parameters:

  • payload (Hash)

    the client payload to be passed into the processing job and ultimately the handler

Returns:

  • (String)

    a serialized version of the string that can be passed to any of the back-ends



13
14
15
# File 'lib/bulk_processor/payload_serializer.rb', line 13

def serialize(payload)
  URI.encode_www_form(payload)
end