Skip to content

Commit

Permalink
Added syntax highlighting to README.textile
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrowning committed Dec 1, 2011
1 parent 4180e75 commit d7e75d4
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions README.textile
Expand Up @@ -6,28 +6,23 @@ h2. Usage

To get started, instantiate a client by passing in your Glitch API key.

<pre>
<code>
<pre lang="ruby">
snafu = Snafu.new("the-api-key")
</code>
</pre>

Currently, only the locations.* methods are supported and each returns a Ruby object representing its data.

<pre>
<code>
<pre lang="ruby">
hubs = snafu.get_hubs # "locations.getHubs"
hub = snafu.get_hub(hub_id) # "locations.getStreets"
street = snafu.get_street(street_tsid) # "locations.streetInfo"
</code>
</pre>

The rest of the API will be supported in due time.

You can also receive raw data from the Glitch API by passing in any method as a string and supplying required parameters via an options hash. This returns a Hash representation of the JSON returned by Glitch:

<pre>
<code>
<pre lang="ruby">
snafu.call("calendar.getHolidays")
# => {
# => "ok"=>1,
Expand All @@ -44,6 +39,7 @@ You can also receive raw data from the Glitch API by passing in any method as a
# => {"month"=>8, "day"=>37, "name"=>"Zilloween"},
# => {"month"=>11, "day"=>11, "name"=>"Recurse Eve"}]
# => }

snafu.call("locations.getStreets", :hub_id => 27)
# => {
# => "ok"=>1,
Expand All @@ -60,6 +56,5 @@ You can also receive raw data from the Glitch API by passing in any method as a
# => "LM413RQ6LRG9N"=>{"name"=>"West Spice"}
# => }
# => }
</code>
</pre>

0 comments on commit d7e75d4

Please sign in to comment.