class InvestigatorService
Public Class Methods
new()
click to toggle source
# File lib/service.rb, line 6 def initialize @api_key = ENV.fetch("ACTIVITY_API_KEY", nil) @api_url = ENV.fetch("ACTIVITY_API_URL", nil) unless @api_key && @api_url raise "ACTIVITY_API_KEY and ACTIVITY_API_URL are required." end @conn = Faraday.new(url: @api_url) end
Public Instance Methods
post(data)
click to toggle source
# File lib/service.rb, line 17 def post(data) message = { api_key: @api_key, data: data } @conn.post do |req| req.headers['Content-Type'] = 'application/json' req.body = message.to_json end end