circleci 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/circleci/http.rb +16 -9
- 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: 56752aa45d0cbe1900d78d9c28cd8853bd2b2ce1
|
4
|
+
data.tar.gz: 69ed9d12c41bf0c91a6f786e437ba9e39e280ab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cb8afeb58f84945beb66d68366c7030405b82d8e45646270a3c8bc49104df777eba1386ccd993597f6e5535e41510efb3c5ac729cfcf1b8e9b696babfec9bf1
|
7
|
+
data.tar.gz: 8b08af6be955cd0a5f62cbd5ec652e70d2da52fcbdedeebfce20870a440c6c7a4b65a09bb61322e914cfb3d38b7dc8c40c05573d034bed753328bdf2e04574c2
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ circleci
|
|
2
2
|
========
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/mtchavez/circleci.png)](https://travis-ci.org/mtchavez/circleci)
|
5
|
-
[![
|
5
|
+
[![Code Climate](https://codeclimate.com/github/mtchavez/circleci.png)](https://codeclimate.com/github/mtchavez/circleci)
|
6
6
|
|
7
7
|
Circle CI API Wrapper
|
8
8
|
|
data/lib/circleci/http.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module CircleCi
|
2
4
|
|
3
5
|
class Http # @private
|
@@ -32,24 +34,29 @@ module CircleCi
|
|
32
34
|
url = "#{@config.host}#{path}"
|
33
35
|
args = [http_verb, url, headers]
|
34
36
|
|
35
|
-
|
36
|
-
body = res.body
|
37
|
+
RestClient.send(*args) do |res, req, raw_res|
|
38
|
+
body = res.body.to_s
|
39
|
+
body.force_encoding(Encoding::UTF_8)
|
37
40
|
code = raw_res.code.to_i
|
38
41
|
|
39
42
|
self.response = body
|
40
43
|
self.errors = []
|
41
44
|
|
42
|
-
|
43
|
-
self.response = JSON.parse(body) rescue body
|
44
|
-
self.success = true
|
45
|
-
else
|
46
|
-
self.errors << RequestError.new(body, code, path)
|
47
|
-
end
|
48
|
-
|
45
|
+
handle_response(body, code, path)
|
49
46
|
Response.new(self, code, path)
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
50
|
+
def handle_response(body, code, path)
|
51
|
+
parsed = JSON.parse(body) rescue nil
|
52
|
+
if parsed && code == 200
|
53
|
+
self.response = parsed
|
54
|
+
self.success = true
|
55
|
+
else
|
56
|
+
self.errors << RequestError.new(body, code, path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
53
60
|
end
|
54
61
|
|
55
62
|
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.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|