Class: LogPusher::Client
- Inherits:
-
Object
- Object
- LogPusher::Client
- Defined in:
- lib/logpusher.rb
Instance Method Summary collapse
-
#initialize(email, password, api_key) ⇒ Client
constructor
A new instance of Client.
- #push(log_message = "", source = "", category = "", log_type = "", log_time = "", created_date = Time.now, event_id = "") ⇒ Object
Constructor Details
#initialize(email, password, api_key) ⇒ Client
Returns a new instance of Client.
12 13 14 15 |
# File 'lib/logpusher.rb', line 12 def initialize(email, password, api_key) @auth_key = AuthKey.new(Email.new(email), password) @api_key = api_key end |
Instance Method Details
#push(log_message = "", source = "", category = "", log_type = "", log_time = "", created_date = Time.now, event_id = "") ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/logpusher.rb', line 17 def push( = "", source = "", category = "", log_type = "", log_time = "", created_date = Time.now, event_id = "") response = Net::HTTP.post_form URI(API_URL), { "AuthKey" => @auth_key.get_auth_key, "ApiKey" => @api_key, "LogMessage" => , "Source" => source, "Category" => category, "LogType" => log_type, "LogTime" => log_time, "CreatedDate" => created_date.strftime(DATE_FORMAT), "EventId" => event_id } response end |