hoodoo 2.12.3 → 2.12.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdca69c2a29ece8bc75d1470298b790131dc103929c0bd654c5e01ff6b841175
|
4
|
+
data.tar.gz: 5ed6123e57aa9e3fc8344b7178f5aa68765ce5b646cf379ec08914ff2d86c89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff3091821407f644dabb949c6f3bb45f54eba866184633904e056b74a979a9f73f555387f3f167bf43f39ea9e127ccf555f041b2f4cb7b6da74557e90cc3064
|
7
|
+
data.tar.gz: '078991782941704131ffe94f29a37c9e155b8bab2b64618d793c9923d42c70ff67d50dd1895e38a42a5966427d54f35dae37657bb445b325fdf08ab14cbb9d46'
|
@@ -90,12 +90,16 @@ module Hoodoo
|
|
90
90
|
# were used to create the Session under which the
|
91
91
|
# resource instance was created. Absent if omitted.
|
92
92
|
#
|
93
|
+
# +updated_at+:: Optional Date/Time of instance update. This is a Ruby
|
94
|
+
# DateTime instance or similar, _NOT_ a string!
|
95
|
+
#
|
93
96
|
def self.render( data,
|
94
97
|
uuid = nil,
|
95
98
|
created_at = nil,
|
96
99
|
language = 'en-nz',
|
97
|
-
created_by = nil
|
98
|
-
|
100
|
+
created_by = nil,
|
101
|
+
updated_at = nil
|
102
|
+
)
|
99
103
|
target = {}
|
100
104
|
data = data || {}
|
101
105
|
|
@@ -126,6 +130,7 @@ module Hoodoo
|
|
126
130
|
'created_at' => Hoodoo::Utilities.standard_datetime( created_at.to_datetime )
|
127
131
|
} )
|
128
132
|
|
133
|
+
target[ 'updated_at' ] = Hoodoo::Utilities.standard_datetime( updated_at.to_datetime ) unless updated_at.nil?
|
129
134
|
target[ 'created_by' ] = created_by unless created_by.nil?
|
130
135
|
target[ 'language' ] = language if self.is_internationalised?()
|
131
136
|
|
@@ -167,6 +172,9 @@ module Hoodoo
|
|
167
172
|
# +created_at+:: Same as the +created_at+ parameter to ::render, except
|
168
173
|
# mandatory.
|
169
174
|
#
|
175
|
+
# +updated_at+:: Optional value expressing the time the resource was last
|
176
|
+
# updated.
|
177
|
+
#
|
170
178
|
# +created_by+:: Optional fingerprint of the Caller whose credentials
|
171
179
|
# were used to create the Session under which the
|
172
180
|
# resource instance was created.
|
@@ -194,13 +202,14 @@ module Hoodoo
|
|
194
202
|
def self.render_in( context, data, options = {} )
|
195
203
|
uuid = options[ :uuid ]
|
196
204
|
created_at = options[ :created_at ]
|
205
|
+
updated_at = options[ :updated_at ]
|
197
206
|
created_by = options[ :created_by ]
|
198
207
|
language = options[ :language ] || context.request.locale
|
199
208
|
secured_with = options[ :secured_with ]
|
200
209
|
embeds = options[ :embeds ]
|
201
210
|
references = options[ :references ]
|
202
211
|
|
203
|
-
target = self.render( data, uuid, created_at, language, created_by )
|
212
|
+
target = self.render( data, uuid, created_at, language, created_by, updated_at )
|
204
213
|
|
205
214
|
if defined?( ::ActiveRecord ) && secured_with.is_a?( ::ActiveRecord::Base )
|
206
215
|
result_hash = {}
|
@@ -251,6 +260,9 @@ module Hoodoo
|
|
251
260
|
created_by = data[ :created_by ]
|
252
261
|
common_fields[ 'created_by' ] = created_by unless created_by.nil?
|
253
262
|
|
263
|
+
updated_at = data[ :updated_at ]
|
264
|
+
common_fields[ 'updated_at' ] = updated_at unless updated_at.nil?
|
265
|
+
|
254
266
|
if self.is_internationalised?
|
255
267
|
common_fields[ 'internationalised' ] = data[ 'internationalised' ]
|
256
268
|
Hoodoo::Presenters::CommonResourceFields.get_schema.properties[ 'language' ].required = true
|
data/lib/hoodoo/version.rb
CHANGED
@@ -12,11 +12,11 @@ module Hoodoo
|
|
12
12
|
# The Hoodoo gem version. If this changes, be sure to re-run
|
13
13
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
14
14
|
#
|
15
|
-
VERSION = '2.12.
|
15
|
+
VERSION = '2.12.4'
|
16
16
|
|
17
17
|
# The Hoodoo gem date. If this changes, be sure to re-run
|
18
18
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
19
19
|
#
|
20
|
-
DATE = '2019-11-
|
20
|
+
DATE = '2019-11-15'
|
21
21
|
|
22
22
|
end
|
@@ -362,7 +362,8 @@ describe '#schema' do
|
|
362
362
|
Hoodoo::UUID.generate,
|
363
363
|
Time.now,
|
364
364
|
'en-gb',
|
365
|
-
Hoodoo::UUID.generate
|
365
|
+
Hoodoo::UUID.generate,
|
366
|
+
Time.now
|
366
367
|
)
|
367
368
|
|
368
369
|
expect(Hoodoo::Data::Resources::World.validate(rendered, true).errors).to eq([])
|
@@ -707,6 +708,7 @@ describe '#schema' do
|
|
707
708
|
'id' => @uuid,
|
708
709
|
'kind' => 'World',
|
709
710
|
'created_at' => Hoodoo::Utilities.standard_datetime( @time ),
|
711
|
+
'updated_at' => Hoodoo::Utilities.standard_datetime( @time ),
|
710
712
|
'language' => 'en-gb',
|
711
713
|
'errors_id' => @input['errors_id'],
|
712
714
|
'test_tags' => 'foo,bar,baz',
|
@@ -729,7 +731,9 @@ describe '#schema' do
|
|
729
731
|
@input,
|
730
732
|
@uuid,
|
731
733
|
@time,
|
732
|
-
'en-gb'
|
734
|
+
'en-gb',
|
735
|
+
nil,
|
736
|
+
@time
|
733
737
|
)
|
734
738
|
).to( eq( @output ) )
|
735
739
|
end
|
@@ -744,7 +748,8 @@ describe '#schema' do
|
|
744
748
|
@uuid,
|
745
749
|
@time,
|
746
750
|
'en-gb',
|
747
|
-
fingerprint
|
751
|
+
fingerprint,
|
752
|
+
@time
|
748
753
|
)
|
749
754
|
).to( eq( @output ) )
|
750
755
|
end
|
@@ -6,13 +6,15 @@ describe Hoodoo::Presenters::CommonResourceFields do
|
|
6
6
|
|
7
7
|
expect(schema.is_internationalised?()).to eq(false)
|
8
8
|
|
9
|
-
expect(schema.properties.count).to eq(
|
9
|
+
expect(schema.properties.count).to eq(8)
|
10
10
|
|
11
11
|
expect(schema.properties['id']).to be_a(Hoodoo::Presenters::UUID)
|
12
12
|
expect(schema.properties['id'].required).to eq(true)
|
13
13
|
expect(schema.properties['id'].resource).to be_nil
|
14
14
|
expect(schema.properties['created_at']).to be_a(Hoodoo::Presenters::DateTime)
|
15
15
|
expect(schema.properties['created_at'].required).to eq(true)
|
16
|
+
expect(schema.properties['updated_at']).to be_a(Hoodoo::Presenters::DateTime)
|
17
|
+
expect(schema.properties['updated_at'].required).to eq(false)
|
16
18
|
expect(schema.properties['kind']).to be_a(Hoodoo::Presenters::Text)
|
17
19
|
expect(schema.properties['kind'].required).to eq(true)
|
18
20
|
expect(schema.properties['language']).to be_a(Hoodoo::Presenters::Text)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoodoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loyalty New Zealand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|