Class: JIRA::Entity Abstract
- Inherits:
-
Object
- Object
- JIRA::Entity
- Defined in:
- lib/jiraSOAP/entities/entity.rb
Overview
The base class for all JIRA objects that can given by the server.
Direct Known Subclasses
DynamicEntity, Permission, PermissionMapping, ServerConfiguration, ServerInfo, TimeInfo, UserGroup, UserName
Class Attribute Summary collapse
-
.parse ⇒ Hash{String=>Array(Symbol,Symbol,Class*)}
Used for parsing XML.
Class Method Summary collapse
-
.add_attribute(name, jira_name, transformer) ⇒ nil
Define a single instance attribute on the class including the specification on how to parse the XML output and how to build SOAP messages.
-
.inherited(subclass) ⇒ Object
Define the callback to automatically initialize the build and parse tables when any subclass is defined.
- .new_with_xml(frag) ⇒ JIRA::Entity
Instance Method Summary collapse
Class Attribute Details
.parse ⇒ Hash{String=>Array(Symbol,Symbol,Class*)}
Used for parsing XML
11 12 13 |
# File 'lib/jiraSOAP/entities/entity.rb', line 11 def parse @parse end |
Class Method Details
.add_attribute(name, jira_name, transformer) ⇒ nil
Add a way to signify if an attribute should not be used in message building, as some attributes should never be included in a SOAP message.
Define a single instance attribute on the class including the specification on how to parse the XML output and how to build SOAP messages.
Predicate methods will automatically be created if the transformer
method is :to_boolean
.
39 40 41 42 43 |
# File 'lib/jiraSOAP/entities/entity.rb', line 39 def add_attribute name, jira_name, transformer attr_accessor name alias_method "#{name}?", name if transformer == :to_boolean @parse[jira_name] = [:"#{name}=", *transformer] end |
.inherited(subclass) ⇒ Object
Define the callback to automatically initialize the build and parse tables when any subclass is defined.
16 17 18 |
# File 'lib/jiraSOAP/entities/entity.rb', line 16 def inherited subclass subclass.parse = @parse.dup end |
.new_with_xml(frag) ⇒ JIRA::Entity
51 52 53 54 55 |
# File 'lib/jiraSOAP/entities/entity.rb', line 51 def self.new_with_xml frag entity = allocate entity.initialize_with_xml frag entity end |
Instance Method Details
#initialize_with_xml(element) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/jiraSOAP/entities/entity.rb', line 58 def initialize_with_xml element attributes = self.class.parse element.children.each { |node| action = attributes[node.name] self.send action[0], (node.send *action[1..-1]) if action #puts "Action is #{action.inspect} for #{node.node_name}" } end |