Class: LogentriesPullApi::Client
- Inherits:
-
Object
- Object
- LogentriesPullApi::Client
- Defined in:
- lib/logentries_pull_api/client.rb
Instance Attribute Summary collapse
-
#account_key ⇒ Object
readonly
Returns the value of attribute account_key.
-
#log_key ⇒ Object
readonly
Returns the value of attribute log_key.
-
#log_set_key ⇒ Object
readonly
Returns the value of attribute log_set_key.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(account_key, log_set_key, log_key) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(account_key, log_set_key, log_key) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 |
# File 'lib/logentries_pull_api/client.rb', line 10 def initialize(account_key, log_set_key, log_key) @account_key = account_key @log_set_key = log_set_key @log_key = log_key end |
Instance Attribute Details
#account_key ⇒ Object (readonly)
Returns the value of attribute account_key.
8 9 10 |
# File 'lib/logentries_pull_api/client.rb', line 8 def account_key @account_key end |
#log_key ⇒ Object (readonly)
Returns the value of attribute log_key.
8 9 10 |
# File 'lib/logentries_pull_api/client.rb', line 8 def log_key @log_key end |
#log_set_key ⇒ Object (readonly)
Returns the value of attribute log_set_key.
8 9 10 |
# File 'lib/logentries_pull_api/client.rb', line 8 def log_set_key @log_set_key end |
Instance Method Details
#get ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/logentries_pull_api/client.rb', line 17 def get encoded_log_set_key = URI.encode log_set_key encoded_log_key = URI.encode log_key uri = URI.parse "#{LOGENTRIES_API_URL}/#{account_key}/hosts/#{encoded_log_set_key}/#{encoded_log_key}/" uri.query = URI.encode_www_form format: 'json' response = Net::HTTP.get_response uri JSON.parse response.body end |