dynarex 0.2.8 → 0.3.0

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.
Files changed (2) hide show
  1. data/lib/dynarex.rb +9 -5
  2. metadata +1 -1
@@ -44,8 +44,9 @@ class Dynarex
44
44
  end
45
45
  xml.records do
46
46
  @records.each do |k, item|
47
- xml.send(@item_name, id: item[:id], timestamp: item[:timestamp]) do
48
- item[:body].each{|name,value| xml.send name, value}
47
+ xml.send(@item_name, id: item[:id], created: item[:created], \
48
+ last_modified: item[:last_modified]) do
49
+ item[:body].each{|name,value| xml.send name, value}
49
50
  end
50
51
  end
51
52
  end
@@ -76,14 +77,17 @@ class Dynarex
76
77
 
77
78
  def records_to_h(default_key)
78
79
  ah = XPath.match(@doc.root, 'records/*').each_with_index.map do |row,i|
79
- timestamp = Time.now.to_s; id = Time.now.strftime("%Y%m%I%H%M%S") + i.to_s
80
+ created = Time.now.to_s; id = Time.now.strftime("%Y%m%I%H%M%S") + i.to_s
81
+ last_modified = ''
80
82
  id = row.attribute('id').value.to_s if row.attribute('id')
81
- timestamp = row.attribute('timestamp').value.to_s if row.attribute('timestamp')
83
+ created = row.attribute('created').value.to_s if row.attribute('created')
84
+ last_modified = row.attribute('last_modified').value.to_s if row.attribute('last_modified')
82
85
  body = XPath.match(row, '*').inject({}) do |r,node|
83
86
  r[node.name.to_s.to_sym] = node.text.to_s
84
87
  r
85
88
  end
86
- [body[default_key.to_sym],{id: id, timestamp: timestamp, body: body}]
89
+ [body[default_key.to_sym],{id: id, created: created, last_modified: \
90
+ last_modified, body: body}]
87
91
  end
88
92
  Hash[*ah.flatten]
89
93
  end
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: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors: []
7
7