Class: Bl::Notifications

Inherits:
Command
  • Object
show all
Defined in:
lib/bl/notifications.rb

Constant Summary

Constants inherited from Command

Command::ACTIVITY_TYPES, Command::CATEGORY_FIELDS, Command::FILE_FIELDS, Command::GIT_REPO_FIELDS, Command::ISSUES_PARAMS, Command::ISSUE_BASE_ATTRIBUTES, Command::ISSUE_FIELDS, Command::MILESTONE_FIELDS, Command::MILESTONE_PARAMS, Command::PROJECT_FIELDS, Command::PROJECT_PARAMS, Command::ROLES, Command::SPACE_DISK_USAGE, Command::SPACE_DISK_USAGE_DETAILS_FIELDS, Command::SPACE_FIELDS, Command::SPACE_NOTIFICATION_FIELDS, Command::TYPE_COLORS, Command::USER_FIELDS, Command::USER_PARAMS, Command::WATCHINGS_PARAMS, Command::WEBHOOK_FIELDS, Command::WEBHOOK_PARAMS, Command::WIKI_FIELDS

Instance Method Summary collapse

Methods included from Formatting

colorize_priority, colorize_status, colorize_type

Methods included from Requestable

client, formatter

Constructor Details

#initializeNotifications

Returns a new instance of Notifications.



4
5
6
7
8
# File 'lib/bl/notifications.rb', line 4

def initialize(*)
  @config = Bl::Config.instance
  @url = 'notifications'
  super
end

Instance Method Details

#countObject



19
20
21
22
# File 'lib/bl/notifications.rb', line 19

def count
  # puts client.get("#{@url}/count").body.count
  # TODO fix nil error
end

#listObject



12
13
14
15
# File 'lib/bl/notifications.rb', line 12

def list
  res = client.get(@url, options.to_h)
  res.body.map { |n| puts n.pretty_inspect }
end

#mark_as_readObject



25
26
27
28
29
# File 'lib/bl/notifications.rb', line 25

def mark_as_read
  res = client.post("#{@url}/markAsRead")
  puts 'notifications mark as readed'
  puts res.body.count
end

#read(id) ⇒ Object



32
33
34
35
36
# File 'lib/bl/notifications.rb', line 32

def read(id)
  res = client.post("#{@url}/#{id}/markAsRead")
  puts "notifications #{id} readed"
  puts res.pretty_inspect
end