Module: BWAPI::Client::Projects::Alerts

Included in:
BWAPI::Client::Projects
Defined in:
lib/bwapi/client/projects/alerts.rb

Overview

Alerts module for alerts endpoints

Instance Method Summary collapse

Instance Method Details

#alerts(project_id) ⇒ Hash

Get a list of alerts

Parameters:

  • project_id (Integer)

    Id of project

Returns:

  • (Hash)

    Alerts in project



10
11
12
# File 'lib/bwapi/client/projects/alerts.rb', line 10

def alerts(project_id)
  get "projects/#{project_id}/alerts"
end

#create_alert(project_id, opts = {}) ⇒ Hash

Create a new alert in project

Parameters:

  • project_id (Integer)

    Id of project

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • alertTypes (String)

    type of alert

  • clientId (Integer)

    The id of the client

  • created (Date)

    Creation date

  • deleted (Boolean)

    Alert deleted check

  • emailCreator (Boolean)

    Does this alert also email the creator

  • enabled (Boolean)

    Alert enabled check

  • externalLink (Boolean)

    External link

  • frequency (Integer)

    Frequence of checks

  • id (Integer)

    The id of Frequence

  • lastResourceId (Long)

    Last checked resource id

  • mentionsPerAlert (Integer)

    Number of mentions

  • name (String)

    Alert name

  • nextRun (Date)

    Date/time of next run

  • queryId (Integer)

    Corresponding query id

  • queryName (String)

    Name of the query this alert relates to

  • repeatOnDayOfWeek (Integer)

    Repeats in a week

  • repeatOnHourOfDay (Integer)

    Repeats in a day

  • searchLiteString (String)

    Filters to be considered

  • threshold (Double)

    Threshold

  • userId (Integer)

    Corresponding user id

Returns:

  • (Hash)

    New alert



48
49
50
# File 'lib/bwapi/client/projects/alerts.rb', line 48

def create_alert(project_id, opts = {})
  post "/projects/#{project_id}/alerts", opts
end

#get_alert(project_id, alert_id) ⇒ Hash

Get a selected alert

Parameters:

  • project_id (Integer)

    Id of project

  • alert_id (Integer)

    Id of alert

Returns:

  • (Hash)

    Alert in project



19
20
21
# File 'lib/bwapi/client/projects/alerts.rb', line 19

def get_alert(project_id, alert_id)
  get "projects/#{project_id}/alerts/#{alert_id}"
end

#update_alert(project_id, opts = {}) ⇒ Hash

Update an existing alert in project

Parameters:

  • project_id (Integer)

    Id of project

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • alertTypes (String)

    type of alert

  • clientId (Integer)

    The id of the client

  • created (Date)

    Creation date

  • deleted (Boolean)

    Alert deleted check

  • emailCreator (Boolean)

    Does this alert also email the creator

  • enabled (Boolean)

    Alert enabled check

  • externalLink (Boolean)

    External link

  • frequency (Integer)

    Frequence of checks

  • id (Integer)

    The id of Frequence

  • lastResourceId (Long)

    Last checked resource id

  • mentionsPerAlert (Integer)

    Number of mentions

  • name (String)

    Alert name

  • nextRun (Date)

    Date/time of next run

  • queryId (Integer)

    Corresponding query id

  • queryName (String)

    Name of the query this alert relates to

  • repeatOnDayOfWeek (Integer)

    Repeats in a week

  • repeatOnHourOfDay (Integer)

    Repeats in a day

  • searchLiteString (String)

    Filters to be considered

  • threshold (Double)

    Threshold

  • userId (Integer)

    Corresponding user id

Returns:

  • (Hash)

    Returns alert as saved



77
78
79
# File 'lib/bwapi/client/projects/alerts.rb', line 77

def update_alert(project_id, opts = {})
  put "/projects/#{project_id}/alerts", opts
end