ctws 0.1.10.alpha → 0.1.11.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -3
- data/app/controllers/ctws/min_app_versions_controller.rb +4 -2
- data/app/controllers/ctws/users_controller.rb +2 -31
- data/config/initializers/ctws.rb +0 -2
- data/lib/ctws/version.rb +1 -1
- data/lib/ctws.rb +0 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad946770043983270e71fbec6cb469fa8e295f5e
|
4
|
+
data.tar.gz: 442d2a1bf4e04fe406569151148943833c337655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ebbc73710ab85587738855253604f0ed5b176b52f21df80ef078d2d7d9b79678d5a4b68d1cbf4ad10e0e71ede77091495ea17a3ec79b68643ec85b1fee5739
|
7
|
+
data.tar.gz: 432cf50c15ab1fb6059d8b7558c34e0ad827ed081199355fae986bd187ee6029460fa8c6f047500ca2b32d3fdaa86afcd69519b9243d37fbaa132b28aa830d59
|
data/README.md
CHANGED
@@ -56,9 +56,6 @@ By default the user model is `User` but you can change it by creating or editing
|
|
56
56
|
|
57
57
|
```ruby
|
58
58
|
Ctws.user_class = "Account"
|
59
|
-
|
60
|
-
Ctws.device_class = "DeviceApp" # TODO: documentation
|
61
|
-
Ctws.profile_class = "Profile" # TODO: documentation
|
62
59
|
```
|
63
60
|
|
64
61
|
The application `User` model **must have the `email` attribute**.
|
@@ -6,8 +6,10 @@ module Ctws
|
|
6
6
|
# GET /min_app_version
|
7
7
|
def min_app_version
|
8
8
|
min_app_versions = []
|
9
|
-
MinAppVersion.
|
10
|
-
|
9
|
+
MinAppVersion.all.order(updated_at: :desc).group_by(&:platform).each do |platforms|
|
10
|
+
platforms[1].each_with_index do |platform, index|
|
11
|
+
min_app_versions << {platforms[0] => platform.as_jsonapi} if index == 0
|
12
|
+
end
|
11
13
|
end
|
12
14
|
json_response min_app_versions
|
13
15
|
end
|
@@ -13,43 +13,14 @@ module Ctws
|
|
13
13
|
elsif !Ctws.user_validate_with_password
|
14
14
|
auth_token = Ctws::AuthenticateUser.new(ctws_user.email).call
|
15
15
|
end
|
16
|
-
# response = { message: Ctws::Message.account_created, auth_token: auth_token }
|
17
16
|
|
18
|
-
json_response(
|
17
|
+
json_response(ctws_user.created_as_jsonapi({"#{ctws_user.model_name.singular}": ctws_user, token: auth_token}), :created)
|
19
18
|
end
|
20
19
|
|
21
20
|
private
|
22
21
|
|
23
|
-
def user_as_jsonapi user, auth_token
|
24
|
-
[{
|
25
|
-
type: ActiveModel::Naming.param_key(Ctws.user_class),
|
26
|
-
id: user.id,
|
27
|
-
attributes: {
|
28
|
-
message: Ctws::Message.account_created,
|
29
|
-
auth_token: auth_token,
|
30
|
-
created_at: user.created_at
|
31
|
-
},
|
32
|
-
relationships: {
|
33
|
-
device_apps: {
|
34
|
-
data: [{
|
35
|
-
type: ActiveModel::Naming.param_key(Ctws.device_class),
|
36
|
-
id: Ctws.device_class.where("#{Ctws.user_class.name.underscore}_id": user.id).last.id,
|
37
|
-
attributes: Ctws.device_class.where("#{Ctws.user_class.name.underscore}_id": user.id).last
|
38
|
-
}]
|
39
|
-
},
|
40
|
-
profile: {
|
41
|
-
data: [{
|
42
|
-
type: ActiveModel::Naming.param_key(Ctws.profile_class),
|
43
|
-
id: Ctws.profile_class.where("#{Ctws.user_class.name.underscore}_id": user.id).last.id,
|
44
|
-
attributes: Ctws.profile_class.where("#{Ctws.user_class.name.underscore}_id": user.id).last
|
45
|
-
}]
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}]
|
49
|
-
end
|
50
|
-
|
51
22
|
def ctws_user_params
|
52
23
|
params.permit(Ctws.user_class_strong_params)
|
53
24
|
end
|
54
25
|
end
|
55
|
-
end
|
26
|
+
end
|
data/config/initializers/ctws.rb
CHANGED
data/lib/ctws/version.rb
CHANGED
data/lib/ctws.rb
CHANGED
@@ -2,8 +2,6 @@ require "ctws/engine"
|
|
2
2
|
|
3
3
|
module Ctws
|
4
4
|
mattr_accessor :user_class
|
5
|
-
mattr_accessor :device_class
|
6
|
-
mattr_accessor :profile_class
|
7
5
|
mattr_accessor :user_class_strong_params
|
8
6
|
mattr_accessor :user_validate_with_password
|
9
7
|
mattr_accessor :jwt_expiration_time
|
@@ -12,12 +10,6 @@ module Ctws
|
|
12
10
|
def self.user_class
|
13
11
|
@@user_class.constantize
|
14
12
|
end
|
15
|
-
def self.device_class
|
16
|
-
@@device_class.constantize
|
17
|
-
end
|
18
|
-
def self.profile_class
|
19
|
-
@@profile_class.constantize
|
20
|
-
end
|
21
13
|
|
22
14
|
def self.jwt_auth_token_attrs
|
23
15
|
# TODO: implement
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ctws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustí B.R.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|