Class: AMEE::Admin::ItemValueDefinitionList
- Inherits:
-
Collection
- Object
- Array
- Collection
- AMEE::Admin::ItemValueDefinitionList
show all
- Defined in:
- lib/amee/item_value_definition.rb,
lib/amee/v3/item_value_definition_list.rb
Instance Attribute Summary
Attributes inherited from Collection
#connection, #doc, #json, #pager, #response
Instance Method Summary
collapse
Methods inherited from Collection
#each_page, #each_page_without_v3, #fetch, #fetch_without_v3, #parse_page, #v3
#load_xml_doc, #node_value, #xmlpathpreamble
Constructor Details
#initialize(connection, uid, options = {}, &block) ⇒ ItemValueDefinitionList
TODO this class does not yet page through multiple pages
9
10
11
12
|
# File 'lib/amee/item_value_definition.rb', line 9
def initialize(connection,uid,options={})
@uid=uid
super(connection,options)
end
|
Instance Method Details
#collectionpath ⇒ Object
16
17
18
|
# File 'lib/amee/item_value_definition.rb', line 16
def collectionpath
"/definitions/itemDefinitions/#{@uid}/itemValueDefinitions"
end
|
TODO this class does not yet page through multiple pages
9
10
11
12
|
# File 'lib/amee/v3/item_value_definition_list.rb', line 9
def initialize(connection,uid,options={})
@uid=uid
super(connection,options)
end
|
#jsoncollector ⇒ Object
20
21
22
|
# File 'lib/amee/item_value_definition.rb', line 20
def jsoncollector
@doc['itemValueDefinitions']
end
|
#parse_json(p) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/amee/item_value_definition.rb', line 27
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/amee/item_value_definition.rb', line 41
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
23
24
25
|
# File 'lib/amee/item_value_definition.rb', line 23
def xmlcollectorpath
'/Resources/ItemValueDefinitionsResource/ItemValueDefinitions/ItemValueDefinition'
end
|