Class: AcunoteProject
- Inherits:
-
Object
- Object
- AcunoteProject
- Defined in:
- lib/acunote_project.rb
Overview
API for accessing Acunote projects.
Class Method Summary collapse
- .acu_conn ⇒ Object
-
.find_by_name(name) ⇒ Object
NAME can be a literal string or a regex.
- .find_id_by_name(name) ⇒ Object
- .url(id) ⇒ Object
Class Method Details
.acu_conn ⇒ Object
5 6 7 |
# File 'lib/acunote_project.rb', line 5 def self.acu_conn AcunoteConnection.instance end |
.find_by_name(name) ⇒ Object
NAME can be a literal string or a regex.
21 22 23 24 |
# File 'lib/acunote_project.rb', line 21 def self.find_by_name(name) projects = acu_conn.get_page(url('')) projects.links_with(:href => /projects\/([0-9]*)\/sprints$/, :text => name).first if projects end |
.find_id_by_name(name) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/acunote_project.rb', line 13 def self.find_id_by_name(name) link = find_by_name(name) if(link && link.uri.to_s =~ /projects\/([0-9]*)\/sprints/) $1 end end |
.url(id) ⇒ Object
9 10 11 |
# File 'lib/acunote_project.rb', line 9 def self.url(id) "#{acu_conn.home_url}/projects/#{id}" end |