restaurant 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -26
- data/lib/restaurant.rb +1 -0
- data/lib/restaurant/railtie.rb +12 -0
- data/lib/restaurant/router.rb +9 -2
- data/lib/restaurant/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cc774878cfd70d875198554dc08a0c02699de0c
|
|
4
|
+
data.tar.gz: a9f90a959400a81935d5441a21ddc3770264368a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b11d73e5068aad446ab0ed0b23191236c0729ea848bdf344ff35c9153d1bb463e6e426a7abc9184d94e9e5cd22600fca8adec9300c7a1de91becf809aa0a765
|
|
7
|
+
data.tar.gz: ce710ac1bff61b2d2cb876aaa8ee37d69b0c2de32ee7ba41737d3cc276d6ea8101df18bb14a4ce7e3bbe600bbcf8010e66041a2eeb1d3f0b8f61e58855317603
|
data/README.md
CHANGED
|
@@ -1,55 +1,43 @@
|
|
|
1
1
|
# Restaurant
|
|
2
|
-
Restaurant serves your data via auto-defined RESTful API on your rails application.
|
|
3
|
-
All you have to do is to edit config/routes.rb.
|
|
2
|
+
Restaurant serves your data via auto-defined RESTful API on your rails application.
|
|
4
3
|
|
|
5
|
-
##
|
|
4
|
+
## Usage
|
|
6
5
|
```
|
|
7
|
-
$ rails new example
|
|
8
|
-
$ cd example
|
|
9
|
-
|
|
10
|
-
$ vi Gemfile
|
|
11
|
-
source "https://rubygems.org"
|
|
12
|
-
gem "rails", "~> 3.2.13"
|
|
13
|
-
gem "restaurant"
|
|
14
|
-
gem "sqlite3"
|
|
15
|
-
|
|
16
|
-
$ vi config/routes.rb
|
|
17
|
-
Example::Application.routes.draw do
|
|
18
|
-
namespace :v1 do
|
|
19
|
-
Restaurant::Router.route(self)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
6
|
$ brew install mongodb
|
|
24
7
|
$ mongod --fork
|
|
25
8
|
|
|
9
|
+
$ rails new example
|
|
10
|
+
$ cd example
|
|
11
|
+
|
|
12
|
+
$ echo 'gem "restaurant"' >> Gemfile
|
|
26
13
|
$ bundle install
|
|
14
|
+
|
|
27
15
|
$ rails g mongoid:config
|
|
28
16
|
$ rails c
|
|
29
17
|
|
|
30
18
|
[1] pry(main)> app.accept = "application/json"
|
|
31
19
|
=> "application/json"
|
|
32
|
-
[2] pry(main)> app.post "/
|
|
20
|
+
[2] pry(main)> app.post "/recipes", recipe: { title: "created" }
|
|
33
21
|
=> 201
|
|
34
22
|
[3] pry(main)> JSON.parse(app.response.body)
|
|
35
23
|
=> {"title"=>"created", "_id"=>"51963fe9f02da4c1f8000001"}
|
|
36
|
-
[4] pry(main)> app.get "/
|
|
24
|
+
[4] pry(main)> app.get "/recipes/51963fe9f02da4c1f8000001"
|
|
37
25
|
=> 200
|
|
38
26
|
[5] pry(main)> JSON.parse(app.response.body)
|
|
39
27
|
=> {"title"=>"created", "_id"=>"51963fe9f02da4c1f8000001"}
|
|
40
|
-
[6] pry(main)> app.put "/
|
|
28
|
+
[6] pry(main)> app.put "/recipes/51963fe9f02da4c1f8000001", recipe: { title: "updated" }
|
|
41
29
|
=> 204
|
|
42
|
-
[7] pry(main)> app.get "/
|
|
30
|
+
[7] pry(main)> app.get "/recipes/51963fe9f02da4c1f8000001"
|
|
43
31
|
=> 200
|
|
44
32
|
[8] pry(main)> JSON.parse(app.response.body)
|
|
45
33
|
=> {"title"=>"updated", "_id"=>"51963fe9f02da4c1f8000001"}
|
|
46
|
-
[9] pry(main)> app.get "/
|
|
34
|
+
[9] pry(main)> app.get "/recipes"
|
|
47
35
|
=> 200
|
|
48
36
|
[10] pry(main)> JSON.parse(app.response.body)
|
|
49
37
|
=> [{"title"=>"updated", "_id"=>"51963fe9f02da4c1f8000001"}]
|
|
50
|
-
[11] pry(main)> app.delete "/
|
|
38
|
+
[11] pry(main)> app.delete "/recipes/51963fe9f02da4c1f8000001"
|
|
51
39
|
=> 204
|
|
52
|
-
[12] pry(main)> app.get "/
|
|
40
|
+
[12] pry(main)> app.get "/recipes"
|
|
53
41
|
=> 200
|
|
54
42
|
[13] pry(main)> JSON.parse(app.response.body)
|
|
55
43
|
=> []
|
data/lib/restaurant.rb
CHANGED
data/lib/restaurant/router.rb
CHANGED
data/lib/restaurant/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: restaurant
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
@@ -117,6 +117,7 @@ extensions: []
|
|
|
117
117
|
extra_rdoc_files: []
|
|
118
118
|
files:
|
|
119
119
|
- lib/restaurant/actions.rb
|
|
120
|
+
- lib/restaurant/railtie.rb
|
|
120
121
|
- lib/restaurant/router.rb
|
|
121
122
|
- lib/restaurant/version.rb
|
|
122
123
|
- lib/restaurant.rb
|