logworm 0.7.2 → 0.7.3
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.
- data/CHANGELOG +1 -1
- data/Rakefile +1 -1
- data/lib/base/db.rb +7 -8
- data/logworm.gemspec +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/base/db.rb
CHANGED
@@ -16,14 +16,10 @@ module Logworm
|
|
16
16
|
match = DB.parse_url(url)
|
17
17
|
raise ForbiddenAccessException.new("Incorrect URL Format #{url}") unless match and match.size == 6
|
18
18
|
|
19
|
-
|
20
|
-
raise ForbiddenAccessException.new("Incorrect Keys") unless keys.is_a? Array and keys.size == 4
|
21
|
-
@consumer_key, @consumer_secret, @token, @token_secret = keys
|
19
|
+
@consumer_key, @consumer_secret, @host, @token, @token_secret = match[1..5]
|
22
20
|
raise ForbiddenAccessException.new("Missing consumer keys") if @consumer_key.nil? or @consumer_secret.nil?
|
23
21
|
raise ForbiddenAccessException.new("Missing tokens") if @token.nil? or @token_secret.nil?
|
24
22
|
@connection = OAuth::AccessToken.new(OAuth::Consumer.new(@consumer_key, @consumer_secret), @token, @token_secret)
|
25
|
-
|
26
|
-
@host = "http://" + match[5]
|
27
23
|
end
|
28
24
|
|
29
25
|
def self.with_tokens(token, token_secret)
|
@@ -67,11 +63,11 @@ module Logworm
|
|
67
63
|
end
|
68
64
|
|
69
65
|
def tables()
|
70
|
-
res = db_call(:get, "#{
|
66
|
+
res = db_call(:get, "#{host_with_protocol}/")
|
71
67
|
end
|
72
68
|
|
73
69
|
def query(table, cond)
|
74
|
-
res = db_call(:post, "#{
|
70
|
+
res = db_call(:post, "#{host_with_protocol}/queries", {:table => table, :query => cond})
|
75
71
|
end
|
76
72
|
|
77
73
|
def results(uri)
|
@@ -82,7 +78,7 @@ module Logworm
|
|
82
78
|
end
|
83
79
|
|
84
80
|
def batch_log(entries)
|
85
|
-
db_call(:post, "#{
|
81
|
+
db_call(:post, "#{host_with_protocol}/log", {:entries => $lr_queue.to_json})
|
86
82
|
end
|
87
83
|
|
88
84
|
private
|
@@ -107,6 +103,9 @@ module Logworm
|
|
107
103
|
url.match(URL_FORMAT)
|
108
104
|
end
|
109
105
|
|
106
|
+
def host_with_protocol
|
107
|
+
"http://#{@host}"
|
108
|
+
end
|
110
109
|
end
|
111
110
|
|
112
111
|
end
|
data/logworm.gemspec
CHANGED