class OkComputer::HubspotCheck
Constants
- STATUS_URL
- StatusFailed
Attributes
api_key[RW]
Public Class Methods
new(url: STATUS_URL, api_key: nil, request_timeout: 5)
click to toggle source
Calls superclass method
# File lib/ok_computer/checks/hubspot_check.rb, line 14 def initialize(url: STATUS_URL, api_key: nil, request_timeout: 5) super(url, request_timeout) self.api_key = api_key.presence end
Public Instance Methods
check()
click to toggle source
Public: Return the status of the Rate-Limit check
# File lib/ok_computer/checks/hubspot_check.rb, line 21 def check status, body = perform_request raise(StatusFailed, body) unless status == 200 mark_message('Rate-Limit check successful') rescue StandardError => e mark_message("Error: '#{e}'") mark_failure end
perform_request()
click to toggle source
# File lib/ok_computer/checks/hubspot_check.rb, line 31 def perform_request response = Faraday.get(url, request: { timeout: request_timeout }) do |req| req.headers['Content-Type'] = 'application/json' req.params['hapikey'] = api_key end [response.status, MultiJson.decode(response.body)] rescue StandardError => e raise(StatusFailed, e) end