logworm_client 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.6.1
2
+ Added a bit of documentation
3
+
1
4
  v0.6.0
2
5
  Add support for querying API: lw_query
3
6
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('logworm_client', '0.6.0') do |p|
2
+ Echoe.new('logworm_client', '0.6.1') do |p|
3
3
  p.description = "logworm client utilities"
4
4
  p.url = "http://www.logworm.com"
5
5
  p.author = "Pomelo, LLC"
@@ -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.from_config # Establish connection to 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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logworm_client}
5
- s.version = "0.6.0"
5
+ s.version = "0.6.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pomelo, LLC"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pomelo, LLC