Module: Stellate

Defined in:
lib/stellate.rb

Defined Under Namespace

Modules: MetricsLogging Classes: SchemaSyncing

Constant Summary collapse

VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.run_stellate_request(stellate_request) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/stellate.rb', line 159

def self.run_stellate_request(stellate_request)
  url = URI.parse(stellate_request['url'])

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  req = Net::HTTP::Post.new(url)
  stellate_request['headers'].each do |key, value|
    req[key] = value
  end
  req.body = stellate_request['body']
  res = http.request(req)
  puts "HTTP request to Stellate failed: #{res.body}" if res.code.to_i >= 300
rescue StandardError => e
  puts "HTTP request to Stellate failed: #{e}"
end