logentries_pull_api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/logentries_pull_api/client.rb +23 -6
- data/lib/logentries_pull_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d271d72c8d7bd6cf91e6f6332511fb3c7c2c6a9
|
4
|
+
data.tar.gz: 35228d8e1830a4720c05393e6216effad52cbc61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc07d79e92718b901268f5daa106b03c59866e78153492224818b368fa0cbc4c9dc7aa6a36a8422f1a60bb9846d7601e00aba9cb6539d3ba555b0d26cf255bf
|
7
|
+
data.tar.gz: 425c1a3d889a36549aa929748b66ed84d033e7fac052e8e9e37cf8a9d871e262a08e667fb76fbb0c3b66fa866cc4240c4792745790c17e388f8e8ca8eb566775
|
@@ -3,6 +3,7 @@ require 'net/http'
|
|
3
3
|
require 'uri'
|
4
4
|
|
5
5
|
module LogentriesPullApi
|
6
|
+
|
6
7
|
class Client
|
7
8
|
|
8
9
|
attr_reader :account_key, :log_set_key, :log_key
|
@@ -14,21 +15,37 @@ module LogentriesPullApi
|
|
14
15
|
end
|
15
16
|
|
16
17
|
|
17
|
-
def get
|
18
|
+
def get(options = {})
|
19
|
+
response = fetch_response_from assemble_uri(options)
|
20
|
+
|
21
|
+
raise LogentriesPullApi::Error, response['reason'] if response.is_a? Hash
|
22
|
+
|
23
|
+
response
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
LOGENTRIES_API_URL = 'https://pull.logentries.com'
|
29
|
+
|
30
|
+
|
31
|
+
def assemble_uri(options)
|
18
32
|
encoded_log_set_key = URI.encode log_set_key
|
19
33
|
encoded_log_key = URI.encode log_key
|
20
34
|
|
21
35
|
uri = URI.parse "#{LOGENTRIES_API_URL}/#{account_key}/hosts/#{encoded_log_set_key}/#{encoded_log_key}/"
|
22
|
-
uri.query = URI.encode_www_form format: 'json'
|
36
|
+
uri.query = URI.encode_www_form options.merge format: 'json'
|
37
|
+
|
38
|
+
uri
|
39
|
+
end
|
23
40
|
|
41
|
+
|
42
|
+
def fetch_response_from(uri)
|
24
43
|
response = Net::HTTP.get_response uri
|
25
44
|
JSON.parse response.body
|
26
45
|
end
|
27
46
|
|
47
|
+
end
|
28
48
|
|
29
|
-
|
30
|
-
|
31
|
-
LOGENTRIES_API_URL = 'https://pull.logentries.com'
|
49
|
+
class Error < StandardError; end
|
32
50
|
|
33
|
-
end
|
34
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logentries_pull_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balazs Szerencsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|