Class: LogentriesPullApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/logentries_pull_api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(, log_set_key, log_key)
  @account_key = 
  @log_set_key = log_set_key
  @log_key = log_key
end

Instance Attribute Details

#account_keyObject (readonly)

Returns the value of attribute account_key.



8
9
10
# File 'lib/logentries_pull_api/client.rb', line 8

def 
  @account_key
end

#log_keyObject (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_keyObject (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

#getObject



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}/#{}/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