wolf_core 1.0.87 → 1.0.89

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ff4be5d8370b933a99e3f8759bfde8f6769a941d25e8b617f7f19008bd462f7
4
- data.tar.gz: e0765d75bb28bb02c2406ac0ef18722f26f3afbedaa3ae19b3670da023ecc216
3
+ metadata.gz: 9e3788f54ee4bc3d7ccb0553bf1fd049dd350cd24394e30aac7857f7559a8e0b
4
+ data.tar.gz: a3a178220e9786855a088e5e3808044bb9f98d6062e4755c638c7ca1d852ba9b
5
5
  SHA512:
6
- metadata.gz: 73bd114d5f4e9ff4c3912142980325645030883ff898ce62ac3230ca3f3faaaa0281266177411783cd77b6734273f590ad8af11180f0ffefcf008974c11d4732
7
- data.tar.gz: 97e9d0d585f9f4cdefb0f831f391cc45f70307c025328817a2bf08b1a029c44a36b4dfac0faeb050823d1846078910ccbbd664fc6bd11ef4f63be9175fe76042
6
+ metadata.gz: 3656e64d8c6a45ef9b2d76701299ce37c272f01f9c7140b071aeb95e89b6c383a34f2d8d7c08b7937386eecad7a80284bf64619b5b354b4a5c1ea0414662576f
7
+ data.tar.gz: 9d268b51a5a6de04ca91a8aafbf0bef34ead641b58ea6658ebcb6043858bfe5034ff3faa3615966384b42fd0b137fbced25d88e2b24b20db18d9ba86871211df
@@ -48,13 +48,13 @@ module WolfCore
48
48
  object
49
49
  else
50
50
  result = self.create(object)
51
- success_key = extract_success_key(object)
51
+ success_key = extract_success_key
52
52
  result.success? ? result.data.send(success_key) : object
53
53
  end
54
54
  end
55
55
 
56
56
  def self.create_all(objects)
57
- success_key = extract_success_key(objects.first)
57
+ success_key = extract_success_key
58
58
  final_array = []
59
59
  objects.each do |object|
60
60
  result = create(object)
@@ -71,7 +71,7 @@ module WolfCore
71
71
  object = self.new(parse_params(params, **kwargs))
72
72
  object.reset_changes
73
73
  if object.valid?
74
- success_key = extract_success_key(object)
74
+ success_key = extract_success_key
75
75
  Result.success(data: { success_key => object })
76
76
  else
77
77
  Result.failure(error: { message: object.errors.full_messages.to_sentence })
@@ -80,8 +80,8 @@ module WolfCore
80
80
  Result.failure(error: { message: e.message, error_type: e.class.to_s })
81
81
  end
82
82
 
83
- def self.extract_success_key(object)
84
- object.class.to_s.split('::').last.underscore
83
+ def self.extract_success_key
84
+ self.to_s.split('::').last.underscore
85
85
  end
86
86
 
87
87
  def self.parse_params(params = {}, **kwargs)
@@ -4,5 +4,6 @@ module WolfCore
4
4
  class ApplicationRepository
5
5
  include WolfCore::NoSqlDbOperations
6
6
  include WolfCore::HttpOperations
7
+ include WolfCore::Serializable
7
8
  end
8
9
  end
@@ -0,0 +1,17 @@
1
+ module WolfCore
2
+ module Serializable
3
+ def serialize_with(serializer, entity, options = {})
4
+ serializer.new(entity, options).as_json.with_indifferent_access
5
+ end
6
+
7
+ def serialize_all_with(serializer, collection, options = {})
8
+ collection.map do |item|
9
+ serialize_with(
10
+ serializer,
11
+ item,
12
+ options
13
+ )
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.87"
4
+ VERSION = "1.0.89"
5
5
  end
data/lib/wolf_core.rb CHANGED
@@ -5,6 +5,7 @@ require 'ostruct'
5
5
  require 'httparty'
6
6
  require 'active_support'
7
7
  require 'active_model'
8
+ require 'active_model_serializers'
8
9
  require 'active_support/core_ext'
9
10
  require 'aws-sdk-lambda'
10
11
  require 'redis'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.87
4
+ version: 1.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
11
+ date: 2025-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: active_model_serializers
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Repository to store shared code among Ruby projects.
112
126
  email:
113
127
  - jroncallo96@gmail.com
@@ -146,6 +160,7 @@ files:
146
160
  - lib/wolf_core/infrastructure/lambda_function_operations.rb
147
161
  - lib/wolf_core/infrastructure/no_sql_db_data_source.rb
148
162
  - lib/wolf_core/infrastructure/no_sql_db_operations.rb
163
+ - lib/wolf_core/infrastructure/serializable.rb
149
164
  - lib/wolf_core/utils/array_utils.rb
150
165
  - lib/wolf_core/utils/async_utils.rb
151
166
  - lib/wolf_core/utils/file_utils.rb