Class: AMEE::Admin::ItemDefinitionList

Inherits:
Collection
  • Object
show all
Defined in:
lib/amee/item_definition.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, #initialize, #parse_page, #v3

Methods included from ParseHelper

#load_xml_doc, #node_value, #xmlpathpreamble

Constructor Details

This class inherits a constructor from AMEE::Collection

Instance Method Details

#collectionpathObject



8
9
10
# File 'lib/amee/item_definition.rb', line 8

def collectionpath
  '/definitions/itemDefinitions'
end

#jsoncollectorObject



14
15
16
# File 'lib/amee/item_definition.rb', line 14

def jsoncollector
  @doc['itemDefinitions']
end

#klassObject



11
12
13
# File 'lib/amee/item_definition.rb', line 11

def klass
  ItemDefinition
end

#parse_json(p) ⇒ Object



21
22
23
24
25
26
# File 'lib/amee/item_definition.rb', line 21

def parse_json(p)
  data = {}
  data[:uid] = p['uid']
  data[:name] = p['name']
  data
end

#parse_xml(p) ⇒ Object



27
28
29
30
31
32
# File 'lib/amee/item_definition.rb', line 27

def parse_xml(p)
  data = {}
  data[:uid] = x '@uid',:doc=>p
  data[:name] = x('Name',:doc=>p) || data[:uid]
  data
end

#xmlcollectorpathObject



17
18
19
# File 'lib/amee/item_definition.rb', line 17

def xmlcollectorpath
  '/Resources/ItemDefinitionsResource/ItemDefinitions/ItemDefinition'
end