Class: EveryLog::Client
- Inherits:
-
Object
- Object
- EveryLog::Client
- Includes:
- Singleton
- Defined in:
- lib/everylog_ruby_client.rb
Constant Summary collapse
- SETUP_DEFAULTS =
{ api_key: nil, projectId: nil, everylog_url: "https://api.everylog.io/api/v1/log-entries" }.freeze
- NOTIFY_DEFAULTS =
{ title: "Empty notification", summary: "Empty summary", body: "Empty body", tags: [], link: "", push: false }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
26 27 28 |
# File 'lib/everylog_ruby_client.rb', line 26 def end |
Instance Method Details
#notify(notify_options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/everylog_ruby_client.rb', line 46 def notify( = {}) = (, NOTIFY_DEFAULTS) = { projectId: [:projectId] }.merge() uri = URI([:everylog_url]) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', "Authorization": "Bearer #{options[:api_key]}") req.body = .to_json res = http.request(req) res.body end |
#setup(options = {}) ⇒ Object
32 33 34 35 |
# File 'lib/everylog_ruby_client.rb', line 32 def setup( = {}) = (, SETUP_DEFAULTS) self end |