ecom_core 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/ecom/core/resource_typeable.rb +3 -3
- data/app/controllers/ecom/core/application_modules_controller.rb +3 -3
- data/app/controllers/ecom/core/user_roles_controller.rb +3 -3
- data/app/controllers/ecom/core/users_controller.rb +4 -4
- data/app/serializers/ecom/core/application_module_serializer.rb +1 -3
- data/app/serializers/ecom/core/application_serializer.rb +20 -0
- data/app/serializers/ecom/core/lookup_serializer.rb +1 -2
- data/app/serializers/ecom/core/resource_type_serializer.rb +1 -2
- data/app/serializers/ecom/core/user_role_serializer.rb +1 -3
- data/app/serializers/ecom/core/user_serializer.rb +1 -3
- data/lib/ecom/core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2895033d80d7daf5caff3007574dafa35e35ef0ecbbf079c1754c57fb04aee68
|
4
|
+
data.tar.gz: 1e4ae04cf7665c57c4e0fb71bdb662072a6880a493086a7351d43ca4c20fdf7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 900f2aa8b6328d872591822ab4999ef84a755304d3c4f422ae97f8d88973d1cf9b611b914e5732623a242dfc09e3fafea5c2cb627882f292131cd828efe36222
|
7
|
+
data.tar.gz: 13be6b214efa63bd715b111dc66f94249502c63d8a2011036e3f90dc24330b9f749b742b04c76927b5d6d158181f8f38ecbbdbc8f68445190e8c22196257d141
|
@@ -8,13 +8,13 @@ module Ecom
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def index
|
11
|
-
render json: ResourceTypeSerializer.new(@clazz.all)
|
11
|
+
render json: ResourceTypeSerializer.new(@clazz.all).serializable_hash
|
12
12
|
end
|
13
13
|
|
14
14
|
def create
|
15
15
|
resource_type = @clazz.new(resource_type_params)
|
16
16
|
if resource_type.save
|
17
|
-
render json: ResourceTypeSerializer.new(resource_type), status: :created
|
17
|
+
render json: ResourceTypeSerializer.new(resource_type).serializable_hash, status: :created
|
18
18
|
else
|
19
19
|
render json: { success: false, errors: resource_type.errors }, status: :unprocessable_entity
|
20
20
|
end
|
@@ -23,7 +23,7 @@ module Ecom
|
|
23
23
|
def update
|
24
24
|
resource_type = @clazz.find(params[:id])
|
25
25
|
if resource_type.update(resource_type_params)
|
26
|
-
render json: ResourceTypeSerializer.new(resource_type)
|
26
|
+
render json: ResourceTypeSerializer.new(resource_type).serializable_hash
|
27
27
|
else
|
28
28
|
render json: { success: false, errors: resource_type.errors }, status: :unprocessable_entity
|
29
29
|
end
|
@@ -2,13 +2,13 @@ module Ecom
|
|
2
2
|
module Core
|
3
3
|
class ApplicationModulesController < ApplicationController
|
4
4
|
def index
|
5
|
-
render json: ApplicationModuleSerializer.new(ApplicationModule.all)
|
5
|
+
render json: ApplicationModuleSerializer.new(ApplicationModule.all).serializable_hash
|
6
6
|
end
|
7
7
|
|
8
8
|
def create
|
9
9
|
application_module = ApplicationModule.new(application_module_params)
|
10
10
|
if application_module.save
|
11
|
-
render json: ApplicationModuleSerializer.new(application_module), status: :created
|
11
|
+
render json: ApplicationModuleSerializer.new(application_module).serializable_hash, status: :created
|
12
12
|
else
|
13
13
|
render json: { success: false, errors: application_module.errors }, status: :unprocessable_entity
|
14
14
|
end
|
@@ -17,7 +17,7 @@ module Ecom
|
|
17
17
|
def update
|
18
18
|
application_module = ApplicationModule.find(params[:id])
|
19
19
|
if application_module.update(application_module_params)
|
20
|
-
render json: ApplicationModuleSerializer.new(application_module)
|
20
|
+
render json: ApplicationModuleSerializer.new(application_module).serializable_hash
|
21
21
|
else
|
22
22
|
render json: { success: false, errors: application_module.errors }, status: :unprocessable_entity
|
23
23
|
end
|
@@ -4,14 +4,14 @@ module Ecom
|
|
4
4
|
before_action :set_user_role, only: [:update]
|
5
5
|
|
6
6
|
def index
|
7
|
-
render json: UserRoleSerializer.new(UserRole.all)
|
7
|
+
render json: UserRoleSerializer.new(UserRole.all).serializable_hash
|
8
8
|
end
|
9
9
|
|
10
10
|
def create
|
11
11
|
user_role = UserRole.new(user_role_params)
|
12
12
|
|
13
13
|
if user_role.save
|
14
|
-
render json: UserRoleSerializer.new(user_role), status: :created
|
14
|
+
render json: UserRoleSerializer.new(user_role).serializable_hash, status: :created
|
15
15
|
else
|
16
16
|
render json: { success: false, errors: user_role.errors }, status: :unprocessable_entity
|
17
17
|
end
|
@@ -19,7 +19,7 @@ module Ecom
|
|
19
19
|
|
20
20
|
def update
|
21
21
|
if @user_role.update(user_role_params)
|
22
|
-
render json: UserRoleSerializer.new(@user_role)
|
22
|
+
render json: UserRoleSerializer.new(@user_role).serializable_hash
|
23
23
|
else
|
24
24
|
render json: { success: false, errors: @user_role.errors }, status: :unprocessable_entity
|
25
25
|
end
|
@@ -4,17 +4,17 @@ module Ecom
|
|
4
4
|
before_action :set_user, only: [:update]
|
5
5
|
|
6
6
|
def index
|
7
|
-
render json: UserSerializer.new(User.all)
|
7
|
+
render json: UserSerializer.new(User.all).serializable_hash
|
8
8
|
end
|
9
9
|
|
10
10
|
def active
|
11
|
-
render json: UserSerializer.new(User.active)
|
11
|
+
render json: UserSerializer.new(User.active).serializable_hash
|
12
12
|
end
|
13
13
|
|
14
14
|
def create
|
15
15
|
user = User.new(user_params)
|
16
16
|
if user.save
|
17
|
-
render json: UserSerializer.new(user), status: :created
|
17
|
+
render json: UserSerializer.new(user).serializable_hash, status: :created
|
18
18
|
else
|
19
19
|
render json: { success: false, errors: user.errors }, status: :unprocessable_entity
|
20
20
|
end
|
@@ -22,7 +22,7 @@ module Ecom
|
|
22
22
|
|
23
23
|
def update
|
24
24
|
if @user.update(user_params)
|
25
|
-
render json: UserSerializer.new(@user)
|
25
|
+
render json: UserSerializer.new(@user).serializable_hash
|
26
26
|
else
|
27
27
|
render json: { success: false, errors: @user.errors }, status: :unprocessable_entity
|
28
28
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Ecom
|
2
|
+
module Core
|
3
|
+
class ApplicationSerializer
|
4
|
+
include FastJsonapi::ObjectSerializer
|
5
|
+
|
6
|
+
def serializable_hash
|
7
|
+
data = super[:data]
|
8
|
+
if data.is_a? Hash
|
9
|
+
data[:attributes]
|
10
|
+
elsif data.is_a? Array
|
11
|
+
data.map { |d| d[:attributes] }
|
12
|
+
elsif data.nil?
|
13
|
+
nil
|
14
|
+
else
|
15
|
+
data
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/ecom/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecom_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- app/models/ecom/core/work_product.rb
|
252
252
|
- app/models/ecom/core/work_product_template.rb
|
253
253
|
- app/serializers/ecom/core/application_module_serializer.rb
|
254
|
+
- app/serializers/ecom/core/application_serializer.rb
|
254
255
|
- app/serializers/ecom/core/lookup_serializer.rb
|
255
256
|
- app/serializers/ecom/core/resource_type_serializer.rb
|
256
257
|
- app/serializers/ecom/core/user_role_serializer.rb
|