class InformantCommon::Event::Base

Public Class Methods

authorization_header_value() click to toggle source
# File lib/informant-common/event/base.rb, line 12
def self.authorization_header_value
  @authorization_header_value ||= "Token token=\"#{InformantCommon::Config.api_token}\""
end
endpoint() click to toggle source
# File lib/informant-common/event/base.rb, line 4
def self.endpoint
  raise 'Must implement'
end
net_http_start_arguments() click to toggle source
# File lib/informant-common/event/base.rb, line 26
def self.net_http_start_arguments
  @net_http_start_arguments ||= [endpoint.host, endpoint.port, use_ssl: endpoint.scheme == 'https']
end

Public Instance Methods

authorization_header_value() click to toggle source
# File lib/informant-common/event/base.rb, line 16
def authorization_header_value
  self.class.authorization_header_value
end
endpoint() click to toggle source
# File lib/informant-common/event/base.rb, line 8
def endpoint
  self.class.endpoint
end
net_http_start_arguments() click to toggle source
# File lib/informant-common/event/base.rb, line 30
def net_http_start_arguments
  self.class.net_http_start_arguments
end
post_request() click to toggle source
# File lib/informant-common/event/base.rb, line 20
def post_request
  Net::HTTP::Post.new(endpoint,
                      'Authorization' => authorization_header_value,
                      'Content-Type' => 'application/json').tap { |r| r.body = to_json }
end