class OTX::Pulses

Retrieve and parse into the appropriate object a pulse from the OTX System

Public Instance Methods

create(params) click to toggle source

Create a Pulse

@param params [Hash] Parameters to create a Pulse

# File lib/otx_ruby/pulses.rb, line 11
def create(params)
  uri = '/api/v1/pulses/create'

  pulse = { body: params }

  post(uri, pulse)
end
edit(id, params) click to toggle source

Edit a Pulses information

@param id [String] The ID of the Pulse @param param [Hash] Parameters to edit

# File lib/otx_ruby/pulses.rb, line 82
def edit(id, params)
  uri = "/api/v1/pulses/#{id}"

  patch(uri, params)
end
get_indicator_types() click to toggle source

GET list of Pulse Indicator Types

@return [Array<OTX::Indicator::IndicatorType>]

# File lib/otx_ruby/pulses.rb, line 159
def get_indicator_types
  uri = '/api/v1/pulses/indicators/types'
  types = []

  json_data = get(uri)

  json_data['detail'].each do |type|
    types << OTX::Indicator::IndicatorType.new(type)
  end

  return types
end
get_indicators(id, limit = 10, page = 1) click to toggle source

GET a Pulses Indicators

@param id [String] ID of the Pulse to retrieve Indicators from @param limit [Integer] Limit results per page to this number @param page [Integer] Return results for this page @return [Array<OTX::Pulse>] Parsed Indicators

# File lib/otx_ruby/pulses.rb, line 140
def get_indicators(id, limit = 10, page = 1)
  uri = "/api/v1/pulses/#{id}/indicators"
  params = { limit: limit, page: page }
  results = []

  json_data = get(uri, params)

  json_data['results'].each do |indicator|
    results << OTX::Indicators.new(indicator)
  end

  return results
end
get_pulse(id) click to toggle source

Download an individually identified pulse and parse the output

@param id [String] The id value for the pulse to Download @return [OTX::Pulse] Parsed Pulse

# File lib/otx_ruby/pulses.rb, line 36
def get_pulse(id)
    uri = "/api/v1/pulses/#{id}"

    json_data = get(uri)

    pulse = OTX::Pulse.new(json_data)

    return pulse
end
get_user_pulses(username, limit = 10, page = 1) click to toggle source

GET Pulses from a user

@param username [String] Name of the User to retrieve pulses from @param limit [Integer] Limit results per page to this number @param page [Integer] Return results for this page @return [Array<OTX::Pulse>] Parsed Pulses

# File lib/otx_ruby/pulses.rb, line 96
def get_user_pulses(username, limit = 10, page = 1)
  uri = "/api/v1/pulses/user/#{username}"
  params = { limit: limit, page: page }
  results = []

  json_data = get(uri, params)

  json_data['results'].each do |pulse|
    results << OTX::Pulse.new(pulse)
  end

  return results
end
validate_indicator(indicator) click to toggle source

Validate a Pulse indicator

@param indicator [Hash] An indicator key value pair

# File lib/otx_ruby/pulses.rb, line 24
def validate_indicator(indicator)
  uri = '/api/v1/pulses/indicators/validate'

  post(uri, indicator)
end