Class: Sambot::Slack::WorkItem

Inherits:
Object
  • Object
show all
Defined in:
lib/sambot/slack/work_item.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s_object) ⇒ WorkItem

Returns a new instance of WorkItem.



7
8
9
# File 'lib/sambot/slack/work_item.rb', line 7

def initialize(s_object)
  @s_object = s_object
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/sambot/slack/work_item.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/sambot/slack/work_item.rb', line 5

def name
  @name
end

#product_tagObject (readonly)

Returns the value of attribute product_tag.



5
6
7
# File 'lib/sambot/slack/work_item.rb', line 5

def product_tag
  @product_tag
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/sambot/slack/work_item.rb', line 5

def status
  @status
end

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/sambot/slack/work_item.rb', line 5

def subject
  @subject
end

Class Method Details

.find_by_product_tag(client, val) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/sambot/slack/work_item.rb', line 68

def self.find_by_product_tag(client, val)
  product_tag = ProductTag.find(client, val)
  query = "SELECT
            Id,
            Name,
            Status__c,
            Product_Tag__c,
            Subject__c,
            Priority__c,
            Product_Owner__c,
            QA_Engineer__c,
            Help_Status__c,
            Assignee__r.Name,
            Assigned_On__c,
            LastActivityDate,
            CreatedById,
            CreatedDate,
            RecordTypeId,
            OwnerId,
            IsDeleted,
            Description__c,
            Story_Points__c,
            Closed_By__c,
            Product_Tag_Name__c,
            Epic__c,
            Resolution__c,
            Column_Rank__c,
            Column__r.Name,
            WorkId_and_Subject__c
           FROM ADM_Work__c \
           WHERE Product_Tag__c = '#{product_tag.id}' AND (Status__c = 'New' OR Status__c = 'In Progress')"
  results = client.query(query)
  results.map {|x| WorkItem.new(x) }.sort_by {|x| [x.column_order, x.column_rank]}
end

Instance Method Details

#assigned_onObject



31
# File 'lib/sambot/slack/work_item.rb', line 31

def assigned_on; @s_object.Assigned_On__c; end

#assigneeObject



29
# File 'lib/sambot/slack/work_item.rb', line 29

def assignee; @s_object.Assignee__r.Name; end

#closed_byObject



49
# File 'lib/sambot/slack/work_item.rb', line 49

def closed_by; @s_object.Closed_By__c; end

#columnObject



59
# File 'lib/sambot/slack/work_item.rb', line 59

def column; @s_object.Column__r ? @s_object.Column__r.Name : ''; end

#column_orderObject



61
62
63
64
# File 'lib/sambot/slack/work_item.rb', line 61

def column_order
  puts Formatter::COLUMNS[column.to_sym] ? Formatter::COLUMNS[column.to_sym][:order] : 100
  column && Formatter::COLUMNS[column.to_sym] ? Formatter::COLUMNS[column.to_sym][:order] : 100
end

#column_rankObject



57
# File 'lib/sambot/slack/work_item.rb', line 57

def column_rank; @s_object.Column_Rank__c || 0; end

#created_by_idObject



35
# File 'lib/sambot/slack/work_item.rb', line 35

def created_by_id; @s_object.CreatedById; end

#created_dateObject



37
# File 'lib/sambot/slack/work_item.rb', line 37

def created_date; @s_object.CreatedDate; end

#deleted?Boolean

Returns:

  • (Boolean)


43
# File 'lib/sambot/slack/work_item.rb', line 43

def deleted?; @s_object.IsDeleted; end

#descriptionObject



45
# File 'lib/sambot/slack/work_item.rb', line 45

def description; @s_object.Product_Owner__c; end

#epicObject



53
# File 'lib/sambot/slack/work_item.rb', line 53

def epic; @s_object.Epic__c; end

#help_statusObject



27
# File 'lib/sambot/slack/work_item.rb', line 27

def help_status; @s_object.Help_Status__c; end

#id_and_subjectObject



66
# File 'lib/sambot/slack/work_item.rb', line 66

def id_and_subject; @s_object.WorkId_and_Subject__c; end

#last_activity_dateObject



33
# File 'lib/sambot/slack/work_item.rb', line 33

def last_activity_date; @s_object.LastActivityDate; end

#owner_idObject



41
# File 'lib/sambot/slack/work_item.rb', line 41

def owner_id; @s_object.OwnerId; end

#priorityObject



21
# File 'lib/sambot/slack/work_item.rb', line 21

def priority; @s_object.Priority__c; end

#product_ownerObject



23
# File 'lib/sambot/slack/work_item.rb', line 23

def product_owner; @s_object.Product_Owner__c; end

#product_tag_nameObject



51
# File 'lib/sambot/slack/work_item.rb', line 51

def product_tag_name; @s_object.Product_Tag_Name__c; end

#qa_engineerObject



25
# File 'lib/sambot/slack/work_item.rb', line 25

def qa_engineer; @s_object.QA_Engineer__c; end

#record_type_idObject



39
# File 'lib/sambot/slack/work_item.rb', line 39

def record_type_id; @s_object.RecordTypeId; end

#resolutionObject



55
# File 'lib/sambot/slack/work_item.rb', line 55

def resolution; @s_object.Resolution__c; end

#story_pointsObject



47
# File 'lib/sambot/slack/work_item.rb', line 47

def story_points; @s_object.QA_Engineer__c; end