codebase_api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codebase_api.rb +1 -2
- data/lib/codebase_api/commit.rb +12 -12
- data/lib/codebase_api/deployment.rb +8 -8
- data/lib/codebase_api/discussion.rb +24 -24
- data/lib/codebase_api/hook.rb +12 -12
- data/lib/codebase_api/project.rb +21 -21
- data/lib/codebase_api/project_group.rb +6 -6
- data/lib/codebase_api/project_user.rb +10 -10
- data/lib/codebase_api/public_key.rb +20 -20
- data/lib/codebase_api/repository.rb +16 -16
- data/lib/codebase_api/ticket.rb +54 -50
- data/lib/codebase_api/time_session.rb +47 -47
- data/lib/codebase_api/user.rb +16 -16
- data/lib/codebase_api/version.rb +1 -1
- data/lib/codebase_api/wiki.rb +12 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59ad9e77c7140e0fe6944f765891562f11ea9072
|
4
|
+
data.tar.gz: 7dbe21778c868f208a0be7db87245426290dbee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcf1176bdcd41a50b737fff21989fea425ca1b5d3e1244e5b594bb0eea944261c8a8cf890953e7e440038d293f1f23195dc1be29d171096648cc70e24ad5abab
|
7
|
+
data.tar.gz: e07b763302be60274d510d82bab7cd53260f825260bfa5baf8a9df49c9f5b9784b585abaa1e85fe9bede599198a87fba2c70f536546e1a75edd5c413e37a7f34
|
data/lib/codebase_api.rb
CHANGED
@@ -2,7 +2,6 @@ require 'time'
|
|
2
2
|
require 'uri'
|
3
3
|
require 'net/https'
|
4
4
|
require 'json'
|
5
|
-
require 'colorize'
|
6
5
|
|
7
6
|
require "codebase_api/request"
|
8
7
|
require "codebase_api/project"
|
@@ -22,7 +21,7 @@ require "codebase_api/version"
|
|
22
21
|
|
23
22
|
module CodebaseApi
|
24
23
|
|
25
|
-
|
24
|
+
class << self
|
26
25
|
|
27
26
|
# API Authentication
|
28
27
|
attr_accessor :account_user, :api_key
|
data/lib/codebase_api/commit.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Commit
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# show all commits on a specified ref
|
7
|
+
def show(project, repo_name, ref)
|
8
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}/commits/#{ref}")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# show all commits on a specified ref for a path
|
12
|
+
def show_path(project, repo_name, ref, path)
|
13
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}/commits/#{ref}/#{path}")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
end
|
17
|
+
end
|
18
18
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Deployment
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# create a deployment for a project & repo
|
7
|
+
def create(project, repo_name, branch, revision, environment, servers)
|
8
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}/deployments", :post, {:deployment => {:branch => branch, :revision => revision, :environment => environment, :servers => servers}} )
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
end
|
12
|
+
end
|
13
13
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Discussion
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# show all discussions for a project
|
7
|
+
def all(project)
|
8
|
+
CodebaseApi::Request.request("#{project}/discussions")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# show all discussion categories for a project
|
12
|
+
def categories(project)
|
13
|
+
CodebaseApi::Request.request("#{project}/discussions/categories")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# show all the posts in a discussion for a project
|
17
|
+
def show(project, discussion_permalink)
|
18
|
+
CodebaseApi::Request.request("#{project}/discussions/#{discussion_permalink}/posts")
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
# create a new discussion for a project
|
22
|
+
def create(project, subject, content, category_id=nil)
|
23
|
+
CodebaseApi::Request.request("#{project}/discussions", :post, {:discussion => {:subject => subject, :content => content, :category_id => category_id}} )
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# update a discussion for a project
|
27
|
+
def update(project, discussion_permalink, content)
|
28
|
+
CodebaseApi::Request.request("#{project}/discussions/#{discussion_permalink}/posts", :post, {:discussion_post => {:content => content}} )
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
end
|
32
|
+
end
|
33
33
|
end
|
data/lib/codebase_api/hook.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Hook
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# list the hooks for a repository
|
7
|
+
def all(project, repo_name)
|
8
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}/hooks")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# create a hook for a project & repo
|
12
|
+
def create(project, repo_name, url, username=nil, password=nil)
|
13
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}/hooks", :post, {:repository_hook => {:url => url, :username => username, :password => password}} )
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
end
|
17
|
+
end
|
18
18
|
end
|
data/lib/codebase_api/project.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Project
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# display all projects
|
7
|
+
def all
|
8
|
+
CodebaseApi::Request.request("projects")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# create project - name is required
|
12
|
+
def create(name)
|
13
|
+
CodebaseApi::Request.request("create_project", :post, {:project => {:name => name}})
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# view a specific project
|
17
|
+
def view(project)
|
18
|
+
CodebaseApi::Request.request(project)
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
# delete a project
|
22
|
+
def delete(project)
|
23
|
+
CodebaseApi::Request.request(project, :delete)
|
24
|
+
return true
|
25
|
+
end
|
26
26
|
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
|
-
|
29
|
+
end
|
30
30
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class ProjectGroup
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# displays a list of all project groups
|
5
|
+
def self.all
|
6
|
+
CodebaseApi::Request.request("project_groups")
|
7
|
+
end
|
8
8
|
|
9
|
-
|
9
|
+
end
|
10
10
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class ProjectUser
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# list of all users assigned to a project
|
5
|
+
def self.all(project)
|
6
|
+
CodebaseApi::Request.request("#{project}/assignments")
|
7
|
+
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# assign users to a project
|
10
|
+
def self.assign(project, users)
|
11
|
+
CodebaseApi::Request.request("#{project}/assignments", :post, {:users => {:user => users } })
|
12
|
+
end
|
13
13
|
|
14
|
-
|
14
|
+
end
|
15
15
|
end
|
@@ -1,28 +1,28 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class PublicKey
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# lists all the public keys for a user
|
7
|
+
def all(username)
|
8
|
+
CodebaseApi::Request.request("users/#{username}/public_keys")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# lists all the deployment keys for a project
|
12
|
+
def deploy_keys(project)
|
13
|
+
CodebaseApi::Request.request("#{project}/public_keys")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# create a new public key for a user
|
17
|
+
def create(username, description, key)
|
18
|
+
CodebaseApi::Request.request("users/#{username}/public_keys", :post, { :public_key => { :description => description, :key => key } })
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
# create a new deployment key for a project
|
22
|
+
def create_deployment(project, description, key)
|
23
|
+
CodebaseApi::Request.request("#{project}/public_keys", :post, { :public_key => { :description => description, :key => key } })
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Repository
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# lists all the repositories for a project
|
7
|
+
def all(project)
|
8
|
+
CodebaseApi::Request.request("#{project}/repositories")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# show a specified repository for a project
|
12
|
+
def show(project, repo_name)
|
13
|
+
CodebaseApi::Request.request("#{project}/#{repo_name}")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# creates a new repository for a project
|
17
|
+
def create(project, repo_name, repo_scm)
|
18
|
+
CodebaseApi::Request.request("#{project}/repositories", :post, {:repository => {:name => repo_name, :scm => repo_scm}})
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|
data/lib/codebase_api/ticket.rb
CHANGED
@@ -1,65 +1,69 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Ticket
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# list the tickets for a project
|
7
|
+
def all(project, page_number = nil)
|
8
|
+
if page_number.is_a? Integer
|
9
|
+
CodebaseApi::Request.request("#{project}/tickets?page=#{page_number}")
|
10
|
+
else
|
11
|
+
CodebaseApi::Request.request("#{project}/tickets")
|
12
|
+
end
|
13
|
+
end
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
# search all tickets
|
16
|
+
def search(project, query)
|
17
|
+
CodebaseApi::Request.request("#{project}/tickets?query=#{query}")
|
18
|
+
end
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
# create a new ticket for a project
|
21
|
+
def create(project, summary, description)
|
22
|
+
CodebaseApi::Request.request("#{project}/tickets", :post, {:ticket => {:summary => summary, :description => description}} )
|
23
|
+
end
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
# view the notes for a ticket
|
26
|
+
def show(project, ticket_id)
|
27
|
+
CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes")
|
28
|
+
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
# show a specific note for a ticket
|
31
|
+
def show_note(project, ticket_id, note_id)
|
32
|
+
CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes/#{note_id}")
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
# create a note for a ticket
|
36
|
+
def update(project, ticket_id, content, time_added=nil, status_id=nil, priority_id=nil, category_id=nil, assignee_id=nil, summary=nil)
|
37
|
+
attributes = {:ticket_note => { :content => content, :time_added => time_added, :changes => { :status_id => status_id, :priority_id => priority_id, :category_id => category_id, :assignee_id => assignee_id, :summary => summary } } }
|
38
|
+
CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes", :post, attributes)
|
39
|
+
end
|
36
40
|
|
37
41
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
# show all ticket statuses
|
43
|
+
def statuses(project)
|
44
|
+
CodebaseApi::Request.request("#{project}/tickets/statuses")
|
45
|
+
end
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
# show all ticket priorities
|
48
|
+
def priorities(project)
|
49
|
+
CodebaseApi::Request.request("#{project}/tickets/priorities")
|
50
|
+
end
|
47
51
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
+
# show all ticket categories
|
53
|
+
def categories(project)
|
54
|
+
CodebaseApi::Request.request("#{project}/tickets/categories")
|
55
|
+
end
|
52
56
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
# show all milestones
|
58
|
+
def milestones(project)
|
59
|
+
CodebaseApi::Request.request("#{project}/milestones")
|
60
|
+
end
|
57
61
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
+
# show all watchers for a ticket
|
63
|
+
def watchers(project, ticket_id)
|
64
|
+
CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/watchers")
|
65
|
+
end
|
62
66
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,49 +1,49 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
2
|
+
class TimeSession
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# show all time sessions for a project
|
7
|
+
def all(project)
|
8
|
+
CodebaseApi::Request.request("#{project}/time_sessions")
|
9
|
+
end
|
10
|
+
|
11
|
+
# show time sessions added today for a project
|
12
|
+
def today(project)
|
13
|
+
CodebaseApi::Request.request("#{project}/time_sessions/day")
|
14
|
+
end
|
15
|
+
|
16
|
+
# show time sessions added this week for a project
|
17
|
+
def this_week(project)
|
18
|
+
CodebaseApi::Request.request("#{project}/time_sessions/week")
|
19
|
+
end
|
20
|
+
|
21
|
+
# show time sessions added this month for a project
|
22
|
+
def this_month(project)
|
23
|
+
CodebaseApi::Request.request("#{project}/time_sessions/month")
|
24
|
+
end
|
25
|
+
|
26
|
+
# create a new time session for a project
|
27
|
+
def create(project, summary, minutes)
|
28
|
+
CodebaseApi::Request.request("#{project}/time_sessions", :post, {:time_session => {:summary => summary, :minutes => minutes}} )
|
29
|
+
end
|
30
|
+
|
31
|
+
# show an existing time session for a project
|
32
|
+
def show(project, time_session)
|
33
|
+
CodebaseApi::Request.request("#{project}/time_sessions/#{time_session}")
|
34
|
+
end
|
35
|
+
|
36
|
+
# update an existing time session for a project
|
37
|
+
def update(project, time_session, summary, minutes)
|
38
|
+
CodebaseApi::Request.request("#{project}/time_sessions/#{time_session}", :put, {:time_session => {:summary => summary, :minutes => minutes}})
|
39
|
+
end
|
40
|
+
|
41
|
+
# delete an existing time session for a project
|
42
|
+
def delete(project, time_session)
|
43
|
+
CodebaseApi::Request.request("#{project}/time_sessions/#{time_session}", :delete)
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
49
|
end
|
data/lib/codebase_api/user.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class User
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# list all users
|
7
|
+
def all
|
8
|
+
CodebaseApi::Request.request("users")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# list all roles
|
12
|
+
def roles
|
13
|
+
CodebaseApi::Request.request("roles")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# create a user
|
17
|
+
def create(first_name, last_name, email_address, role_id=nil)
|
18
|
+
CodebaseApi::Request.request("users", :post, { :user => { :first_name => first_name, :last_name => last_name, :email_address => email_address, :role_id => role_id } } )
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|
data/lib/codebase_api/version.rb
CHANGED
data/lib/codebase_api/wiki.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module CodebaseApi
|
2
|
-
|
2
|
+
class Wiki
|
3
3
|
|
4
|
-
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# lists all the wiki pages for a project
|
7
|
+
def all(project)
|
8
|
+
CodebaseApi::Request.request("#{project}/wiki/index")
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# show a specified wiki page for a project
|
12
|
+
def show(project, page_name)
|
13
|
+
CodebaseApi::Request.request("#{project}/wiki/#{page_name}")
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
end
|
17
|
+
end
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebase_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem for accessing the Codebase API
|
14
14
|
email:
|