amee 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/amee/exceptions.rb +4 -0
- data/lib/amee/item_value_definition.rb +28 -23
- data/lib/amee/version.rb +2 -2
- metadata +5 -5
data/CHANGELOG
CHANGED
data/lib/amee/exceptions.rb
CHANGED
@@ -30,8 +30,10 @@ module AMEE
|
|
30
30
|
data[:unit] = p['unit']
|
31
31
|
data[:perunit] = p['perunit']
|
32
32
|
data[:valuetype] = p['valueDefinition']['valueType']
|
33
|
-
data=
|
34
|
-
|
33
|
+
data[:drill]=p['drillDown']
|
34
|
+
data[:from_profile]=p['fromProfile']
|
35
|
+
data[:from_data]=p['fromData']
|
36
|
+
data
|
35
37
|
end
|
36
38
|
def parse_xml(p)
|
37
39
|
data = {}
|
@@ -42,11 +44,10 @@ module AMEE
|
|
42
44
|
data[:unit] = x 'Unit',:doc => p
|
43
45
|
data[:perunit] = x 'PerUnit',:doc => p
|
44
46
|
data[:valuetype] =x 'ValueDefinition/ValueType',:doc => p
|
45
|
-
drill=(x('DrillDown',:doc => p)=='true')
|
46
|
-
|
47
|
-
|
48
|
-
data
|
49
|
-
|
47
|
+
data[:drill]=(x('DrillDown',:doc => p)=='true')
|
48
|
+
data[:from_profile]=(x('FromProfile',:doc => p)=='true')
|
49
|
+
data[:from_data]=(x('FromData',:doc => p)=='true')
|
50
|
+
data
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -57,28 +58,35 @@ module AMEE
|
|
57
58
|
@name = data[:name]
|
58
59
|
@uid = data[:uid]
|
59
60
|
@path = data[:path]
|
60
|
-
@type = data[:type]
|
61
61
|
@unit = data[:unit]
|
62
62
|
@perunit = data[:perunit]
|
63
63
|
@valuetype = data[:valuetype]
|
64
64
|
@default = data[:default] == "" ? nil : data[:default]
|
65
65
|
@choices = data[:choices] || []
|
66
66
|
@versions = data[:versions] || []
|
67
|
+
@drill = data[:drill]
|
68
|
+
@from_data = @drill ? false : data[:from_data] # Drills are also data, but we don't want them to show as such for clarity
|
69
|
+
@from_profile = data[:from_profile]
|
67
70
|
super
|
68
71
|
end
|
69
72
|
|
70
|
-
attr_reader :name,:uid,:path,:itemdefuid, :type, :valuetype, :unit, :perunit, :
|
73
|
+
attr_reader :name,:uid,:path,:itemdefuid, :type, :valuetype, :unit, :perunit, :default, :choices, :versions
|
74
|
+
|
75
|
+
# This function has bee deprecated in favour of the separate profile? data? and drill? functions
|
76
|
+
def type
|
77
|
+
raise AMEE::Deprecated
|
78
|
+
end
|
71
79
|
|
72
80
|
def profile?
|
73
|
-
|
81
|
+
@from_profile
|
74
82
|
end
|
75
83
|
|
76
84
|
def data?
|
77
|
-
|
85
|
+
@from_data
|
78
86
|
end
|
79
87
|
|
80
88
|
def drill?
|
81
|
-
|
89
|
+
@drill
|
82
90
|
end
|
83
91
|
|
84
92
|
def self.list(connection)
|
@@ -115,19 +123,17 @@ module AMEE
|
|
115
123
|
data[:default] = p['value']
|
116
124
|
data[:choices] = p['choices'].split(',')
|
117
125
|
data[:versions] = p['apiVersions'].map{|v| v['apiVersion']}
|
118
|
-
data=
|
126
|
+
data[:drill]=p['drillDown']
|
127
|
+
data[:from_profile]=p['fromProfile']
|
128
|
+
data[:from_data]=p['fromData']
|
119
129
|
# Create object
|
120
130
|
ItemValueDefinition.new(data)
|
121
131
|
rescue
|
122
132
|
raise AMEE::BadData.new("Couldn't load ItemValueDefinition from JSON. Check that your URL is correct.\n#{json}")
|
123
133
|
end
|
124
134
|
|
125
|
-
def self.
|
126
|
-
|
127
|
-
data[:type]='profile' if profile
|
128
|
-
data[:type]='data' if ldata
|
129
|
-
data[:type]='drill' if drill
|
130
|
-
data
|
135
|
+
def self.xmlpathpreamble
|
136
|
+
"/Resources//ItemValueDefinition/"
|
131
137
|
end
|
132
138
|
|
133
139
|
def self.from_xml(xml, is_list = true)
|
@@ -149,10 +155,9 @@ module AMEE
|
|
149
155
|
data[:default] = REXML::XPath.first(doc, prefix + "ItemValueDefinition/Value").text
|
150
156
|
data[:choices] = REXML::XPath.first(doc, prefix + "ItemValueDefinition/Choices").text.split(',') rescue nil
|
151
157
|
data[:versions] = REXML::XPath.each(doc, prefix + "ItemValueDefinition/APIVersions/APIVersion").map{|v| v.text}
|
152
|
-
drill=(
|
153
|
-
|
154
|
-
|
155
|
-
data=parsetype(data,drill,profile,ldata)
|
158
|
+
data[:drill]=(x('DrillDown',:doc => doc)=='true')
|
159
|
+
data[:from_profile]=(x('FromProfile',:doc => doc)=='true')
|
160
|
+
data[:from_data]=(x('FromData',:doc => doc)=='true')
|
156
161
|
# Create object
|
157
162
|
ItemValueDefinition.new(data)
|
158
163
|
rescue
|
data/lib/amee/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 2.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-23 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|