amee 2.0.27 → 2.0.28
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/amee/data_item.rb +6 -0
- metadata +1 -1
data/lib/amee/data_item.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
1
3
|
module AMEE
|
2
4
|
module Data
|
3
5
|
class Item < AMEE::Data::Object
|
@@ -9,6 +11,7 @@ module AMEE
|
|
9
11
|
@item_definition = data[:item_definition]
|
10
12
|
@total_amount = data[:total_amount]
|
11
13
|
@total_amount_unit = data[:total_amount_unit]
|
14
|
+
@start_date = data[:start_date]
|
12
15
|
super
|
13
16
|
end
|
14
17
|
|
@@ -18,6 +21,7 @@ module AMEE
|
|
18
21
|
attr_reader :item_definition
|
19
22
|
attr_reader :total_amount
|
20
23
|
attr_reader :total_amount_unit
|
24
|
+
attr_reader :start_date
|
21
25
|
|
22
26
|
def self.from_json(json)
|
23
27
|
# Read JSON
|
@@ -57,6 +61,7 @@ module AMEE
|
|
57
61
|
choice_data[:value] = choice['value']
|
58
62
|
data[:choices] << choice_data
|
59
63
|
end
|
64
|
+
data[:start_date] = DateTime.parse(doc['dataItem']['startDate'])
|
60
65
|
# Create object
|
61
66
|
Item.new(data)
|
62
67
|
rescue
|
@@ -101,6 +106,7 @@ module AMEE
|
|
101
106
|
choice_data[:value] = (choice.elements['Value']).text || ""
|
102
107
|
data[:choices] << choice_data
|
103
108
|
end
|
109
|
+
data[:start_date] = DateTime.parse(REXML::XPath.first(doc, "/Resources/DataItemResource/DataItem/StartDate").text)
|
104
110
|
# Create object
|
105
111
|
Item.new(data)
|
106
112
|
rescue
|