dynarex 1.0.12 → 1.0.13
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.
- data/lib/dynarex.rb +8 -4
- metadata +2 -2
data/lib/dynarex.rb
CHANGED
@@ -6,8 +6,8 @@ require 'nokogiri'
|
|
6
6
|
require 'open-uri'
|
7
7
|
require 'ostruct'
|
8
8
|
require 'dynarex-import'
|
9
|
-
require 'rexle'
|
10
9
|
require 'line-tree'
|
10
|
+
require 'rexle'
|
11
11
|
|
12
12
|
class Dynarex
|
13
13
|
|
@@ -231,14 +231,17 @@ EOF
|
|
231
231
|
|
232
232
|
def update(id, params={})
|
233
233
|
fields = capture_fields(params)
|
234
|
-
|
234
|
+
|
235
|
+
|
235
236
|
# for each field update each record field
|
236
237
|
record = @doc.element("records/#{@record_name}[@id='#{id.to_s}']")
|
237
238
|
fields.each {|k,v| record.element(k.to_s).text = v if v}
|
238
239
|
record.add_attribute(last_modified: Time.now.to_s)
|
239
240
|
|
240
241
|
load_records
|
242
|
+
|
241
243
|
self
|
244
|
+
|
242
245
|
end
|
243
246
|
|
244
247
|
#Delete a record.
|
@@ -303,7 +306,7 @@ EOF
|
|
303
306
|
end
|
304
307
|
|
305
308
|
attributes = {id: id, created: Time.now.to_s, last_modified: nil}
|
306
|
-
attributes.each {|k,v| record.add_attribute(k
|
309
|
+
attributes.each {|k,v| record.add_attribute(k, v)}
|
307
310
|
|
308
311
|
@doc.element('records').add record
|
309
312
|
|
@@ -446,10 +449,11 @@ end))
|
|
446
449
|
else
|
447
450
|
i += 1; id = i.to_s
|
448
451
|
end
|
452
|
+
|
449
453
|
created = row.attributes[:created] if row.attributes[:created]
|
450
454
|
last_modified = row.attributes[:last_modified] if row.attributes[:last_modified]
|
451
455
|
body = row.xpath('*').inject({}) do |r,node|
|
452
|
-
r.merge node.name.to_sym => node.text
|
456
|
+
r.merge node.name.to_sym => node.text.unescape
|
453
457
|
end
|
454
458
|
|
455
459
|
result.merge body[@default_key.to_sym] => {id: id, created: created, last_modified: last_modified, body: body}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors: []
|
7
7
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2011-02-
|
12
|
+
date: 2011-02-10 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|