Method: Orchestrate::Client#post_event

Defined in:
lib/orchestrate/client.rb

#post_event(collection, key, event_type, body, timestamp = nil) ⇒ Object

Parameters:

  • collection (#to_s)

    The name of the collection.

  • key (#to_s)

    The name of the key.

  • event_type (#to_s)

    The category for the event.

  • body (#to_json)

    The value for the event.

  • timestamp (Time, Date, Integer, String, nil) (defaults to: nil)

    The timestamp for the event. If omitted, the timestamp is created by Orchestrate. If a String, must match the Timestamp specification.

Returns:

  • Orchestrate::API::ItemResponse

Raises:

  • Orchestrate::API::BadRequest If the body is not valid JSON.

[View source]

283
284
285
286
287
# File 'lib/orchestrate/client.rb', line 283

def post_event(collection, key, event_type, body, timestamp=nil)
  timestamp = API::Helpers.timestamp(timestamp)
  path = [collection, key, 'events', event_type, timestamp].compact
  send_request :post, path, { body: body, response: API::ItemResponse }
end