Class: Ruboty::Ragoon::Notification::Item
- Inherits:
-
Object
- Object
- Ruboty::Ragoon::Notification::Item
- Defined in:
- lib/ruboty/ragoon/notification.rb
Constant Summary collapse
- DEFAULT_ICON =
':information_source:'
- APPLICATION_ICONS =
{ 'grn.schedule' => ':memo:', # スケジュール 'grn.schedule.facility_approval' => DEFAULT_ICON, # 施設の利用申請 'grn.message' => ':incoming_envelope:', # メッセージ 'grn.bulletin' => ':clipboard:', # 掲示板 'grn.cabinet' => ':open_file_folder:', # ファイル管理 'grn.phonemessage' => ':phone:', # 電話メモ 'grn.mail' => ':mailbox_with_mail:', # メール 'grn.workflow' => ':inbox_tray:', # ワークフロー 'grn.report' => DEFAULT_ICON, # マルチレポート 'grn.space' => DEFAULT_ICON, # スペース 'grn.space.discussion' => DEFAULT_ICON, # スペースのディスカッション 'grn.space.todo' => DEFAULT_ICON, # スペースの共有ToDo }.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#module_icon ⇒ Object
Returns the value of attribute module_icon.
-
#module_type ⇒ Object
Returns the value of attribute module_type.
-
#recieved_at ⇒ Object
Returns the value of attribute recieved_at.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#unread ⇒ Object
Returns the value of attribute unread.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(data) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(data) ⇒ Item
Returns a new instance of Item.
56 57 58 59 60 61 62 63 64 |
# File 'lib/ruboty/ragoon/notification.rb', line 56 def initialize(data) @id = data[:item].to_i @module_type = data[:module_id].gsub('grn.', '').gsub('.', '_').to_sym @module_icon = APPLICATION_ICONS[data[:module_id]] @unread = data[:is_history] == 'false' @recieved_at = Time.parse(data[:receive_datetime]) @subject = data[:subject] @url = data[:abstract_url] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def id @id end |
#module_icon ⇒ Object
Returns the value of attribute module_icon.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def module_icon @module_icon end |
#module_type ⇒ Object
Returns the value of attribute module_type.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def module_type @module_type end |
#recieved_at ⇒ Object
Returns the value of attribute recieved_at.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def recieved_at @recieved_at end |
#subject ⇒ Object
Returns the value of attribute subject.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def subject @subject end |
#unread ⇒ Object
Returns the value of attribute unread.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def unread @unread end |
#url ⇒ Object
Returns the value of attribute url.
37 38 39 |
# File 'lib/ruboty/ragoon/notification.rb', line 37 def url @url end |
Instance Method Details
#format ⇒ Object
66 67 68 |
# File 'lib/ruboty/ragoon/notification.rb', line 66 def format "#{@module_icon} #{@subject[0 .. 30]} #{@url}" end |