Class: AcunoteProject

Inherits:
Object
  • Object
show all
Defined in:
lib/acunote_project.rb

Overview

API for accessing Acunote projects.

Class Method Summary collapse

Class Method Details

.acu_connObject



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