class Courier::Events

Constants

KEY

Public Class Methods

new(session) click to toggle source
# File lib/trycourier/events.rb, line 5
def initialize(session)
  @session = session
end

Public Instance Methods

add(event_id:, id:, type: "notification") click to toggle source
# File lib/trycourier/events.rb, line 20
def add(event_id:, id:, type: "notification")
  replace(event_id: event_id, id: id, type: type)
end
get(event_id:) click to toggle source
# File lib/trycourier/events.rb, line 14
def get(event_id:)
  path = "#{KEY}/#{event_id}"
  res = @session.send(path, "GET")
  ErrorHandler.check_err(res)
end
list() click to toggle source
# File lib/trycourier/events.rb, line 9
def list
  res = @session.send(KEY, "GET")
  ErrorHandler.check_err(res)
end
replace(event_id:, id:, type: "notification") click to toggle source
# File lib/trycourier/events.rb, line 24
def replace(event_id:, id:, type: "notification")
  path = "#{KEY}/#{event_id}"

  payload = {
    "id" => id,
    "type" => type
  }
  res = @session.send(path, "PUT", body: payload)
  ErrorHandler.check_err_non_json(res)
end