leankit 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +41 -0
- data/LICENSE +24 -0
- data/Manifest +21 -0
- data/README.md +79 -0
- data/Rakefile +20 -0
- data/leankit.gemspec +42 -0
- data/lib/leankit_request.rb +30 -0
- data/lib/leankitkanban.rb +13 -0
- data/lib/leankitkanban/archive.rb +13 -0
- data/lib/leankitkanban/backlog.rb +13 -0
- data/lib/leankitkanban/board.rb +36 -0
- data/lib/leankitkanban/card.rb +59 -0
- data/lib/leankitkanban/config.rb +28 -0
- data/lib/leankitkanban/version.rb +3 -0
- data/spec/leankitkanban/archive_spec.rb +15 -0
- data/spec/leankitkanban/backlog_spec.rb +15 -0
- data/spec/leankitkanban/board_spec.rb +65 -0
- data/spec/leankitkanban/card_spec.rb +123 -0
- data/spec/leankitkanban/config_spec.rb +59 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/support/config_helper.rb +7 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37fd043a35d6dcb217aa73af6ee0d92ff933e7c2
|
4
|
+
data.tar.gz: c8f11e7ba145d5a470d42e0b2f1580efbc7e9e14
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5842e7de34f41aba247965bb6b28a098644b60bc9da7a855008459bb3feb08258d7751fba7ff7974bee7eae720120bf7c1282f675045d421e80b2c90d6c7ceab
|
7
|
+
data.tar.gz: 195c3af6362acb5962ce0f194b24279b82988675911a3e4ada055a886e270942e89098527c0d521cb86f7e9e26d1d90276f059d535e1f7e8f03ce4cd67209be3
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
allison (2.0.3)
|
5
|
+
diff-lcs (1.1.3)
|
6
|
+
echoe (4.6.3)
|
7
|
+
allison (>= 2.0.3)
|
8
|
+
gemcutter (>= 0.7.0)
|
9
|
+
rake (>= 0.9.2)
|
10
|
+
rdoc (>= 3.6.1)
|
11
|
+
rubyforge (>= 2.0.4)
|
12
|
+
gemcutter (0.7.1)
|
13
|
+
httparty (0.8.1)
|
14
|
+
multi_json
|
15
|
+
multi_xml
|
16
|
+
json (1.7.5)
|
17
|
+
json_pure (1.8.0)
|
18
|
+
multi_json (1.7.6)
|
19
|
+
multi_xml (0.5.4)
|
20
|
+
rake (10.0.4)
|
21
|
+
rdoc (4.0.1)
|
22
|
+
json (~> 1.4)
|
23
|
+
rspec (2.7.0)
|
24
|
+
rspec-core (~> 2.7.0)
|
25
|
+
rspec-expectations (~> 2.7.0)
|
26
|
+
rspec-mocks (~> 2.7.0)
|
27
|
+
rspec-core (2.7.1)
|
28
|
+
rspec-expectations (2.7.0)
|
29
|
+
diff-lcs (~> 1.1.2)
|
30
|
+
rspec-mocks (2.7.0)
|
31
|
+
rubyforge (2.0.4)
|
32
|
+
json_pure (>= 1.1.7)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
echoe (= 4.6.3)
|
39
|
+
httparty (= 0.8.1)
|
40
|
+
json (= 1.7.5)
|
41
|
+
rspec (= 2.7.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2011 Marc Lainez
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
Except as contained in this notice, the name of Marc Lainez shall not be
|
23
|
+
used in advertising or otherwise to promote the sale, use or other dealings
|
24
|
+
in this Software without prior written authorization from Marc Lainez.
|
data/Manifest
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gemfile
|
2
|
+
Gemfile.lock
|
3
|
+
LICENSE
|
4
|
+
Manifest
|
5
|
+
README.md
|
6
|
+
Rakefile
|
7
|
+
lib/leankit_request.rb
|
8
|
+
lib/leankitkanban.rb
|
9
|
+
lib/leankitkanban/archive.rb
|
10
|
+
lib/leankitkanban/backlog.rb
|
11
|
+
lib/leankitkanban/board.rb
|
12
|
+
lib/leankitkanban/card.rb
|
13
|
+
lib/leankitkanban/config.rb
|
14
|
+
lib/leankitkanban/version.rb
|
15
|
+
spec/leankitkanban/archive_spec.rb
|
16
|
+
spec/leankitkanban/backlog_spec.rb
|
17
|
+
spec/leankitkanban/board_spec.rb
|
18
|
+
spec/leankitkanban/card_spec.rb
|
19
|
+
spec/leankitkanban/config_spec.rb
|
20
|
+
spec/spec_helper.rb
|
21
|
+
spec/support/config_helper.rb
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
LeanKitKanban
|
2
|
+
=============
|
3
|
+
|
4
|
+
LeanKitKanban is a simple ruby wrapper around the LeanKitKanban API
|
5
|
+
|
6
|
+
http://leankitkanban.com/
|
7
|
+
|
8
|
+
[](https://travis-ci.org/mlainez/leankitkanban)
|
9
|
+
|
10
|
+
Usage
|
11
|
+
-----
|
12
|
+
|
13
|
+
# configure your account information
|
14
|
+
LeanKitKanban::Config.email = "mytestemail@test.com"
|
15
|
+
LeanKitKanban::Config.password = "mypassword"
|
16
|
+
LeanKitKanban::Config.account = "myaccount"
|
17
|
+
|
18
|
+
# get all boards and returns an array of hashes
|
19
|
+
@boards = LeanKitKanban::Board.all
|
20
|
+
|
21
|
+
# get the board with specified id as a hash
|
22
|
+
@board = LeanKitKanban::Board.find(board_id)
|
23
|
+
|
24
|
+
# get all the identifiers for a board, it contains all information needed for other api calls
|
25
|
+
@identifiers = LeanKitKanban::Board.get_identifiers(board_id)
|
26
|
+
|
27
|
+
# get the newest version of the board if it exists
|
28
|
+
@board_version = LeanKitKanban::Board.get_newer_if_exists(board_id, version_id)
|
29
|
+
|
30
|
+
# gets the last 5 events that occured since version_id
|
31
|
+
@last_events = LeanKitKanban::Board.get_board_history_since(board_id, version_id)
|
32
|
+
|
33
|
+
|
34
|
+
# get a specific card from a board
|
35
|
+
@card = LeanKitKanban::Card.find(board_id, card_id)
|
36
|
+
|
37
|
+
# get a specific card from a board by external id
|
38
|
+
@card = LeanKitKanban::Card.find_by_external_id(board_id, external_id)
|
39
|
+
|
40
|
+
# add a card, specified in JSON, to the board
|
41
|
+
@response = LeanKitKanban::Card.add(board_id, lane_id, position, body)
|
42
|
+
|
43
|
+
# add multiple cards, specified in JSON, to the board
|
44
|
+
@response = LeanKitKanban::Card.add_multiple(board_id, comment, cards)
|
45
|
+
|
46
|
+
# update a card specified in JSON
|
47
|
+
@response = LeanKitKanban::Card.update(board_id, body)
|
48
|
+
|
49
|
+
# delete a card from the board
|
50
|
+
@response = LeanKitKanban::Card.delete(board_id, card_id)
|
51
|
+
|
52
|
+
# delete multiple cards from the board
|
53
|
+
@response = LeanKitKanban::Card.delete_multiple(board_id, card_ids)
|
54
|
+
|
55
|
+
# move a card to another lane
|
56
|
+
@response = LeanKitKanban::Card.move(board_id, card_id, lane_id, position)
|
57
|
+
|
58
|
+
# get board backlog
|
59
|
+
@backlog = LeanKitKanban::Backlog.fetch(board_id)
|
60
|
+
|
61
|
+
# get board archive
|
62
|
+
@archive = LeanKitKanban::Archive.fetch(board_id)
|
63
|
+
|
64
|
+
Contributing
|
65
|
+
------------
|
66
|
+
|
67
|
+
Fork this repo and send me pull requests.
|
68
|
+
|
69
|
+
All specs are in the /spec directory, to run them:
|
70
|
+
|
71
|
+
rspec
|
72
|
+
|
73
|
+
Additional information
|
74
|
+
----------------------
|
75
|
+
|
76
|
+
* LeanKitKanban API doc: http://support.leankitkanban.com/forums/20153741-api
|
77
|
+
|
78
|
+
|
79
|
+
Copyright (c) 2011 Marc Lainez
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
Echoe.new('leankit', '0.1.5') do |p|
|
11
|
+
p.description = "Ruby Wrapper around LeanKitKanban Api"
|
12
|
+
p.url = "http://github.com/noahpryor/leankitkanban"
|
13
|
+
p.author = "Noah Pryor"
|
14
|
+
p.email = "noah@noahpryor.com"
|
15
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
16
|
+
p.runtime_dependencies = ['json >=1.6.1', 'httparty =0.8.1']
|
17
|
+
p.development_dependencies = ['echoe =4.6.3', 'rspec =2.7.0']
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/leankit.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: leankit 0.1.5 ruby lib
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "leankit"
|
6
|
+
s.version = "0.1.5"
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib"]
|
10
|
+
s.authors = ["Noah Pryor"]
|
11
|
+
s.date = "2014-04-24"
|
12
|
+
s.description = "Ruby Wrapper around LeanKitKanban Api"
|
13
|
+
s.email = "noah@noahpryor.com"
|
14
|
+
s.extra_rdoc_files = ["LICENSE", "README.md", "lib/leankit_request.rb", "lib/leankitkanban.rb", "lib/leankitkanban/archive.rb", "lib/leankitkanban/backlog.rb", "lib/leankitkanban/board.rb", "lib/leankitkanban/card.rb", "lib/leankitkanban/config.rb", "lib/leankitkanban/version.rb"]
|
15
|
+
s.files = ["Gemfile", "Gemfile.lock", "LICENSE", "Manifest", "README.md", "Rakefile", "leankit.gemspec", "lib/leankit_request.rb", "lib/leankitkanban.rb", "lib/leankitkanban/archive.rb", "lib/leankitkanban/backlog.rb", "lib/leankitkanban/board.rb", "lib/leankitkanban/card.rb", "lib/leankitkanban/config.rb", "lib/leankitkanban/version.rb", "spec/leankitkanban/archive_spec.rb", "spec/leankitkanban/backlog_spec.rb", "spec/leankitkanban/board_spec.rb", "spec/leankitkanban/card_spec.rb", "spec/leankitkanban/config_spec.rb", "spec/spec_helper.rb", "spec/support/config_helper.rb"]
|
16
|
+
s.homepage = "http://github.com/noahpryor/leankitkanban"
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Leankit", "--main", "README.md"]
|
18
|
+
s.rubyforge_project = "leankit"
|
19
|
+
s.rubygems_version = "2.2.2"
|
20
|
+
s.summary = "Ruby Wrapper around LeanKitKanban Api"
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
s.specification_version = 4
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<json>, [">= 1.6.1"])
|
27
|
+
s.add_runtime_dependency(%q<httparty>, ["= 0.8.1"])
|
28
|
+
s.add_development_dependency(%q<echoe>, ["= 4.6.3"])
|
29
|
+
s.add_development_dependency(%q<rspec>, ["= 2.7.0"])
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<json>, [">= 1.6.1"])
|
32
|
+
s.add_dependency(%q<httparty>, ["= 0.8.1"])
|
33
|
+
s.add_dependency(%q<echoe>, ["= 4.6.3"])
|
34
|
+
s.add_dependency(%q<rspec>, ["= 2.7.0"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<json>, [">= 1.6.1"])
|
38
|
+
s.add_dependency(%q<httparty>, ["= 0.8.1"])
|
39
|
+
s.add_dependency(%q<echoe>, ["= 4.6.3"])
|
40
|
+
s.add_dependency(%q<rspec>, ["= 2.7.0"])
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module LeanKitRequest
|
2
|
+
def self.included(base)
|
3
|
+
base.extend ClassMethods
|
4
|
+
end
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
REPLY_DATA_KEY = "ReplyData"
|
8
|
+
|
9
|
+
private
|
10
|
+
def get(api_call)
|
11
|
+
url = "#{LeanKitKanban::Config.uri}#{api_call}"
|
12
|
+
response = super(url, LeanKitKanban::Config.basic_auth_hash)
|
13
|
+
parse_body(response.body)
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(api_call, body)
|
17
|
+
url = "#{LeanKitKanban::Config.uri}#{api_call}"
|
18
|
+
headers("Content-Type" => "application/json")
|
19
|
+
request = LeanKitKanban::Config.basic_auth_hash
|
20
|
+
request[:body] = body.to_json
|
21
|
+
response = super(url, request)
|
22
|
+
parse_body(response.body)
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_body(body)
|
26
|
+
json_data = JSON.parse(body)
|
27
|
+
json_data[REPLY_DATA_KEY]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "uri"
|
2
|
+
require "httparty"
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
require File.join(File.dirname(__FILE__), 'leankit_request')
|
6
|
+
require File.join(File.dirname(__FILE__), 'leankitkanban', 'config')
|
7
|
+
require File.join(File.dirname(__FILE__), 'leankitkanban', 'board')
|
8
|
+
require File.join(File.dirname(__FILE__), 'leankitkanban', 'card')
|
9
|
+
require File.join(File.dirname(__FILE__), 'leankitkanban', 'backlog')
|
10
|
+
require File.join(File.dirname(__FILE__), 'leankitkanban', 'archive')
|
11
|
+
|
12
|
+
module LeanKitKanban
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module LeanKitKanban
|
2
|
+
module Board
|
3
|
+
include HTTParty
|
4
|
+
include LeanKitRequest
|
5
|
+
|
6
|
+
ALL_BOARDS = "/Boards"
|
7
|
+
ONE_BOARD = "/Boards/{boardID}"
|
8
|
+
IDENTIFIERS = "/Board/{boardID}/GetBoardIdentifiers"
|
9
|
+
NEWER_IF_EXISTS = "/Board/{boardID}/BoardVersion/{versionID}/GetNewerIfExists"
|
10
|
+
HISTORY_SINCE = "/Board/{boardID}/BoardVersion/{versionID}/GetBoardHistorySince"
|
11
|
+
|
12
|
+
def self.all
|
13
|
+
get(ALL_BOARDS)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.find(board_id)
|
17
|
+
api_call = ONE_BOARD.gsub("{boardID}", board_id.to_s)
|
18
|
+
get(api_call)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_identifiers(board_id)
|
22
|
+
api_call = IDENTIFIERS.gsub("{boardID}", board_id.to_s)
|
23
|
+
get(api_call)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_newer_if_exists(board_id, version_id)
|
27
|
+
api_call = NEWER_IF_EXISTS.gsub("{boardID}", board_id.to_s).gsub("{versionID}", version_id.to_s)
|
28
|
+
get(api_call)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.get_board_history_since(board_id, version_id)
|
32
|
+
api_call = HISTORY_SINCE.gsub("{boardID}", board_id.to_s).gsub("{versionID}", version_id.to_s)
|
33
|
+
get(api_call)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module LeanKitKanban
|
2
|
+
module Card
|
3
|
+
include HTTParty
|
4
|
+
include LeanKitRequest
|
5
|
+
DELETE_CARD = "/Board/{boardID}/DeleteCard/{cardID}"
|
6
|
+
DELETE_CARDS = "/Board/{boardID}/DeleteCards"
|
7
|
+
FIND_CARD = "/Board/{boardID}/GetCard/{cardID}"
|
8
|
+
FIND_CARD_EXT = "/Board/{boardID}/GetCardByExternalId/{externalID}"
|
9
|
+
ADD_CARD = "/Board/{boardID}/AddCard/Lane/{laneID}/Position/{position}"
|
10
|
+
ADD_CARDS = "/Board/{boardID}/AddCards?wipOverrideComment={comment}"
|
11
|
+
UPDATE_CARD = "/Board/{boardID}/UpdateCard/"
|
12
|
+
HISTORY_CARD = "/Card/History/{boardID}/{cardID}"
|
13
|
+
MOVE_CARD = "/Board/{boardID}/MoveCard/{cardID}/Lane/{laneID}/Position/{position}"
|
14
|
+
def self.delete(board_id, card_id)
|
15
|
+
api_call = DELETE_CARD.gsub("{boardID}", board_id.to_s).gsub("{cardID}", card_id.to_s)
|
16
|
+
post(api_call, {})
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.delete_multiple(board_id, card_ids)
|
20
|
+
api_call = DELETE_CARDS.gsub("{boardID}", board_id.to_s)
|
21
|
+
post(api_call, card_ids)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.move(board_id, card_id,lane_id,position=0)
|
25
|
+
api_call = MOVE_CARD.gsub("{boardID}", board_id.to_s).gsub("{cardID}", card_id.to_s).gsub("{laneID}", lane_id.to_s).gsub("{position}", position.to_s)
|
26
|
+
post(api_call,{})
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find(board_id, card_id)
|
30
|
+
api_call = FIND_CARD.gsub("{boardID}", board_id.to_s).gsub("{cardID}", card_id.to_s)
|
31
|
+
get(api_call)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.find_by_external_id(board_id, external_id)
|
35
|
+
api_call = FIND_CARD_EXT.gsub("{boardID}", board_id.to_s).gsub("{externalID}", external_id.to_s)
|
36
|
+
get(api_call)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.add(board_id, lane_id, position, body)
|
40
|
+
api_call = ADD_CARD.gsub("{boardID}", board_id.to_s).gsub("{laneID}", lane_id.to_s).gsub("{position}", position.to_s)
|
41
|
+
post(api_call, body)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.add_multiple(board_id, comment, cards)
|
45
|
+
api_call = ADD_CARDS.gsub("{boardID}", board_id.to_s).gsub("{comment}", URI::encode(comment))
|
46
|
+
post(api_call, cards)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.update(board_id, body)
|
50
|
+
api_call = UPDATE_CARD.gsub("{boardID}", board_id.to_s)
|
51
|
+
post(api_call, body)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.history(board_id, card_id)
|
55
|
+
api_call = HISTORY_CARD.gsub("{boardID}", board_id.to_s).gsub("{cardID}", card_id.to_s)
|
56
|
+
get(api_call)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module LeanKitKanban
|
2
|
+
module Config
|
3
|
+
class NoCredentials < StandardError; end
|
4
|
+
class NoAccount < StandardError; end
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :email, :password, :account
|
8
|
+
|
9
|
+
LKK_DOMAIN = "leankitkanban.com"
|
10
|
+
API_SUFFIX = "/Kanban/API"
|
11
|
+
|
12
|
+
def validate
|
13
|
+
raise NoCredentials if email.nil? || password.nil?
|
14
|
+
raise NoAccount if account.nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
def uri
|
18
|
+
validate
|
19
|
+
"http://#{account}.#{LKK_DOMAIN}#{API_SUFFIX}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def basic_auth_hash
|
23
|
+
validate
|
24
|
+
{:basic_auth => {:username => email, :password => password}}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LeanKitKanban::Archive do
|
4
|
+
describe :fetch do
|
5
|
+
before :each do
|
6
|
+
@board_id = mock("boardID")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "gets the board archive" do
|
10
|
+
api_call = "/Board/#{@board_id}/Archive"
|
11
|
+
LeanKitKanban::Archive.should_receive(:get).with(api_call)
|
12
|
+
LeanKitKanban::Archive.fetch(@board_id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LeanKitKanban::Backlog do
|
4
|
+
describe :fetch do
|
5
|
+
before :each do
|
6
|
+
@board_id = mock("boardID")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "gets the board backlog" do
|
10
|
+
api_call = "/Board/#{@board_id}/Backlog"
|
11
|
+
LeanKitKanban::Backlog.should_receive(:get).with(api_call)
|
12
|
+
LeanKitKanban::Backlog.fetch(@board_id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LeanKitKanban::Board do
|
4
|
+
before :all do
|
5
|
+
ConfigHelper.set_test_config
|
6
|
+
end
|
7
|
+
|
8
|
+
describe :all do
|
9
|
+
it "gets all boards for that account" do
|
10
|
+
api_call = "/Boards"
|
11
|
+
LeanKitKanban::Board.should_receive(:get).with(api_call)
|
12
|
+
LeanKitKanban::Board.all
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe :find do
|
17
|
+
before :each do
|
18
|
+
@board_id = mock("boardID")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "gets the board whose id is passed as parameter" do
|
22
|
+
api_call = "/Boards/#{@board_id}"
|
23
|
+
LeanKitKanban::Board.should_receive(:get).with(api_call)
|
24
|
+
LeanKitKanban::Board.find(@board_id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe :get_identifiers do
|
29
|
+
before :each do
|
30
|
+
@board_id = mock("boardID")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "gets the identifiers of the board whose id is passed as parameter" do
|
34
|
+
api_call = "/Board/#{@board_id}/GetBoardIdentifiers"
|
35
|
+
LeanKitKanban::Board.should_receive(:get).with(api_call)
|
36
|
+
LeanKitKanban::Board.get_identifiers(@board_id)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe :get_newer_if_exists do
|
41
|
+
before :each do
|
42
|
+
@board_id = mock("boardID")
|
43
|
+
@version_id = mock("versionID")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "gets a greater version of the board than the one passed" do
|
47
|
+
api_call = "/Board/#{@board_id}/BoardVersion/#{@version_id}/GetNewerIfExists"
|
48
|
+
LeanKitKanban::Board.should_receive(:get).with(api_call)
|
49
|
+
LeanKitKanban::Board.get_newer_if_exists(@board_id, @version_id)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe :get_board_history_since do
|
54
|
+
before :each do
|
55
|
+
@board_id = mock("boardID")
|
56
|
+
@version_id = mock("versionID")
|
57
|
+
end
|
58
|
+
|
59
|
+
it "gets a greater version of the board than the one passed" do
|
60
|
+
api_call = "/Board/#{@board_id}/BoardVersion/#{@version_id}/GetBoardHistorySince"
|
61
|
+
LeanKitKanban::Board.should_receive(:get).with(api_call)
|
62
|
+
LeanKitKanban::Board.get_board_history_since(@board_id, @version_id)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LeanKitKanban::Card do
|
4
|
+
describe :find do
|
5
|
+
before :each do
|
6
|
+
@board_id = mock("boardID")
|
7
|
+
@card_id = mock("cardID")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "gets the board card whose id is passed" do
|
11
|
+
api_call = "/Board/#{@board_id}/GetCard/#{@card_id}"
|
12
|
+
LeanKitKanban::Card.should_receive(:get).with(api_call)
|
13
|
+
LeanKitKanban::Card.find(@board_id, @card_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe :find_by_external_id do
|
18
|
+
before :each do
|
19
|
+
@board_id = mock("boardID")
|
20
|
+
@external_id = mock("externalID")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "gets the board card whose id is passed" do
|
24
|
+
api_call = "/Board/#{@board_id}/GetCardByExternalId/#{@external_id}"
|
25
|
+
LeanKitKanban::Card.should_receive(:get).with(api_call)
|
26
|
+
LeanKitKanban::Card.find_by_external_id(@board_id, @external_id)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe :delete_multiple do
|
31
|
+
before :each do
|
32
|
+
@board_id = mock("boardID")
|
33
|
+
@card_ids = [ mock("cardID_0"), mock("cardID_1"), mock("cardID_2") ]
|
34
|
+
end
|
35
|
+
|
36
|
+
it "deletes the card whose ids are passed" do
|
37
|
+
api_call = "/Board/#{@board_id}/DeleteCards"
|
38
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call, @card_ids)
|
39
|
+
LeanKitKanban::Card.delete_multiple(@board_id, @card_ids)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe :delete do
|
44
|
+
before :each do
|
45
|
+
@board_id = mock("boardID")
|
46
|
+
@card_id = mock("cardID")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "deletes the board card whose id is passed" do
|
50
|
+
api_call = "/Board/#{@board_id}/DeleteCard/#{@card_id}"
|
51
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call, {})
|
52
|
+
LeanKitKanban::Card.delete(@board_id, @card_id)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe :add do
|
57
|
+
before :each do
|
58
|
+
@board_id = mock("boardID")
|
59
|
+
@lane_id = mock("laneID")
|
60
|
+
@position = mock("position")
|
61
|
+
@body = { "Title" => mock("title"), "TypeId" => mock("typeID")}
|
62
|
+
end
|
63
|
+
|
64
|
+
it "adds the card into the lane and position provided" do
|
65
|
+
api_call = "/Board/#{@board_id}/AddCard/Lane/#{@lane_id}/Position/#{@position}"
|
66
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call, @body)
|
67
|
+
LeanKitKanban::Card.add(@board_id, @lane_id, @position, @body)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe :update do
|
72
|
+
before :each do
|
73
|
+
@board_id = mock("boardID")
|
74
|
+
@body = { "Id" => mock("Id"), "Title" => mock("title"), "Description" => mock("description") }
|
75
|
+
end
|
76
|
+
|
77
|
+
it "updates the card using the title and description provided" do
|
78
|
+
api_call = "/Board/#{@board_id}/UpdateCard/"
|
79
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call, @body)
|
80
|
+
LeanKitKanban::Card.update(@board_id, @body)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe :add_multiple do
|
85
|
+
before :each do
|
86
|
+
@cards = []
|
87
|
+
@board_id = mock("boardID")
|
88
|
+
@wip_comment = "this is a comment"
|
89
|
+
|
90
|
+
lane_ids = [ mock("lane_0"), mock("lane_1") ]
|
91
|
+
titles = [ mock("title_0"), mock("title_1") ]
|
92
|
+
type_ids = [ mock("type_0"), mock("type_1") ]
|
93
|
+
|
94
|
+
lane_ids.each_with_index { |item, i|
|
95
|
+
@cards[i] = { "LaneId" => lane_ids[i], "Title" => titles[i], "TypeId" => type_ids[i] }
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
it "adds the cards into the lanes and positions provided" do
|
100
|
+
api_call = "/Board/#{@board_id}/AddCards?wipOverrideComment=" + URI::encode(@wip_comment)
|
101
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call, @cards)
|
102
|
+
LeanKitKanban::Card.add_multiple(@board_id, @wip_comment, @cards)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe :history do
|
107
|
+
it "gets the history of card which id is provided" do
|
108
|
+
api_call = "/Card/History/#{@board_id}/#{@card_id}"
|
109
|
+
LeanKitKanban::Card.should_receive(:get).with(api_call)
|
110
|
+
LeanKitKanban::Card.history(@board_id, @card_id)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe :move do
|
115
|
+
it "gets the history of card which id is provided" do
|
116
|
+
@lane_id = 12
|
117
|
+
@position = 0
|
118
|
+
api_call = "/Board/#{@board_id}/MoveCard/#{@card_id}/Lane/#{@lane_id}/Position/0"
|
119
|
+
LeanKitKanban::Card.should_receive(:post).with(api_call,{})
|
120
|
+
LeanKitKanban::Card.move(@board_id, @card_id, @lane_id, @position)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe LeanKitKanban::Config do
|
4
|
+
describe :validate do
|
5
|
+
before :each do
|
6
|
+
ConfigHelper.set_test_config
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when the config is not set" do
|
10
|
+
it "raises a no credentials error when no email" do
|
11
|
+
LeanKitKanban::Config.email = nil
|
12
|
+
lambda{ LeanKitKanban::Config.validate }.should raise_error(LeanKitKanban::Config::NoCredentials)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "raises a no credentials error when no password" do
|
16
|
+
LeanKitKanban::Config.password = nil
|
17
|
+
lambda{ LeanKitKanban::Config.validate }.should raise_error(LeanKitKanban::Config::NoCredentials)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "raises a no account error when no account" do
|
21
|
+
LeanKitKanban::Config.account = nil
|
22
|
+
lambda{ LeanKitKanban::Config.validate }.should raise_error(LeanKitKanban::Config::NoAccount)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the config is set" do
|
27
|
+
it "doesn't raise a no credentials error" do
|
28
|
+
lambda{ LeanKitKanban::Config.validate }.should_not raise_error(LeanKitKanban::Config::NoCredentials)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "doesn't raise a no account error" do
|
32
|
+
lambda{ LeanKitKanban::Config.validate }.should_not raise_error(LeanKitKanban::Config::NoAccount)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe :uri do
|
38
|
+
it "validates the config" do
|
39
|
+
LeanKitKanban::Config.should_receive(:validate)
|
40
|
+
LeanKitKanban::Config.uri
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns the domain including the account name" do
|
44
|
+
LeanKitKanban::Config.uri.should eql "http://#{TEST_ACCOUNT}.leankitkanban.com/Kanban/API"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe :basic_auth_hash do
|
49
|
+
it "validates the config" do
|
50
|
+
LeanKitKanban::Config.should_receive(:validate)
|
51
|
+
LeanKitKanban::Config.basic_auth_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
it "returns a hash with the credentials" do
|
55
|
+
expected_hash = {:basic_auth => {:username => EMAIL, :password => PASSWORD}}
|
56
|
+
LeanKitKanban::Config.basic_auth_hash.should eql expected_hash
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: leankit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noah Pryor
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: echoe
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.6.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.6.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.7.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.7.0
|
69
|
+
description: Ruby Wrapper around LeanKitKanban Api
|
70
|
+
email: noah@noahpryor.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files:
|
74
|
+
- LICENSE
|
75
|
+
- README.md
|
76
|
+
- lib/leankit_request.rb
|
77
|
+
- lib/leankitkanban.rb
|
78
|
+
- lib/leankitkanban/archive.rb
|
79
|
+
- lib/leankitkanban/backlog.rb
|
80
|
+
- lib/leankitkanban/board.rb
|
81
|
+
- lib/leankitkanban/card.rb
|
82
|
+
- lib/leankitkanban/config.rb
|
83
|
+
- lib/leankitkanban/version.rb
|
84
|
+
files:
|
85
|
+
- Gemfile
|
86
|
+
- Gemfile.lock
|
87
|
+
- LICENSE
|
88
|
+
- Manifest
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- leankit.gemspec
|
92
|
+
- lib/leankit_request.rb
|
93
|
+
- lib/leankitkanban.rb
|
94
|
+
- lib/leankitkanban/archive.rb
|
95
|
+
- lib/leankitkanban/backlog.rb
|
96
|
+
- lib/leankitkanban/board.rb
|
97
|
+
- lib/leankitkanban/card.rb
|
98
|
+
- lib/leankitkanban/config.rb
|
99
|
+
- lib/leankitkanban/version.rb
|
100
|
+
- spec/leankitkanban/archive_spec.rb
|
101
|
+
- spec/leankitkanban/backlog_spec.rb
|
102
|
+
- spec/leankitkanban/board_spec.rb
|
103
|
+
- spec/leankitkanban/card_spec.rb
|
104
|
+
- spec/leankitkanban/config_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
- spec/support/config_helper.rb
|
107
|
+
homepage: http://github.com/noahpryor/leankitkanban
|
108
|
+
licenses: []
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options:
|
112
|
+
- --line-numbers
|
113
|
+
- --inline-source
|
114
|
+
- --title
|
115
|
+
- Leankit
|
116
|
+
- --main
|
117
|
+
- README.md
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '1.2'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project: leankit
|
132
|
+
rubygems_version: 2.2.2
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: Ruby Wrapper around LeanKitKanban Api
|
136
|
+
test_files: []
|