dxlite 0.6.2 → 0.6.5

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: ceb35ccf99574494fddc04bcff1ca0da8f3e9105ff96663c4127e001e6c0d0f4
4
- data.tar.gz: cb7d10780d5fe0930c82ef96918662a9bb0cfa7b52b340987e633e4d5a52c531
3
+ metadata.gz: 5e816ab0daf222f885ee7ea249cdf9a012bbd6fff5b5dbd70ad7954d5e64fca0
4
+ data.tar.gz: ba6b9adc13348320094513bbfd1f1640f2701b536144979db8bbca80e24da322
5
5
  SHA512:
6
- metadata.gz: 6cc80cf0885f8973443fd2301cbaf9a1f85eb65c47600feb3cf33097ccdc2953a7f0dc9dfd670b80f38255088d2a643bcff2bb80e55b8e179bb20fafc89e5214
7
- data.tar.gz: f75f94e5af4dbdc3277f698915661d6028b9f04cda8c17f8626767586b69139febfd30cdcb3e9fc40528c297b6125a7dea2e81b0385204852fe174748b9c9d23
6
+ metadata.gz: 22a4b6eb08241bc846b2514b95221eb53b2bb2bf43fdabb59bf051a2b318fe67c0a5c6ddd4f420cfc51b81bcc5b4ac586892a43198008d81f1575a2a0ea61822
7
+ data.tar.gz: ae300e9cabda3974a9b41b07e5a3698509476c1a593edef09176df5eeaf6405a7d22f6219df6835b5455a0bed46374ca73547443271869f4010770bdee249f44
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dxlite.rb CHANGED
@@ -82,7 +82,7 @@ class DxLite
82
82
 
83
83
  end
84
84
 
85
- def create(rawh, id: nil, custom_attributes: {created: Time.now})
85
+ def create(rawh, id: nil, custom_attributes: {created: Time.now.to_s})
86
86
 
87
87
  if @debug then
88
88
  puts 'create:: rawh: ' + rawh.inspect
@@ -94,8 +94,16 @@ class DxLite
94
94
  if key then
95
95
 
96
96
  r = records.find {|x| x[:body][key.to_sym] == rawh[key.to_sym]}
97
+
97
98
  if r then
99
+
100
+ # if the client is using create() instead of update() to update a
101
+ # record then update the record
102
+ #
103
+ r[:body].merge!(rawh)
98
104
  r[:last_modified] = Time.now.to_s
105
+ save() if @autosave
106
+
99
107
  return false
100
108
  end
101
109
 
@@ -225,13 +233,39 @@ class DxLite
225
233
  record_name = schema()[/(?<=\/)[^\(]+/]
226
234
 
227
235
  records = @records.map {|h| {record_name.to_sym => h} }
228
- records.reverse! if @summary[:order] == 'descending'
236
+
237
+ a = if @summary[:order] == 'descending' then
238
+
239
+ records.sort_by do |x|
240
+
241
+ if @debug then
242
+ puts 'x: ' + x.inspect
243
+ puts 'created: ' + Date.parse(x[:post][:created]).inspect
244
+ end
245
+
246
+ created = DateTime.parse(x[:post][:created])
247
+
248
+ last_modified = if x[:post][:last_modified] then
249
+ DateTime.parse(x[:post][:last_modified])
250
+ else
251
+ nil
252
+ end
253
+
254
+ last_modified || created
255
+
256
+ end.reverse
257
+
258
+ else
259
+
260
+ records
261
+
262
+ end
229
263
 
230
264
  h = {
231
265
  root_name.to_sym =>
232
266
  {
233
267
  summary: @summary,
234
- records: records
268
+ records: a
235
269
  }
236
270
  }
237
271
 
@@ -285,6 +319,7 @@ class DxLite
285
319
  if r then
286
320
 
287
321
  r[:body].merge!(obj)
322
+ r[:last_modified] = Time.now.to_s
288
323
  save() if @autosave
289
324
 
290
325
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  9pK+pqislEMFrWscGeMsc6YMS7ALxEujTuwTWyxmWAXnYft4ff2O1Zh2sPmdOlgf
36
36
  camg7d8q+VZZzAtz0cFc4pip
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-19 00:00:00.000000000 Z
38
+ date: 2022-04-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: recordx
metadata.gz.sig CHANGED
Binary file