ctws 0.1.8.alpha → 0.1.9.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 +4 -1
- data/app/controllers/ctws/users_controller.rb +16 -0
- data/config/initializers/ctws.rb +3 -1
- data/lib/ctws/version.rb +1 -1
- data/lib/ctws.rb +8 -0
- 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: a89c4618b48422db1f843176ae9cf160f9e56fb3
|
4
|
+
data.tar.gz: 59e769c9c6bfd32da80f3a5132fe838555ca152b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2303cb40621f4a6268c9dbc0acdd10d829d72a8c43f5a389d2ca0340f9c6ecf1f91172d96575d1d5b7a3a725b056eb8119cf5df6f836f5bf7c5e407620318855
|
7
|
+
data.tar.gz: 9e71c66b16b415382dcc30eef2ccf2fb05e342034fe0c13c2545bcbf5e8e41a499d75a177cc4884852eeab94fb6dcab1e30eb62ba3532f75e82fd5229127f5f8
|
data/README.md
CHANGED
@@ -56,6 +56,9 @@ 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
|
59
62
|
```
|
60
63
|
|
61
64
|
The application `User` model **must have the `email` attribute**.
|
@@ -70,7 +73,7 @@ Ctws.user_validate_with_password = false
|
|
70
73
|
You can edit your app's required fields for signup by creating or editing the `ctws.rb` initializer file in `config/initializers` and put your strong parameters:
|
71
74
|
|
72
75
|
```ruby
|
73
|
-
Ctws.user_class_strong_params =
|
76
|
+
Ctws.user_class_strong_params = [:email, :password, :password_confirmation]
|
74
77
|
```
|
75
78
|
|
76
79
|
### Set the `JWT` expiry time
|
@@ -28,6 +28,22 @@ module Ctws
|
|
28
28
|
message: Ctws::Message.account_created,
|
29
29
|
auth_token: auth_token,
|
30
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)
|
45
|
+
}]
|
46
|
+
}
|
31
47
|
}
|
32
48
|
}]
|
33
49
|
end
|
data/config/initializers/ctws.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
Ctws.user_class = "User"
|
2
|
-
Ctws.
|
2
|
+
Ctws.device_class = "DeviceApp"
|
3
|
+
Ctws.profile_class = "Profile"
|
4
|
+
Ctws.user_class_strong_params = [:email, :password, :password_confirmation]
|
3
5
|
Ctws.user_validate_with_password = true
|
4
6
|
Ctws.jwt_expiration_time = 24.hours.from_now
|
5
7
|
Ctws.jwt_auth_token_attrs = %i(id email) # TODO: implement
|
data/lib/ctws/version.rb
CHANGED
data/lib/ctws.rb
CHANGED
@@ -2,6 +2,8 @@ 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
|
5
7
|
mattr_accessor :user_class_strong_params
|
6
8
|
mattr_accessor :user_validate_with_password
|
7
9
|
mattr_accessor :jwt_expiration_time
|
@@ -10,6 +12,12 @@ module Ctws
|
|
10
12
|
def self.user_class
|
11
13
|
@@user_class.constantize
|
12
14
|
end
|
15
|
+
def self.device_class
|
16
|
+
@@device_class.constantize
|
17
|
+
end
|
18
|
+
def self.profile_class
|
19
|
+
@@profile_class.constantize
|
20
|
+
end
|
13
21
|
|
14
22
|
def self.jwt_auth_token_attrs
|
15
23
|
# 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.9.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-07-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|