logworm_client 0.6.0 → 0.6.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.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/logworm_client.rb +16 -1
- data/logworm_client.gemspec +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/logworm_client.rb
CHANGED
@@ -11,6 +11,20 @@ end
|
|
11
11
|
###
|
12
12
|
# Perform a query against the logworm server
|
13
13
|
#
|
14
|
+
# Requires a log table, and a query
|
15
|
+
# The query can be provided as a JSON string, following the syntax described in http://www.logworm.com/docs/query
|
16
|
+
# or as a Hash of options, with the following keys (all optional)
|
17
|
+
# :fields => String with a comma-separated list of fields (quoted or not), or Array of Strings
|
18
|
+
# :aggregate_function => String
|
19
|
+
# :aggregate_argument => String
|
20
|
+
# :aggregate_group => String with a comma-separated list of fields (quoted or not), or Array of Strings
|
21
|
+
# :conditions => String with comma-separated conditions (in MongoDB syntax), or Array of Strings
|
22
|
+
# :start => String or Integer (for year)
|
23
|
+
# :end => String or Integer (for year)
|
24
|
+
# :limit => String or Integer
|
25
|
+
#
|
26
|
+
# See Logworm::QueryBuilder
|
27
|
+
#
|
14
28
|
# Returns Hash with
|
15
29
|
# id ==> id of the query
|
16
30
|
# query_url ==> URL to GET information about the query
|
@@ -21,9 +35,10 @@ end
|
|
21
35
|
# results ==> array of hashmaps. Each element corresponds to a log entry, with its fields
|
22
36
|
#
|
23
37
|
# raises Logworm::DatabaseException, Logworm::ForbiddenAccessException, Logworm::InvalidQueryException
|
38
|
+
# or just a regular Exception if it cannot find the URL to the logging database
|
24
39
|
###
|
25
40
|
def lw_query(table, query)
|
26
|
-
db = Logworm::DB.
|
41
|
+
db = Logworm::DB.from_config_or_die # Establish connection to DB
|
27
42
|
query = Logworm::QueryBuilder.new(query).to_json if query.is_a? Hash # Turn query into proper JSON string
|
28
43
|
query_data = db.query(table, query) # POST to create query
|
29
44
|
db.results(query_data["results_uri"]) # GET from query's results uri
|
data/logworm_client.gemspec
CHANGED