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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7208f3f18df2644b3898b69d9a8861c00e9af32
4
- data.tar.gz: e56577955414b9dfa0946e28960a671f98570eb6
3
+ metadata.gz: 59ad9e77c7140e0fe6944f765891562f11ea9072
4
+ data.tar.gz: 7dbe21778c868f208a0be7db87245426290dbee7
5
5
  SHA512:
6
- metadata.gz: c199c26478fc4fd804b9c9f973a17ef3b1eacfb2cbc2c36d5b49055f91261dec6b1b66972de37ea3b7e3f6abf0cc2bc588fab57a493057635e421b8007a3aade
7
- data.tar.gz: 7d13cd7bca41cacb529b57957f57c31c1c6cc2beb8e019ae22c502d7c78d26e0f35834b94e44d4860c17dac58260708a3b05ee910ad8f56a0162b3f704b3d624
6
+ metadata.gz: bcf1176bdcd41a50b737fff21989fea425ca1b5d3e1244e5b594bb0eea944261c8a8cf890953e7e440038d293f1f23195dc1be29d171096648cc70e24ad5abab
7
+ data.tar.gz: e07b763302be60274d510d82bab7cd53260f825260bfa5baf8a9df49c9f5b9784b585abaa1e85fe9bede599198a87fba2c70f536546e1a75edd5c413e37a7f34
@@ -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
- class << self
24
+ class << self
26
25
 
27
26
  # API Authentication
28
27
  attr_accessor :account_user, :api_key
@@ -1,18 +1,18 @@
1
1
  module CodebaseApi
2
- class Commit
2
+ class Commit
3
3
 
4
- class << self
4
+ class << self
5
5
 
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
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
- # 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
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
- end
17
- end
16
+ end
17
+ end
18
18
  end
@@ -1,13 +1,13 @@
1
1
  module CodebaseApi
2
- class Deployment
2
+ class Deployment
3
3
 
4
- class << self
4
+ class << self
5
5
 
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
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
- end
12
- end
11
+ end
12
+ end
13
13
  end
@@ -1,33 +1,33 @@
1
1
  module CodebaseApi
2
- class Discussion
2
+ class Discussion
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # show all discussions for a project
7
- def all(project)
8
- CodebaseApi::Request.request("#{project}/discussions")
9
- end
6
+ # show all discussions for a project
7
+ def all(project)
8
+ CodebaseApi::Request.request("#{project}/discussions")
9
+ end
10
10
 
11
- # show all discussion categories for a project
12
- def categories(project)
13
- CodebaseApi::Request.request("#{project}/discussions/categories")
14
- end
11
+ # show all discussion categories for a project
12
+ def categories(project)
13
+ CodebaseApi::Request.request("#{project}/discussions/categories")
14
+ end
15
15
 
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
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
- # 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
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
- # 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
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
- end
32
- end
31
+ end
32
+ end
33
33
  end
@@ -1,18 +1,18 @@
1
1
  module CodebaseApi
2
- class Hook
2
+ class Hook
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # list the hooks for a repository
7
- def all(project, repo_name)
8
- CodebaseApi::Request.request("#{project}/#{repo_name}/hooks")
9
- end
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
- # 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
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
- end
17
- end
16
+ end
17
+ end
18
18
  end
@@ -1,30 +1,30 @@
1
1
  module CodebaseApi
2
- class Project
2
+ class Project
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # display all projects
7
- def all
8
- CodebaseApi::Request.request("projects")
9
- end
6
+ # display all projects
7
+ def all
8
+ CodebaseApi::Request.request("projects")
9
+ end
10
10
 
11
- # create project - name is required
12
- def create(name)
13
- CodebaseApi::Request.request("create_project", :post, {:project => {:name => name}})
14
- end
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
- # view a specific project
17
- def view(project)
18
- CodebaseApi::Request.request(project)
19
- end
16
+ # view a specific project
17
+ def view(project)
18
+ CodebaseApi::Request.request(project)
19
+ end
20
20
 
21
- # delete a project
22
- def delete(project)
23
- CodebaseApi::Request.request(project, :delete)
24
- return true
25
- end
21
+ # delete a project
22
+ def delete(project)
23
+ CodebaseApi::Request.request(project, :delete)
24
+ return true
25
+ end
26
26
 
27
- end
27
+ end
28
28
 
29
- end
29
+ end
30
30
  end
@@ -1,10 +1,10 @@
1
1
  module CodebaseApi
2
- class ProjectGroup
2
+ class ProjectGroup
3
3
 
4
- # displays a list of all project groups
5
- def self.all
6
- CodebaseApi::Request.request("project_groups")
7
- end
4
+ # displays a list of all project groups
5
+ def self.all
6
+ CodebaseApi::Request.request("project_groups")
7
+ end
8
8
 
9
- end
9
+ end
10
10
  end
@@ -1,15 +1,15 @@
1
1
  module CodebaseApi
2
- class ProjectUser
2
+ class ProjectUser
3
3
 
4
- # list of all users assigned to a project
5
- def self.all(project)
6
- CodebaseApi::Request.request("#{project}/assignments")
7
- end
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
- # assign users to a project
10
- def self.assign(project, users)
11
- CodebaseApi::Request.request("#{project}/assignments", :post, {:users => {:user => users } })
12
- end
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
- end
14
+ end
15
15
  end
@@ -1,28 +1,28 @@
1
1
  module CodebaseApi
2
- class PublicKey
2
+ class PublicKey
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # lists all the public keys for a user
7
- def all(username)
8
- CodebaseApi::Request.request("users/#{username}/public_keys")
9
- end
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
- # lists all the deployment keys for a project
12
- def deploy_keys(project)
13
- CodebaseApi::Request.request("#{project}/public_keys")
14
- end
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
- # 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
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
- # 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
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
- end
27
- end
26
+ end
27
+ end
28
28
  end
@@ -1,23 +1,23 @@
1
1
  module CodebaseApi
2
- class Repository
2
+ class Repository
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # lists all the repositories for a project
7
- def all(project)
8
- CodebaseApi::Request.request("#{project}/repositories")
9
- end
6
+ # lists all the repositories for a project
7
+ def all(project)
8
+ CodebaseApi::Request.request("#{project}/repositories")
9
+ end
10
10
 
11
- # show a specified repository for a project
12
- def show(project, repo_name)
13
- CodebaseApi::Request.request("#{project}/#{repo_name}")
14
- end
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
- # 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
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
- end
22
- end
21
+ end
22
+ end
23
23
  end
@@ -1,65 +1,69 @@
1
1
  module CodebaseApi
2
- class Ticket
2
+ class Ticket
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # list the tickets for a project
7
- def all(project)
8
- CodebaseApi::Request.request("#{project}/tickets")
9
- end
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
- # search all tickets
12
- def search(project, query)
13
- CodebaseApi::Request.request("#{project}/tickets?query=#{query}")
14
- end
15
+ # search all tickets
16
+ def search(project, query)
17
+ CodebaseApi::Request.request("#{project}/tickets?query=#{query}")
18
+ end
15
19
 
16
- # create a new ticket for a project
17
- def create(project, summary, description)
18
- CodebaseApi::Request.request("#{project}/tickets", :post, {:ticket => {:summary => summary, :description => description}} )
19
- end
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
- # view the notes for a ticket
22
- def show(project, ticket_id)
23
- CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes")
24
- end
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
- # show a specific note for a ticket
27
- def show_note(project, ticket_id, note_id)
28
- CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes/#{note_id}")
29
- end
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
- # create a note for a ticket
32
- def update(project, ticket_id, content, time_added=nil, status_id=nil, priority_id=nil, category_id=nil, assignee_id=nil, summary=nil)
33
- 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 } } }
34
- CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/notes", :post, attributes)
35
- end
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
- # show all ticket statuses
39
- def statuses(project)
40
- CodebaseApi::Request.request("#{project}/tickets/statuses")
41
- end
42
+ # show all ticket statuses
43
+ def statuses(project)
44
+ CodebaseApi::Request.request("#{project}/tickets/statuses")
45
+ end
42
46
 
43
- # show all ticket priorities
44
- def priorities(project)
45
- CodebaseApi::Request.request("#{project}/tickets/priorities")
46
- end
47
+ # show all ticket priorities
48
+ def priorities(project)
49
+ CodebaseApi::Request.request("#{project}/tickets/priorities")
50
+ end
47
51
 
48
- # show all ticket categories
49
- def categories(project)
50
- CodebaseApi::Request.request("#{project}/tickets/categories")
51
- end
52
+ # show all ticket categories
53
+ def categories(project)
54
+ CodebaseApi::Request.request("#{project}/tickets/categories")
55
+ end
52
56
 
53
- # show all milestones
54
- def milestones(project)
55
- CodebaseApi::Request.request("#{project}/milestones")
56
- end
57
+ # show all milestones
58
+ def milestones(project)
59
+ CodebaseApi::Request.request("#{project}/milestones")
60
+ end
57
61
 
58
- # show all watchers for a ticket
59
- def watchers(project, ticket_id)
60
- CodebaseApi::Request.request("#{project}/tickets/#{ticket_id}/watchers")
61
- end
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
- end
64
- end
65
- end
67
+ end
68
+ end
69
+ end
@@ -1,49 +1,49 @@
1
1
  module CodebaseApi
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
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
@@ -1,23 +1,23 @@
1
1
  module CodebaseApi
2
- class User
2
+ class User
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # list all users
7
- def all
8
- CodebaseApi::Request.request("users")
9
- end
6
+ # list all users
7
+ def all
8
+ CodebaseApi::Request.request("users")
9
+ end
10
10
 
11
- # list all roles
12
- def roles
13
- CodebaseApi::Request.request("roles")
14
- end
11
+ # list all roles
12
+ def roles
13
+ CodebaseApi::Request.request("roles")
14
+ end
15
15
 
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
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
- end
22
- end
21
+ end
22
+ end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module CodebaseApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -1,18 +1,18 @@
1
1
  module CodebaseApi
2
- class Wiki
2
+ class Wiki
3
3
 
4
- class << self
4
+ class << self
5
5
 
6
- # lists all the wiki pages for a project
7
- def all(project)
8
- CodebaseApi::Request.request("#{project}/wiki/index")
9
- end
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
- # show a specified wiki page for a project
12
- def show(project, page_name)
13
- CodebaseApi::Request.request("#{project}/wiki/#{page_name}")
14
- end
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
- end
17
- end
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.2
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-07-08 00:00:00.000000000 Z
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: