Class: AMEE::Admin::ItemValueDefinitionList
Instance Attribute Summary
Attributes inherited from Collection
#connection, #doc, #json, #pager, #response
Instance Method Summary
collapse
Methods inherited from Collection
#each_page, #fetch, #parse_page
#xmlpathpreamble
Constructor Details
TODO this class does not yet page through multiple pages
6
7
8
9
|
# File 'lib/amee/item_value_definition.rb', line 6
def initialize(connection,uid,options={})
@uid=uid
super(connection,options)
end
|
Instance Method Details
#collectionpath ⇒ Object
13
14
15
|
# File 'lib/amee/item_value_definition.rb', line 13
def collectionpath
"/definitions/itemDefinitions/#{@uid}/itemValueDefinitions"
end
|
#jsoncollector ⇒ Object
17
18
19
|
# File 'lib/amee/item_value_definition.rb', line 17
def jsoncollector
@doc['itemValueDefinitions']
end
|
#parse_json(p) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/amee/item_value_definition.rb', line 24
def parse_json(p)
data = {}
data[:itemdefuid] = @uid
data[:uid] = p['uid']
data[:name] = p['name']
data[:path] = p['path']
data[:unit] = p['unit']
data[:perunit] = p['perunit']
data[:valuetype] = p['valueDefinition']['valueType']
data[:drill]=p['drillDown']
data[:from_profile]=p['fromProfile']
data[:from_data]=p['fromData']
data
end
|
#parse_xml(p) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/amee/item_value_definition.rb', line 38
def parse_xml(p)
data = {}
data[:itemdefuid] = @uid
data[:uid] = x '@uid',:doc => p
data[:name] = x 'Name',:doc => p || data[:uid]
data[:path] = x 'Path',:doc => p
data[:unit] = x 'Unit',:doc => p
data[:perunit] = x 'PerUnit',:doc => p
data[:valuetype] =x 'ValueDefinition/ValueType',:doc => p
data[:drill]=(x('DrillDown',:doc => p)=='true')
data[:from_profile]=(x('FromProfile',:doc => p)=='true')
data[:from_data]=(x('FromData',:doc => p)=='true')
data
end
|
#xmlcollectorpath ⇒ Object
20
21
22
|
# File 'lib/amee/item_value_definition.rb', line 20
def xmlcollectorpath
'/Resources/ItemValueDefinitionsResource/ItemValueDefinitions/ItemValueDefinition'
end
|