amee 2.0.27 → 2.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/amee/data_item.rb +6 -0
  2. metadata +1 -1
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.27
4
+ version: 2.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith