Skip to content

Commit 4d8a594

Browse files
committed
More doc changes, spellcheck.
1 parent 83461a1 commit 4d8a594

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

README.markdown

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,25 @@ class Twitter::API < Grape::API
6969
end
7070

7171
resource :account do
72-
before{ authenticate! }
72+
before { authenticate! }
7373

7474
get '/private' do
7575
"Congratulations, you found the secret!"
7676
end
7777
end
78+
7879
end
7980
```
8081

8182
## Mounting
8283

83-
The above sample creates a Rack application that can be run from a rackup *config.ru* file:
84+
The above sample creates a Rack application that can be run from a rackup *config.ru* file
85+
with `rackup`:
8486

8587
```ruby
8688
run Twitter::API
8789
```
90+
8891
And would respond to the following routes:
8992

9093
GET /statuses/public_timeline(.json)
@@ -97,7 +100,7 @@ In a Rails application, modify *config/routes*:
97100
```ruby
98101
mount Twitter::API => "/"
99102
```
100-
You can mount multiple API implementations inside a single one.
103+
You can mount multiple API implementations inside another one.
101104

102105
```ruby
103106
class Twitter::API < Grape::API
@@ -132,7 +135,7 @@ Serialization takes place automatically.
132135

133136
## Parameters
134137

135-
Parameters are available through the `params` hash object. This include `GET` and `POST` parameters,
138+
Parameters are available through the `params` hash object. This includes `GET` and `POST` parameters,
136139
along with any named parameters you specify in your route strings.
137140

138141
```ruby
@@ -247,14 +250,18 @@ class Twitter::API < Grape::API
247250
end
248251
```
249252

250-
class Twitter::API < Grape::API
251-
rescue_from ArgumentError do |e|
252-
Rack::Response.new([ "ArgumentError: #{e.message}" ], 500)
253-
end
254-
rescue_from NotImplementedError do |e|
255-
Rack::Response.new([ "NotImplementedError: #{e.message}" ], 500)
256-
end
257-
end
253+
Or rescue specific exceptions.
254+
255+
```ruby
256+
class Twitter::API < Grape::API
257+
rescue_from ArgumentError do |e|
258+
Rack::Response.new([ "ArgumentError: #{e.message}" ], 500)
259+
end
260+
rescue_from NotImplementedError do |e|
261+
Rack::Response.new([ "NotImplementedError: #{e.message}" ], 500)
262+
end
263+
end
264+
```
258265

259266
## Content-Types
260267

@@ -296,6 +303,13 @@ describe Twitter::API do
296303
JSON.parse(response.body).should == []
297304
end
298305
end
306+
describe "GET /api/v1/statuses/:id" do
307+
it "returns a status by id" do
308+
status = Status.create!
309+
get "/api/v1/statuses/#{status.id}"
310+
resonse.body.should == status.to_json
311+
end
312+
end
299313
end
300314
```
301315

0 commit comments

Comments
 (0)