Class: InformantCommon::Event::Base
- Inherits:
-
Object
- Object
- InformantCommon::Event::Base
show all
- Defined in:
- lib/informant-common/event/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
12
13
14
|
# File 'lib/informant-common/event/base.rb', line 12
def self.
@authorization_header_value ||= "Token token=\"#{InformantCommon::Config.api_token}\""
end
|
.endpoint ⇒ Object
4
5
6
|
# File 'lib/informant-common/event/base.rb', line 4
def self.endpoint
raise 'Must implement'
end
|
.net_http_start_arguments ⇒ Object
26
27
28
|
# 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
|
Instance Method Details
16
17
18
|
# File 'lib/informant-common/event/base.rb', line 16
def
self.class.
end
|
#endpoint ⇒ Object
8
9
10
|
# File 'lib/informant-common/event/base.rb', line 8
def endpoint
self.class.endpoint
end
|
#net_http_start_arguments ⇒ Object
30
31
32
|
# File 'lib/informant-common/event/base.rb', line 30
def net_http_start_arguments
self.class.net_http_start_arguments
end
|
#post_request ⇒ Object
20
21
22
23
24
|
# File 'lib/informant-common/event/base.rb', line 20
def post_request
Net::HTTP::Post.new(endpoint,
'Authorization' => ,
'Content-Type' => 'application/json').tap { |r| r.body = to_json }
end
|