Class: ActiveBugzilla::Field
Constant Summary collapse
- KNOWN_TIMESTAMPS =
%w(creation_time last_change_time)
- FIELD_ALIASES =
List of field aliases. Maps old style RHBZ parameter names to actual upstream values. Used for createbug() and query include_fields at least.
{ # old => current 'short_desc' => 'summary', 'comment' => 'description', 'rep_platform' => 'platform', 'bug_severity' => 'severity', 'bug_status' => 'status', 'bug_id' => 'id', 'blockedby' => 'blocks', 'blocked' => 'blocks', 'dependson' => 'depends_on', 'reporter' => 'creator', 'bug_file_loc' => 'url', 'dupe_id' => 'dupe_of', 'dup_id' => 'dupe_of', 'longdescs' => 'comments', 'opendate' => 'creation_time', 'creation_ts' => 'creation_time', 'status_whiteboard' => 'whiteboard', 'delta_ts' => 'last_change_time', }
Instance Attribute Summary collapse
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_custom ⇒ Object
(also: #custom?)
readonly
Returns the value of attribute is_custom.
-
#is_mandatory ⇒ Object
(also: #mandatory?)
readonly
Returns the value of attribute is_mandatory.
-
#is_on_bug_entry ⇒ Object
(also: #on_bug_entry?)
readonly
Returns the value of attribute is_on_bug_entry.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#original_name ⇒ Object
readonly
Returns the value of attribute original_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
-
#visibility_field ⇒ Object
readonly
Returns the value of attribute visibility_field.
-
#visibility_values ⇒ Object
readonly
Returns the value of attribute visibility_values.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Field
constructor
A new instance of Field.
- #timestamp? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(attributes = {}) ⇒ Field
Returns a new instance of Field.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/active_bugzilla/field.rb', line 36 def initialize(attributes = {}) @display_name = attributes["display_name"] @id = attributes["id"] @name = self.class.field_alias(attributes["name"]) @original_name = attributes["name"] @type = attributes["type"] @values = attributes["values"] @visibility_field = attributes["visibility_field"] @visibility_values = attributes["visibility_values"] @is_custom = attributes["is_custom"] @is_mandatory = attributes["is_mandatory"] @is_on_bug_entry = attributes["is_on_bug_entry"] end |
Instance Attribute Details
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def display_name @display_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def id @id end |
#is_custom ⇒ Object (readonly) Also known as: custom?
Returns the value of attribute is_custom.
4 5 6 |
# File 'lib/active_bugzilla/field.rb', line 4 def is_custom @is_custom end |
#is_mandatory ⇒ Object (readonly) Also known as: mandatory?
Returns the value of attribute is_mandatory.
4 5 6 |
# File 'lib/active_bugzilla/field.rb', line 4 def is_mandatory @is_mandatory end |
#is_on_bug_entry ⇒ Object (readonly) Also known as: on_bug_entry?
Returns the value of attribute is_on_bug_entry.
4 5 6 |
# File 'lib/active_bugzilla/field.rb', line 4 def is_on_bug_entry @is_on_bug_entry end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def name @name end |
#original_name ⇒ Object (readonly)
Returns the value of attribute original_name.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def original_name @original_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def type @type end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def values @values end |
#visibility_field ⇒ Object (readonly)
Returns the value of attribute visibility_field.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def visibility_field @visibility_field end |
#visibility_values ⇒ Object (readonly)
Returns the value of attribute visibility_values.
3 4 5 |
# File 'lib/active_bugzilla/field.rb', line 3 def visibility_values @visibility_values end |
Class Method Details
.instantiate_from_raw_data(data) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/active_bugzilla/field.rb', line 54 def self.instantiate_from_raw_data(data) data.delete_if { |hash| hash["name"] == "longdesc" } # Another way to specify comment[0] data.delete_if { |hash| hash["name"].include?(".") } # Remove things like longdescs.count data.collect do |field_hash| new(field_hash) end end |
Instance Method Details
#timestamp? ⇒ Boolean
50 51 52 |
# File 'lib/active_bugzilla/field.rb', line 50 def (type == 5) || KNOWN_TIMESTAMPS.include?(name) end |