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: 9d30f1034ddf1ce117031c4938dd22976165f3e14aedbe7dc88b8e4e17101db0
4
- data.tar.gz: 136d87b0dc8ac562d8e77615b8fa25a633ec8413efbfd6e641338ade3c9195df
3
+ metadata.gz: 207926a3de8d806d33a551d162f053f07d5d47fbd9851f548e384dc7d7bc1626
4
+ data.tar.gz: 28d6a9d93d52e1b100aaf343809bc95dc9fff6ba719044ef139651851b606647
5
5
  SHA512:
6
- metadata.gz: 8525c1cbae56ac1b2825fdaae66952557f671eb741837c7c9e2d17fd3c6e97e3e7f24a49a5aaba893a90845e623685f041d79a9a22d7a27c8a58cef2b95375bf
7
- data.tar.gz: 720f689c3538cdc4c0aed15ff8d22b42ba28ca75c4219fef8922ae90cc719abaa473812864f111e19f3eb5c289ed6d9325965e9fc6a91328b6ecf29a514f91d5
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
@@ -6,7 +6,8 @@ class Tramway::Api::V1::UserTokensController < ::Tramway::Api::V1::ApplicationCo
6
6
  render json: {
7
7
  auth_token: token,
8
8
  user: {
9
- email: @entity.email
9
+ email: @entity.email,
10
+ id: @entity.id
10
11
  }
11
12
  }, status: :created
12
13
  else
@@ -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 user_form.model.attributes.merge authentication_token: token
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
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Api
3
- VERSION = '0.5'
3
+ VERSION = '0.6'
4
4
  end
5
5
  end
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.5'
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-01 00:00:00.000000000 Z
11
+ date: 2019-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knock