pg_serializable 2.1.1 → 3.1.0

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
  SHA256:
3
- metadata.gz: 7a6b84a108ee7251260d5815a6f39ace9730f09fa9afb4c021c4dba595518b44
4
- data.tar.gz: 79eedfdfffe000fc9a6d9099f64d531ec3700477e4f36d3533f986a09b93158e
3
+ metadata.gz: 3189b97d351d9f7e935da2cbb6e18e294c4a8b340ff5287875e1b3ead6b9a357
4
+ data.tar.gz: 3cc26b7781eaf661c8a2179da986e8ecdaba8aeaa2dcab7955ed5e1ec7577448
5
5
  SHA512:
6
- metadata.gz: 939ad158799faa8bf26ac8066604dcbd4ddcc13b5483fdaf663f3dd41416d590c1c9272d376f62443abb02a95bfe691f4c1505c426f3d87fae96416c9374f494
7
- data.tar.gz: 90c4807f5c2ef239653444f97aeb0dd72c602bc4dcc9a52dfd27a3e07e09ea748aa886a91d82577bd422061ef3298f642225bc9002fa564e5c21b9e3dc2b87c3
6
+ metadata.gz: ef0c93d924220937e74665c36b2f742531f8567cb5f255bcc920fcc51b3f753b086e6a745adbde29865f88faafb61c91b479d64c0c5c90a0977d8dc2beac0ac0
7
+ data.tar.gz: e3aca9920562d2c5c5dd6dc8d7fd2bacffec01b082096dea5cfea19b0f75cd194c18e52f66fe7651ad14cfe3a6dcf6572fe80b4c7c5e514fcb7a4df6a6f4ad16
data/Gemfile.lock CHANGED
@@ -1,86 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pg_serializable (2.1.1)
5
- activerecord (>= 5.2, < 7.0)
6
- activesupport (>= 5.2, < 7.0)
7
- oj (~> 3.6)
4
+ pg_serializable (3.1.0)
5
+ activerecord (>= 5.2, < 8.0)
6
+ activesupport (>= 5.2, < 8.0)
8
7
  pg (>= 1.1)
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- activemodel (5.2.3)
14
- activesupport (= 5.2.3)
15
- activerecord (5.2.3)
16
- activemodel (= 5.2.3)
17
- activesupport (= 5.2.3)
18
- arel (>= 9.0)
19
- activesupport (5.2.3)
12
+ activemodel (7.0.0)
13
+ activesupport (= 7.0.0)
14
+ activerecord (7.0.0)
15
+ activemodel (= 7.0.0)
16
+ activesupport (= 7.0.0)
17
+ activesupport (7.0.0)
20
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
- i18n (>= 0.7, < 2)
22
- minitest (~> 5.1)
23
- tzinfo (~> 1.1)
24
- arel (9.0.0)
25
- codecov (0.1.14)
26
- json
27
- simplecov
28
- url
29
- coderay (1.1.2)
30
- concurrent-ruby (1.1.5)
31
- database_cleaner (1.7.0)
32
- diff-lcs (1.3)
33
- docile (1.3.1)
34
- factory_bot (5.0.2)
35
- activesupport (>= 4.2.0)
36
- ffaker (2.11.0)
37
- i18n (1.6.0)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ codecov (0.6.0)
23
+ simplecov (>= 0.15, < 0.22)
24
+ coderay (1.1.3)
25
+ concurrent-ruby (1.1.9)
26
+ database_cleaner (2.0.1)
27
+ database_cleaner-active_record (~> 2.0.0)
28
+ database_cleaner-active_record (2.0.1)
29
+ activerecord (>= 5.a)
30
+ database_cleaner-core (~> 2.0.0)
31
+ database_cleaner-core (2.0.1)
32
+ diff-lcs (1.4.4)
33
+ docile (1.4.0)
34
+ factory_bot (6.2.0)
35
+ activesupport (>= 5.0.0)
36
+ ffaker (2.20.0)
37
+ i18n (1.8.11)
38
38
  concurrent-ruby (~> 1.0)
39
- json (2.2.0)
40
- method_source (0.9.2)
41
- minitest (5.11.3)
42
- oj (3.9.0)
43
- pg (1.1.4)
44
- pry (0.12.2)
45
- coderay (~> 1.1.0)
46
- method_source (~> 0.9.0)
47
- rake (10.5.0)
48
- rspec (3.8.0)
49
- rspec-core (~> 3.8.0)
50
- rspec-expectations (~> 3.8.0)
51
- rspec-mocks (~> 3.8.0)
52
- rspec-core (3.8.0)
53
- rspec-support (~> 3.8.0)
54
- rspec-expectations (3.8.2)
39
+ method_source (1.0.0)
40
+ minitest (5.15.0)
41
+ pg (1.2.3)
42
+ pry (0.14.1)
43
+ coderay (~> 1.1)
44
+ method_source (~> 1.0)
45
+ rake (13.0.6)
46
+ rspec (3.10.0)
47
+ rspec-core (~> 3.10.0)
48
+ rspec-expectations (~> 3.10.0)
49
+ rspec-mocks (~> 3.10.0)
50
+ rspec-core (3.10.1)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-expectations (3.10.1)
55
53
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.8.0)
57
- rspec-mocks (3.8.0)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-mocks (3.10.2)
58
56
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.8.0)
60
- rspec-support (3.8.0)
61
- simplecov (0.16.1)
57
+ rspec-support (~> 3.10.0)
58
+ rspec-support (3.10.3)
59
+ simplecov (0.21.2)
62
60
  docile (~> 1.1)
63
- json (>= 1.8, < 3)
64
- simplecov-html (~> 0.10.0)
65
- simplecov-html (0.10.2)
66
- thread_safe (0.3.6)
67
- tzinfo (1.2.5)
68
- thread_safe (~> 0.1)
69
- url (0.3.2)
61
+ simplecov-html (~> 0.11)
62
+ simplecov_json_formatter (~> 0.1)
63
+ simplecov-html (0.12.3)
64
+ simplecov_json_formatter (0.1.3)
65
+ tzinfo (2.0.4)
66
+ concurrent-ruby (~> 1.0)
70
67
 
71
68
  PLATFORMS
72
69
  ruby
73
70
 
74
71
  DEPENDENCIES
75
- bundler (~> 1.16)
76
72
  codecov
77
73
  database_cleaner
78
74
  factory_bot
79
75
  ffaker
80
76
  pg_serializable!
81
77
  pry
82
- rake (~> 10.0)
78
+ rake (~> 13.0)
83
79
  rspec (~> 3.0)
84
80
 
85
81
  BUNDLED WITH
86
- 1.17.3
82
+ 2.2.33
data/README.md CHANGED
@@ -7,6 +7,23 @@
7
7
 
8
8
  Serialize json directly from postgres (9.4+).
9
9
 
10
+ ## Upgrading from version 2.x.x to 3.x.x
11
+
12
+ Serialization returns a PORO instead of a json string. If you have code like:
13
+ ```ruby
14
+ OJ.load(Product.where(id: ids).json)
15
+ ```
16
+
17
+ You can replace it with:
18
+ ```ruby
19
+ Product.where(id: ids).json
20
+ ```
21
+
22
+ To automatically use OJ to serialize your POROs to json strings, add this code to your initialization:
23
+ ```ruby
24
+ Oj.optimize_rails()
25
+ ```
26
+
10
27
  ## Motivation
11
28
  Models:
12
29
  ```ruby
@@ -533,7 +550,7 @@ class Variation < ApplicationRecord
533
550
  serializable do
534
551
  default do
535
552
  attributes :id
536
- belongs_to: :color
553
+ belongs_to :color
537
554
  end
538
555
 
539
556
  trait :for_products do
@@ -1,3 +1,3 @@
1
1
  module PgSerializable
2
- VERSION = "2.1.1"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -1,4 +1,3 @@
1
- require 'oj'
2
1
  require 'active_support/concern'
3
2
  require 'active_support/core_ext/module/delegation'
4
3
  require 'pg_serializable/errors'
@@ -57,7 +56,7 @@ module PgSerializable
57
56
 
58
57
  def to_pg_json(scope)
59
58
  res = scope.as_json.first
60
- ::Oj.dump(res['coalesce'] || res['json_build_object'])
59
+ res['coalesce'] || res['json_build_object']
61
60
  end
62
61
 
63
62
  private
@@ -21,17 +21,15 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.16"
25
24
  spec.add_development_dependency "codecov"
26
25
  spec.add_development_dependency "database_cleaner"
27
26
  spec.add_development_dependency "factory_bot"
28
27
  spec.add_development_dependency "ffaker"
29
28
  spec.add_development_dependency "pry"
30
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
31
30
  spec.add_development_dependency "rspec", "~> 3.0"
32
31
 
33
- spec.add_runtime_dependency "activesupport", ">= 5.2", "< 7.0"
34
- spec.add_runtime_dependency "activerecord", ">= 5.2", "< 7.0"
32
+ spec.add_runtime_dependency "activesupport", ">= 5.2", "< 8.0"
33
+ spec.add_runtime_dependency "activerecord", ">= 5.2", "< 8.0"
35
34
  spec.add_runtime_dependency "pg", ">= 1.1"
36
- spec.add_runtime_dependency "oj", "~> 3.6"
37
35
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_serializable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - matthewjf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2021-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.16'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: codecov
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +86,14 @@ dependencies:
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '10.0'
89
+ version: '13.0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '10.0'
96
+ version: '13.0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +117,7 @@ dependencies:
131
117
  version: '5.2'
132
118
  - - "<"
133
119
  - !ruby/object:Gem::Version
134
- version: '7.0'
120
+ version: '8.0'
135
121
  type: :runtime
136
122
  prerelease: false
137
123
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,7 +127,7 @@ dependencies:
141
127
  version: '5.2'
142
128
  - - "<"
143
129
  - !ruby/object:Gem::Version
144
- version: '7.0'
130
+ version: '8.0'
145
131
  - !ruby/object:Gem::Dependency
146
132
  name: activerecord
147
133
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +137,7 @@ dependencies:
151
137
  version: '5.2'
152
138
  - - "<"
153
139
  - !ruby/object:Gem::Version
154
- version: '7.0'
140
+ version: '8.0'
155
141
  type: :runtime
156
142
  prerelease: false
157
143
  version_requirements: !ruby/object:Gem::Requirement
@@ -161,7 +147,7 @@ dependencies:
161
147
  version: '5.2'
162
148
  - - "<"
163
149
  - !ruby/object:Gem::Version
164
- version: '7.0'
150
+ version: '8.0'
165
151
  - !ruby/object:Gem::Dependency
166
152
  name: pg
167
153
  requirement: !ruby/object:Gem::Requirement
@@ -176,20 +162,6 @@ dependencies:
176
162
  - - ">="
177
163
  - !ruby/object:Gem::Version
178
164
  version: '1.1'
179
- - !ruby/object:Gem::Dependency
180
- name: oj
181
- requirement: !ruby/object:Gem::Requirement
182
- requirements:
183
- - - "~>"
184
- - !ruby/object:Gem::Version
185
- version: '3.6'
186
- type: :runtime
187
- prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
189
- requirements:
190
- - - "~>"
191
- - !ruby/object:Gem::Version
192
- version: '3.6'
193
165
  description: serializes rails models from postgres (9.5+)
194
166
  email:
195
167
  - matthewjf@gmail.com
@@ -248,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
220
  - !ruby/object:Gem::Version
249
221
  version: '0'
250
222
  requirements: []
251
- rubyforge_project:
252
- rubygems_version: 2.7.6
223
+ rubygems_version: 3.0.3.1
253
224
  signing_key:
254
225
  specification_version: 4
255
226
  summary: serializes rails models from postgres (9.5+)