Class: JIRA::Entity Abstract
- Inherits:
-
Object
- Object
- JIRA::Entity
- Defined in:
- lib/jiraSOAP/entities/entity.rb
Overview
This class is abstract.
The base class for all JIRA objects that can given by the server.
Direct Known Subclasses
DynamicEntity, Permission, PermissionMapping, ServerConfiguration, ServerInfo, TimeInfo, UserName
Class Attribute Summary collapse
-
.parse ⇒ Hash{String=>Array<Symbol,Symbol,Class*>}
Used by the metaclass for parsing XML.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.parse ⇒ Hash{String=>Array<Symbol,Symbol,Class*>}
Returns used by the metaclass for parsing XML.
8 9 10 |
# File 'lib/jiraSOAP/entities/entity.rb', line 8 def parse @parse end |
Class Method Details
.add_attributes(*attributes) ⇒ nil
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jiraSOAP/entities/entity.rb', line 12 def add_attributes *attributes superclass = ancestors[1] @parse = superclass.parse.dup attributes.each { |attribute| attr_accessor attribute[1] @parse[attribute[0]] = [:"#{attribute[1]}=", *attribute[2,2]] alias_method :"#{attribute[1]}?", attribute[1] if attribute[2] == :to_boolean #" ruby-mode parse fail } end |
.new_with_xml(frag) ⇒ JIRA::Entity
30 31 32 33 34 |
# File 'lib/jiraSOAP/entities/entity.rb', line 30 def self.new_with_xml frag entity = allocate entity.initialize_with_xml frag entity end |
Instance Method Details
#initialize_with_xml(frag) ⇒ Object
TODO:
put debug message through the logger
TODO:
make this faster by cutting out NokogiriDriver, but I will need to add an accessor for @element of the driver object and then need to inject the marshaling methods into Nokogiri classes
42 43 44 45 46 47 48 49 |
# File 'lib/jiraSOAP/entities/entity.rb', line 42 def initialize_with_xml frag attributes = self.class.parse frag.children.each { |node| action = attributes[node.node_name] self.send action[0], (node.send *action[1..-1]) if action #puts "Action is #{action.inspect} for #{node.node_name}" } end |
#to_soap(node_name = nil) ⇒ Object
TODO:
soapify_for should become #to_soap and should take only the
optional argument for wrapper name, otherwise just makes its own own node with appropriate subnodes and returns that as a Handsoap document
55 56 57 |
# File 'lib/jiraSOAP/entities/entity.rb', line 55 def to_soap node_name = nil raise NotImplementedError end |