Skip to content

Commit

Permalink
ruby code blocks for Github MD
Browse files Browse the repository at this point in the history
  • Loading branch information
markburns committed Apr 30, 2012
1 parent 5cafec7 commit d306344
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Examples

Client example

```ruby
params = {:some => 'parameters'}
token = Signature::Token.new('my_key', 'my_secret')
request = Signature::Request.new('POST', '/api/thing', params)
Expand All @@ -17,9 +18,11 @@ Client example
HTTParty.post('http://myservice/api/thing', {
:query => query_params
})
```

`query_params` looks like:

```ruby
{
:some => "parameters",
:auth_timestamp => 1273231888,
Expand All @@ -28,8 +31,10 @@ Client example
:auth_key => "my_key"
}

```
Server example (sinatra)

```ruby
error Signature::AuthenticationError do |controller|
error = controller.env["sinatra.error"]
halt 401, "401 UNAUTHORIZED: #{error.message}\n"
Expand All @@ -44,6 +49,7 @@ Server example (sinatra)

# Do whatever you need to do
end
```

Pre-requisites
------------
Expand Down

0 comments on commit d306344

Please sign in to comment.