Class: StatTrackr::Reporter
- Inherits:
-
Object
- Object
- StatTrackr::Reporter
- Defined in:
- lib/stat_trackr.rb
Instance Method Summary collapse
-
#initialize(metric_id) ⇒ Reporter
constructor
A new instance of Reporter.
- #ping(date, value) ⇒ Object
Constructor Details
#initialize(metric_id) ⇒ Reporter
Returns a new instance of Reporter.
33 34 35 |
# File 'lib/stat_trackr.rb', line 33 def initialize(metric_id) @metric_id = metric_id end |
Instance Method Details
#ping(date, value) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/stat_trackr.rb', line 37 def ping(date, value) raise Error if StatTrackr.config.url.nil? data = { "event_date" => date, "event_value" => value, "metric_id" => @metric_id, } response = HTTPX.post(StatTrackr.config.url, json: data, ssl: {verify_mode: OpenSSL::SSL::VERIFY_NONE}) response.status == 200 end |