Class: RedmineActivity::Fetcher
- Inherits:
-
Object
- Object
- RedmineActivity::Fetcher
- Defined in:
- lib/redmine_activity/fetcher.rb
Overview
Class to fetch and parse activity page
Constant Summary collapse
- ACTIVITY_ATOM_PARAMS =
{ show_issues: 1 }.freeze
- TIME_FORMAT =
'%Y-%m-%d %H:%M:%S'.freeze
Instance Method Summary collapse
-
#get ⇒ Object
Fetch and print activities.
-
#initialize(options = {}) ⇒ Fetcher
constructor
Initialize a new Fetcher object.
Constructor Details
#initialize(options = {}) ⇒ Fetcher
Initialize a new Fetcher object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/redmine_activity/fetcher.rb', line 19 def initialize( = {}) @url = ENV['REDMINE_ACTIVITY_URL'] @login_id = ENV['REDMINE_ACTIVITY_LOGIN_ID'] @password = ENV['REDMINE_ACTIVITY_PASSWORD'] .each do |key, value| instance_variable_set(:"@#{key}", value) end @agent = Mechanize.new end |
Instance Method Details
#get ⇒ Object
Fetch and print activities
32 33 34 35 36 37 |
# File 'lib/redmine_activity/fetcher.rb', line 32 def get login parse(activities) rescue Mechanize::ResponseCodeError => e puts Rainbow('404 Not Found.').red if e.response_code == '404' end |