Class: Webhookdb::ServiceIntegration::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/service_integration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, data) ⇒ Stats

Returns a new instance of Stats.



162
163
164
165
# File 'lib/webhookdb/service_integration.rb', line 162

def initialize(message, data)
  @message = message
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



160
161
162
# File 'lib/webhookdb/service_integration.rb', line 160

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message.



160
161
162
# File 'lib/webhookdb/service_integration.rb', line 160

def message
  @message
end

Instance Method Details

#as_json(*_o) ⇒ Object



179
180
181
# File 'lib/webhookdb/service_integration.rb', line 179

def as_json(*_o)
  return @data.merge(message: @message, display_headers: self.display_headers)
end

#display_headersObject



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/webhookdb/service_integration.rb', line 167

def display_headers
  return [
    [:count_last_7_days_formatted, "Count Last 7 Days"],
    [:success_last_7_days_formatted, "Successful Last 7 Days"],
    [:success_last_7_days_percent_formatted, "Successful Last 7 Days %"],
    [:rejected_last_7_days_formatted, "Rejected Last 7 Days"],
    [:rejected_last_7_days_percent_formatted, "Rejected Last 7 Days %"],
    [:successful_of_last_10_formatted, "Successful Of Last 10 Webhooks"],
    [:rejected_of_last_10_formatted, "Rejected Of Last 10 Webhooks"],
  ]
end