circleci 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56752aa45d0cbe1900d78d9c28cd8853bd2b2ce1
4
- data.tar.gz: 69ed9d12c41bf0c91a6f786e437ba9e39e280ab1
3
+ metadata.gz: bc2019b8f6353ddcaf0261b8c3daa78f1e53544d
4
+ data.tar.gz: b83a8a28c1838a0942a639f344b481202cd0800c
5
5
  SHA512:
6
- metadata.gz: 0cb8afeb58f84945beb66d68366c7030405b82d8e45646270a3c8bc49104df777eba1386ccd993597f6e5535e41510efb3c5ac729cfcf1b8e9b696babfec9bf1
7
- data.tar.gz: 8b08af6be955cd0a5f62cbd5ec652e70d2da52fcbdedeebfce20870a440c6c7a4b65a09bb61322e914cfb3d38b7dc8c40c05573d034bed753328bdf2e04574c2
6
+ metadata.gz: f19c2766cad2045ff29bd1d2040a186318a86a3b98e0325ba3bc1302b8cc428c0bdc07dcc7c209bde006ae3499b63ef16a993f05e1bf1c1f127d0947a1210487
7
+ data.tar.gz: 9852e587d7bf08278ef705722c0cdd7ad9b95172825349e294300073629963f9c0a2de7591c3c95064c87f62ee951a100dd5a8194443d041d2ca76cdaf214caf
@@ -8,10 +8,9 @@ module CircleCi
8
8
 
9
9
  VERSION = 'v1'
10
10
  DEFAULT_HOST = "https://circleci.com/api/#{VERSION}"
11
- DEFAULT_PORT = 80 # @private
11
+ DEFAULT_PORT = 80
12
12
 
13
- attr_accessor :token
14
- attr_reader :host, :port # @private
13
+ attr_accessor :token, :host, :port
15
14
 
16
15
  ##
17
16
  #
data/lib/circleci/http.rb CHANGED
@@ -49,7 +49,7 @@ module CircleCi
49
49
 
50
50
  def handle_response(body, code, path)
51
51
  parsed = JSON.parse(body) rescue nil
52
- if parsed && code == 200
52
+ if parsed && (200..299).include?(code)
53
53
  self.response = parsed
54
54
  self.success = true
55
55
  else
@@ -28,6 +28,18 @@ module CircleCi
28
28
  CircleCi.http.get "/project/#{username}/#{project}"
29
29
  end
30
30
 
31
+ ##
32
+ #
33
+ # Build the latest master push for this project
34
+ #
35
+ # @param username [String] - User or org name who owns project
36
+ # @param project [String] - Name of project
37
+ # @return [CircleCi::Response] - Response object
38
+
39
+ def self.build username, project
40
+ CircleCi.http.post "/project/#{username}/#{project}"
41
+ end
42
+
31
43
  ##
32
44
  #
33
45
  # Get all recent builds for a specific branch of a project
@@ -53,6 +65,54 @@ module CircleCi
53
65
  CircleCi.http.delete "/project/#{username}/#{project}/build-cache"
54
66
  end
55
67
 
68
+ ##
69
+ #
70
+ # Enable a project in CircleCI. Causes a CircleCI SSH key to be added to the GitHub. Requires admin privilege to the repository.
71
+ #
72
+ # @param username [String] - User or org name who owns project
73
+ # @param project [String] - Name of project
74
+ # @return [CircleCi::Response] - Response object
75
+
76
+ def self.enable username, project
77
+ CircleCi.http.post "/project/#{username}/#{project}/enable"
78
+ end
79
+
80
+ ##
81
+ #
82
+ # Follow the project
83
+ #
84
+ # @param username [String] - User or org name who owns project
85
+ # @param project [String] - Name of project
86
+ # @return [CircleCi::Response] - Response object
87
+
88
+ def self.follow username, project
89
+ CircleCi.http.post "/project/#{username}/#{project}/follow"
90
+ end
91
+
92
+ ##
93
+ #
94
+ # Unfollow the project
95
+ #
96
+ # @param username [String] - User or org name who owns project
97
+ # @param project [String] - Name of project
98
+ # @return [CircleCi::Response] - Response object
99
+
100
+ def self.unfollow username, project
101
+ CircleCi.http.post "/project/#{username}/#{project}/unfollow"
102
+ end
103
+
104
+ ##
105
+ #
106
+ # Get the project configuration
107
+ #
108
+ # @param username [String] - User or org name who owns project
109
+ # @param project [String] - Name of project
110
+ # @return [CircleCi::Response] - Response object
111
+
112
+ def self.settings username, project
113
+ CircleCi.http.get "/project/#{username}/#{project}/settings"
114
+ end
115
+
56
116
  end
57
117
 
58
118
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chavez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie