Class: SlackService::IssueMessage

Inherits:
BaseMessage show all
Defined in:
app/models/project_services/slack_service/issue_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseMessage

#fallback, #pretext

Constructor Details

#initialize(params) ⇒ IssueMessage


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/project_services/slack_service/issue_message.rb', line 13

def initialize(params)
  @user_name = params[:user][:name]
  @project_name = params[:project_name]
  @project_url = params[:project_url]

  obj_attr = params[:object_attributes]
  obj_attr = HashWithIndifferentAccess.new(obj_attr)
  @title = obj_attr[:title]
  @issue_iid = obj_attr[:iid]
  @issue_url = obj_attr[:url]
  @action = obj_attr[:action]
  @state = obj_attr[:state]
  @description = obj_attr[:description] || ''
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


9
10
11
# File 'app/models/project_services/slack_service/issue_message.rb', line 9

def action
  @action
end

#descriptionObject (readonly)

Returns the value of attribute description


11
12
13
# File 'app/models/project_services/slack_service/issue_message.rb', line 11

def description
  @description
end

#issue_iidObject (readonly)

Returns the value of attribute issue_iid


7
8
9
# File 'app/models/project_services/slack_service/issue_message.rb', line 7

def issue_iid
  @issue_iid
end

#issue_urlObject (readonly)

Returns the value of attribute issue_url


8
9
10
# File 'app/models/project_services/slack_service/issue_message.rb', line 8

def issue_url
  @issue_url
end

#project_nameObject (readonly)

Returns the value of attribute project_name


5
6
7
# File 'app/models/project_services/slack_service/issue_message.rb', line 5

def project_name
  @project_name
end

#project_urlObject (readonly)

Returns the value of attribute project_url


6
7
8
# File 'app/models/project_services/slack_service/issue_message.rb', line 6

def project_url
  @project_url
end

#stateObject (readonly)

Returns the value of attribute state


10
11
12
# File 'app/models/project_services/slack_service/issue_message.rb', line 10

def state
  @state
end

#titleObject (readonly)

Returns the value of attribute title


4
5
6
# File 'app/models/project_services/slack_service/issue_message.rb', line 4

def title
  @title
end

#user_nameObject (readonly)

Returns the value of attribute user_name


3
4
5
# File 'app/models/project_services/slack_service/issue_message.rb', line 3

def user_name
  @user_name
end

Instance Method Details

#attachmentsObject


28
29
30
31
32
# File 'app/models/project_services/slack_service/issue_message.rb', line 28

def attachments
  return [] unless opened_issue?

  description_message
end