Class: InformantRails::Client
- Inherits:
-
Object
- Object
- InformantRails::Client
- Defined in:
- lib/informant-rails/client.rb
Class Method Summary collapse
- .inform(model) ⇒ Object
- .inform_action(controller_name, action) ⇒ Object
- .process ⇒ Object
- .record(env) ⇒ Object
- .request ⇒ Object
Class Method Details
.inform(model) ⇒ Object
18 19 20 |
# File 'lib/informant-rails/client.rb', line 18 def self.inform(model) request.process_model(model) if request && model end |
.inform_action(controller_name, action) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/informant-rails/client.rb', line 11 def self.inform_action(controller_name, action) if request request.filename = controller_name request.action = action end end |
.process ⇒ Object
22 23 24 25 26 27 |
# File 'lib/informant-rails/client.rb', line 22 def self.process if Config.api_token.present? && request && request.models.any? Net::HTTP.post_form(api_url, request.as_json) end remove_request end |
.record(env) ⇒ Object
7 8 9 |
# File 'lib/informant-rails/client.rb', line 7 def self.record(env) new_request.request_url = env['HTTP_REFERER'] end |
.request ⇒ Object
29 30 31 |
# File 'lib/informant-rails/client.rb', line 29 def self.request @requests[request_id] end |