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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18d98ae978de2abf64ad9cadba41ce8ae009b4ea
4
- data.tar.gz: 4d21f57fd365a1ea926b545c4755515958c01ff6
3
+ metadata.gz: a89c4618b48422db1f843176ae9cf160f9e56fb3
4
+ data.tar.gz: 59e769c9c6bfd32da80f3a5132fe838555ca152b
5
5
  SHA512:
6
- metadata.gz: b521896ae6168fd5cab4a3a11e902e5fbe283b7db72b746f5237b7a384184ff3d40e53bf80fe42c7ff5e26f847095f95086d10818f7b55175030aaaf66fb49dd
7
- data.tar.gz: 28aeba35b95f5cd8ec64ba02fd304c4e54c4fa7e9d944138fd06f133d7d2e55ca9032a15bbd2d4bd37105f7207bfbe6c96710b5768e5a434adcc6c9d70abf645
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 = %i(email password password_confirmation
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
@@ -1,5 +1,7 @@
1
1
  Ctws.user_class = "User"
2
- Ctws.user_class_strong_params = %i(email password password_confirmation)
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
@@ -1,3 +1,3 @@
1
1
  module Ctws
2
- VERSION = '0.1.8.alpha'
2
+ VERSION = '0.1.9.alpha'
3
3
  end
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.8.alpha
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-18 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails