Class: KeytechKit::Element
- Inherits:
-
Object
- Object
- KeytechKit::Element
- Defined in:
- lib/keytechKit/elements/element.rb
Overview
Represents a single element
Instance Attribute Summary collapse
-
#changedAt ⇒ Object
Returns the value of attribute changedAt.
-
#changedBy ⇒ Object
Returns the value of attribute changedBy.
-
#changedByLong ⇒ Object
Returns the value of attribute changedByLong.
-
#classDisplayName ⇒ Object
Returns the value of attribute classDisplayName.
-
#createdAt ⇒ Object
Returns the value of attribute createdAt.
-
#createdBy ⇒ Object
Returns the value of attribute createdBy.
-
#createdByLong ⇒ Object
Returns the value of attribute createdByLong.
-
#description ⇒ Object
Returns the value of attribute description.
-
#displayname ⇒ Object
localized DisplayName.
-
#hasVersions ⇒ Object
Returns the value of attribute hasVersions.
-
#key ⇒ Object
unique key of this element.
-
#keyValueList ⇒ Object
a array of value: pairs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#thumbnailHint ⇒ Object
Returns the value of attribute thumbnailHint.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(data) ⇒ Element
constructor
A new instance of Element.
-
#keytechKeyValueObject ⇒ Object
This is keytech - Style: key and value in different elements- No easy parsable hash! Sorry it was me.
- #to_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ Element
Returns a new instance of Element.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/keytechKit/elements/element.rb', line 28 def initialize(data) @key = data['Key'] @name = data['Name'] set_key_value_list(data['KeyValueList']) @classDisplayName = data['ClassDisplayName'] @version = data['Version'] @status = data['Status'] @description = data['Description'] @changedBy = data['ChangedBy'] @changedByLong = data['ChangedByLong'] @changedAt = data['ChangedAt'] @createdBy = data['CreatedBy'] @createdByLong = data['CreatedByLong'] @createdAt = data['CreatedAt'] @thumbnailHint = data['ThumbnailHint'] @hasVersions = data['HasVersions'] class_key = Tools.class_key(@key) project_classes = %w[TASK_WF MAIL_WF] @displayname = if project_classes.include?(class_key) data['Subject'] else data['DisplayName'] end end |
Instance Attribute Details
#changedAt ⇒ Object
Returns the value of attribute changedAt.
16 17 18 |
# File 'lib/keytechKit/elements/element.rb', line 16 def changedAt @changedAt end |
#changedBy ⇒ Object
Returns the value of attribute changedBy.
18 19 20 |
# File 'lib/keytechKit/elements/element.rb', line 18 def changedBy @changedBy end |
#changedByLong ⇒ Object
Returns the value of attribute changedByLong.
17 18 19 |
# File 'lib/keytechKit/elements/element.rb', line 17 def changedByLong @changedByLong end |
#classDisplayName ⇒ Object
Returns the value of attribute classDisplayName.
23 24 25 |
# File 'lib/keytechKit/elements/element.rb', line 23 def classDisplayName @classDisplayName end |
#createdAt ⇒ Object
Returns the value of attribute createdAt.
14 15 16 |
# File 'lib/keytechKit/elements/element.rb', line 14 def createdAt @createdAt end |
#createdBy ⇒ Object
Returns the value of attribute createdBy.
13 14 15 |
# File 'lib/keytechKit/elements/element.rb', line 13 def createdBy @createdBy end |
#createdByLong ⇒ Object
Returns the value of attribute createdByLong.
12 13 14 |
# File 'lib/keytechKit/elements/element.rb', line 12 def createdByLong @createdByLong end |
#description ⇒ Object
Returns the value of attribute description.
26 27 28 |
# File 'lib/keytechKit/elements/element.rb', line 26 def description @description end |
#displayname ⇒ Object
localized DisplayName
20 21 22 |
# File 'lib/keytechKit/elements/element.rb', line 20 def displayname @displayname end |
#hasVersions ⇒ Object
Returns the value of attribute hasVersions.
22 23 24 |
# File 'lib/keytechKit/elements/element.rb', line 22 def hasVersions @hasVersions end |
#key ⇒ Object
unique key of this element
6 7 8 |
# File 'lib/keytechKit/elements/element.rb', line 6 def key @key end |
#keyValueList ⇒ Object
a array of value: pairs
10 11 12 |
# File 'lib/keytechKit/elements/element.rb', line 10 def keyValueList @keyValueList end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/keytechKit/elements/element.rb', line 7 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
24 25 26 |
# File 'lib/keytechKit/elements/element.rb', line 24 def status @status end |
#thumbnailHint ⇒ Object
Returns the value of attribute thumbnailHint.
21 22 23 |
# File 'lib/keytechKit/elements/element.rb', line 21 def thumbnailHint @thumbnailHint end |
#version ⇒ Object
Returns the value of attribute version.
25 26 27 |
# File 'lib/keytechKit/elements/element.rb', line 25 def version @version end |
Instance Method Details
#keytechKeyValueObject ⇒ Object
This is keytech - Style: key and value in different elements- No easy parsable hash! Sorry it was me. I was young and needed the money ;-)
{
"Key": "au_do__categorylocalized",
"Value": "Blaue Kategorie"
}
70 71 72 73 74 75 76 |
# File 'lib/keytechKit/elements/element.rb', line 70 def keytechKeyValueObject arrayOfKeyValuePairs = [] keyValueList.each do |key, value| arrayOfKeyValuePairs.push ({ Key: key, Value: value }) end arrayOfKeyValuePairs end |
#to_hash ⇒ Object
59 60 61 |
# File 'lib/keytechKit/elements/element.rb', line 59 def to_hash { Key: key, Name: name, keyValueList: keytechKeyValueObject } end |