class Kanbanery::Client

Constants

BASE_URL

Attributes

key[RW]
workspace[RW]

Public Class Methods

name() click to toggle source
# File lib/ranbanery.rb, line 26
def self.name; superclass.name; end
new(workspace, key) click to toggle source
# File lib/ranbanery.rb, line 16
def initialize(workspace, key)
  self.workspace = workspace
  self.key       = key
end

Public Instance Methods

columns(project_id=nil) click to toggle source
# File lib/ranbanery.rb, line 41
def columns(project_id=nil)
  resource(:column, prefix: project_id ? "/projects/#{project_id}" : nil)
end
comments(task_id=nil) click to toggle source
# File lib/ranbanery.rb, line 53
def comments(task_id=nil)
  resource(:comment, prefix: task_id ? "/tasks/#{task_id}" : nil)
end
projects() click to toggle source
# File lib/ranbanery.rb, line 33
def projects
  resource(:project)
end
resource(name, options={}) click to toggle source
# File lib/ranbanery.rb, line 21
def resource(name, options={})
  the_workspace = self.workspace
  the_key       = self.key
  klass      = "Kanbanery::#{name.to_s.classify}".constantize
  Class.new(klass) do |c|
    def self.name; superclass.name; end
    c.element_name                    = name.to_s
    c.site                            = "#{BASE_URL % the_workspace}#{options[:prefix]}"
    c.headers['X-Kanbanery-ApiToken'] = the_key
  end
end
subtasks(task_id=nil) click to toggle source
# File lib/ranbanery.rb, line 49
def subtasks(task_id=nil)
  resource(:subtask, prefix: task_id ? "/tasks/#{task_id}" : nil)
end
tasks(project_id=nil) click to toggle source
# File lib/ranbanery.rb, line 45
def tasks(project_id=nil)
  resource(:task, prefix: project_id ? "/projects/#{project_id}" : nil)
end
users(project_id=nil) click to toggle source
# File lib/ranbanery.rb, line 37
def users(project_id=nil)
  resource(:user, prefix: project_id ? "/projects/#{project_id}" : nil)
end