Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
First version of bulldoggy thor client of bulldoggy API
Browse files Browse the repository at this point in the history
  • Loading branch information
philss committed Jan 31, 2014
0 parents commit 37a91ce
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'thor'
gem 'bulldoggy', '~> 0.0.1.alpha'
gem 'rake'
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GEM
remote: https://rubygems.org/
specs:
bulldoggy (0.0.3.alpha)
rake (10.1.1)
thor (0.18.1)

PLATFORMS
ruby

DEPENDENCIES
bulldoggy (~> 0.0.1.alpha)
rake
thor
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
task :default => [:test]

desc "Runs API tests"
task :test do
ruby "test/bulldoggy-thor/api_test.rb"
end
33 changes: 33 additions & 0 deletions lib/bulldoggy-thor/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'thor'
require 'bulldoggy'

module BulldoggyThor
class API < ::Thor
desc "add_task DESCRIPTION", "Type a task to create with DESCRIPTION"
def add_task(description)
Bulldoggy.add_task(description)
end

desc "remove_task TASK_ID", "Removes a task with TASK_ID"
def remove_task(task_id)
Bulldoggy.remove_task(task_id)
end

desc "fetch", "fetches all tasks"
def fetch
Bulldoggy.fetch
end

desc "check_task TASK_ID", "Mark a task as done"
def check_task(task_id)
Bulldoggy.check_task(task_id)
end

desc "uncheck_task TASK_ID", "Mark a task as undone"
def uncheck_task(task_id)
Bulldoggy.uncheck_task(task_id)
end
end
end

BulldoggyThor::API.start(ARGV)
20 changes: 20 additions & 0 deletions test/bulldoggy-thor/api_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'test/unit'
require './lib/bulldoggy-thor/api'

module BulldoggyThor
class APITest < Test::Unit::TestCase
def test_add_task
task_name = "Read Uncle Bob Articles"
API.new.add_task(task_name)

assert_equal task_name, Bulldoggy.fetch.first.fetch(:description)
end

#def test_remove_task
#Bulldoggy.add_task("New Task")
#API.new.remove_task(1)

#assert Bulldoggy.fetch.empty?
#end
end
end

0 comments on commit 37a91ce

Please sign in to comment.