tramway-api 0.5 → 0.6
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 207926a3de8d806d33a551d162f053f07d5d47fbd9851f548e384dc7d7bc1626
|
4
|
+
data.tar.gz: 28d6a9d93d52e1b100aaf343809bc95dc9fff6ba719044ef139651851b606647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488a9dca067992339d48e0f5a18b1e8c84cd4eeaed0ff7608781bfd99d276b92c21b176fad4b770972cb5fa0b30f84b3dae7c3adf087f6a56f3443a7e668d188
|
7
|
+
data.tar.gz: 1f0a03ad8ad975ad2940bcbe33ea79c83e6e747b288dd413d4632ea6f55a0bc17b3394d924d21065a598a9cfc5aad00b630fe5a08868746c7101a3c8eb7df50f
|
@@ -19,6 +19,17 @@ module Tramway::Api::V1
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def update
|
23
|
+
record_form = form_class.new model_class.find params[:id]
|
24
|
+
if record_form.submit params[:data][:attributes]
|
25
|
+
render json: record_form.model,
|
26
|
+
serializer: serializer_class,
|
27
|
+
status: :ok
|
28
|
+
else
|
29
|
+
render_errors_for record_form
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
22
33
|
private
|
23
34
|
|
24
35
|
def model_class
|
@@ -8,7 +8,12 @@ class Tramway::Api::V1::UsersController < ::Tramway::Api::V1::ApplicationControl
|
|
8
8
|
user_form = form_class_name(Tramway::Api.user_based_model).new Tramway::Api.user_based_model.new
|
9
9
|
if user_form.submit params[Tramway::Api.user_based_model.name.underscore]
|
10
10
|
token = ::Knock::AuthToken.new(payload: { sub: user_form.model.id }).token
|
11
|
-
serialized_user = OpenStruct.new
|
11
|
+
serialized_user = OpenStruct.new(
|
12
|
+
user_form.model.attributes.merge(
|
13
|
+
authentication_token: token,
|
14
|
+
id: user_form.model.id
|
15
|
+
)
|
16
|
+
)
|
12
17
|
render json: serialized_user, status: :created
|
13
18
|
else
|
14
19
|
render_errors_for user_form
|
data/lib/tramway/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: knock
|