auto_api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39b05ca8941181e3462bdb72162c5b9237ae711e
4
- data.tar.gz: e32ccf3e35eca0db32cb0ea943369e93a442b6cb
3
+ metadata.gz: 3232aba5325efd6996be75677997684bfda69f7d
4
+ data.tar.gz: d14cc7a7e03eb926420b5359d840d1c1bf141247
5
5
  SHA512:
6
- metadata.gz: b7b6a3a94eeda305243bb625d1062061d2cb6c5bd8e85c1b800447995324be36f7aeda250e46a52da52d45bf61527be571c6a6071dcc9c6269c4edaed00adabb
7
- data.tar.gz: 8e3e7fa12d2a65b3016ef8d7a8965594e2a5ead1f88f7bac83e8a0b071154d633c599f556fbef07ea2fded3b60da4da588feba4201dc9e49ba5ad5cd74f7712d
6
+ metadata.gz: 933b8e6ab97db695caa5a7eb83eaf3a67e5bb744a226f463e40eff2deb1eed7fc5503524fd127f66e0e8c41be6bdab3689450df5f86c38f9a186f05eb5e8920b
7
+ data.tar.gz: 87be169960c27295c95f504cf48cd130d509fae61b092a11de818843b58191b29df9270e36dcdc21ee84d41d465e1c107f5e7eec7cc21350d740392552f21e5d
@@ -4,8 +4,12 @@ require "sinatra/json"
4
4
  require 'mongoid'
5
5
  require 'active_support/inflector'
6
6
  require 'active_model'
7
+ require 'logger'
8
+
9
+
7
10
 
8
11
  class AutoApi::Base < Sinatra::Base
12
+ logger = Logger.new(STDOUT)
9
13
  configure :development do
10
14
  register Sinatra::Reloader
11
15
  end
@@ -42,8 +46,10 @@ class AutoApi::Base < Sinatra::Base
42
46
  end
43
47
 
44
48
  post '/:resource/?' do | resource |
49
+ logger.debug(request.body.read)
50
+ request.body.rewind
45
51
  webtry(lambda {
46
- resource = @resource.new(request.POST)
52
+ resource = @resource.new(JSON.parse request.body.read)
47
53
  resource.save!
48
54
  json resource
49
55
  })
@@ -52,7 +58,7 @@ class AutoApi::Base < Sinatra::Base
52
58
  put '/:resource/:id/?' do | resource, id |
53
59
  webtry(lambda {
54
60
  resource = @resource.find(id)
55
- resource.update_attributes!(request.POST)
61
+ resource.update_attributes!(JSON.parse request.body.read)
56
62
  })
57
63
  end
58
64
 
@@ -72,7 +78,7 @@ class AutoApi::Base < Sinatra::Base
72
78
  post '/:resource1/:id1/:resource2/?' do | resource1, id1, resource2 |
73
79
  webtry(lambda {
74
80
  parent_resource = @resource1.find(id1)
75
- child_resource = @resource2.new(request.POST)
81
+ child_resource = @resource2.new(request.body.read)
76
82
  child_resource.save!
77
83
  parent_resource.send(resource2) << child_resource
78
84
  json child_resource
@@ -94,4 +100,3 @@ class AutoApi::Base < Sinatra::Base
94
100
  end
95
101
  end
96
102
  end
97
-
@@ -1,3 +1,3 @@
1
1
  module AutoApi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phillip R. Spitler (Phil)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-08 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.4.2
157
+ rubygems_version: 2.2.2
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Automattic API Generator