codeship 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codeship.rb +1 -0
  3. data/lib/codeship/builds.rb +32 -0
  4. data/lib/codeship/request.rb +1 -1
  5. data/lib/codeship/version.rb +1 -1
  6. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_branchnotfound.yml +1 -1
  7. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_error.yml +1 -1
  8. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_ignored.yml +1 -1
  9. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_projectnotfound.yml +1 -1
  10. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_success.yml +1 -1
  11. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_testing.yml +1 -1
  12. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_waiting.yml +1 -1
  13. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_branchnotfound.yml +1 -1
  14. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_error.yml +1 -1
  15. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_ignored.yml +1 -1
  16. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_projectnotfound.yml +1 -1
  17. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_success.yml +1 -1
  18. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_testing.yml +1 -1
  19. data/spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_waiting.yml +1 -1
  20. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8870941766ed03f6b88b3dbc263d69aef8630f9c
4
- data.tar.gz: 1ab6695a79d5bb811c315856bc24282eceeb6df3
3
+ metadata.gz: bcef7bc29d8fb79231f4281d71218fb87eecc3dc
4
+ data.tar.gz: 1e6a919cec8cd8b263dce813a1567574d2c2046c
5
5
  SHA512:
6
- metadata.gz: 35e89ddeea3a42db4ac6503d09484c61f26af35fc5dba415bc76b215dbe552e3f4aef9306b8d2c1bd9db0208297e87b9ed7a0f7b36f0cc04a6acabede102fa22
7
- data.tar.gz: 4ebfa11010d02440c2fbb633d6ef96e08164d78b13861f84a93f33f647b54410d4080befb0462b6b563deeca47e6457d309a3384ae704d9c57c962d60b6a705b
6
+ metadata.gz: 6c9b7cbd603f275ffe172f7999d44e070a350a579abd6485c27e62c6a07959639fc5a2d652bb46c9d0b99458972ca45da522e915cb90e7f77002ae45710c726d
7
+ data.tar.gz: be86da7c6036853745f444dca0fce4be78e32dc932fbd7bc9d05642897e07882df0405fa623e93892d376de96992f89938c180ec6fc963b8cab28a31eafce615
@@ -1,6 +1,7 @@
1
1
  require "codeship/version"
2
2
  require "codeship/status"
3
3
  require "codeship/projects"
4
+ require "codeship/builds"
4
5
 
5
6
  module Codeship
6
7
  end
@@ -0,0 +1,32 @@
1
+ require "codeship/request"
2
+ require "codeship/response"
3
+
4
+ module Codeship
5
+ class Builds
6
+
7
+ include Request
8
+ include Response
9
+
10
+ def initialize api_key = nil
11
+ @api_key = api_key
12
+ end
13
+
14
+ def restart id
15
+ raise ArgumentError, 'You need to set API key' if !@api_key
16
+ @build_id = id
17
+ @action = 'restart'
18
+ resp = http_request.request_post builds_url, ''
19
+ handle(resp)
20
+ end
21
+
22
+ private
23
+
24
+ def builds_url
25
+ url = "/api/v1/builds.json"
26
+ url = "/api/v1/builds/#{@build_id}.json" if @build_id
27
+ url = "/api/v1/builds/#{@build_id}/#{@action}.json" if @build_id && @action
28
+ url << "?api_key=#{@api_key}"
29
+ url
30
+ end
31
+ end
32
+ end
@@ -4,7 +4,7 @@ module Codeship
4
4
  module Request
5
5
 
6
6
  def http_request
7
- http = Net::HTTP.new "www.codeship.io", 443
7
+ http = Net::HTTP.new "codeship.com", 443
8
8
  http.use_ssl = true
9
9
  http
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module Codeship
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/branchnotfound/status
5
+ uri: https://codeship.com/projects/branchnotfound/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/error/status
5
+ uri: https://codeship.com/projects/error/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/ignored/status
5
+ uri: https://codeship.com/projects/ignored/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/projectnotfound/status
5
+ uri: https://codeship.com/projects/projectnotfound/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/success/status
5
+ uri: https://codeship.com/projects/success/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/testing/status
5
+ uri: https://codeship.com/projects/testing/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/waiting/status
5
+ uri: https://codeship.com/projects/waiting/status
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/branchnotfound/status?branch=master
5
+ uri: https://codeship.com/projects/branchnotfound/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/error/status?branch=master
5
+ uri: https://codeship.com/projects/error/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/ignored/status?branch=master
5
+ uri: https://codeship.com/projects/ignored/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/projectnotfound/status?branch=master
5
+ uri: https://codeship.com/projects/projectnotfound/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/success/status?branch=master
5
+ uri: https://codeship.com/projects/success/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/testing/status?branch=master
5
+ uri: https://codeship.com/projects/testing/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: head
5
- uri: https://www.codeship.io/projects/waiting/status?branch=master
5
+ uri: https://codeship.com/projects/waiting/status?branch=master
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - beanieboi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -108,6 +108,7 @@ files:
108
108
  - Rakefile
109
109
  - codeship.gemspec
110
110
  - lib/codeship.rb
111
+ - lib/codeship/builds.rb
111
112
  - lib/codeship/projects.rb
112
113
  - lib/codeship/request.rb
113
114
  - lib/codeship/response.rb