Browse files

wrote README, changed get_params to return hash directly

  • Loading branch information...
1 parent 1cd4f7d commit 8c266a6733e27036e4fb9748fa71e8a4a8d4e116 @gamache gamache committed Sep 13, 2010
Showing with 30 additions and 2 deletions.
  1. +27 −0 README
  2. +3 −2 lib/clicky-api.rb
@@ -1,5 +1,32 @@
Clicky-api is a Ruby Gem which interfaces with version 4 of the Clicky web
analytics API, documented at
+ Sets the given parameters persistently, in a class variable (so the
+ settings are applied globally). Setting the Clicky site_id and sitekey
+ here is a good idea.
+ Returns the current hash of persistent params set by #set_params!.
+ This hash may be manipulated directly, e.g. to delete keys; if you
+ need to alter it without affecting ClickyAPI everywhere, make a copy.
+ Loads the given YAML config file and passes its keys and values to
+ #set_params!. If no file is specified and you're using Rails,
+ #load_config_file! will use the contents of "config/clicky-api.yml".
+ Queries the Clicky server with the given params, merging them with
+ any parameters set with #set_params!. Returns a Ruby hash representation
+ of the response.
This gem was written by Pete Gamache with the gracious support of Where, Inc.
@@ -47,9 +47,10 @@ def self.set_params!(param_hash={})
## get_params returns the hash of params set by #set_params!
- ## using Hash#merge to prevent shared structure
+ ## it returns the hash directly, so make a copy if you want to avoid
+ ## affecting other nearby ClickyAPI calls.
def self.get_params
- {}.merge(@@set_params||{})
+ @@set_params
## the 'stats' method is used to obtain results. I wanted to call it

0 comments on commit 8c266a6

Please sign in to comment.