codeship 0.0.1 → 0.1.0

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: 4c96abc691be0f401dd8528c406afe2ff99661a7
4
- data.tar.gz: 769b3d638609809493e21c42bb7a88273d668c5a
3
+ metadata.gz: 8870941766ed03f6b88b3dbc263d69aef8630f9c
4
+ data.tar.gz: 1ab6695a79d5bb811c315856bc24282eceeb6df3
5
5
  SHA512:
6
- metadata.gz: 7aa3d3e611fbb4915acdb23e6f342751e9695770256a3592085bc7c2e7a36eb6256a0561b0a9bc71bfcef8347592458807980176f5e7348633a14fa746a4c089
7
- data.tar.gz: c01e116887936929259624d023b23dab5924e88ea980e1887b80852a09d232f2d8461105b5575ea746d46806b17db4d9707cb96e1628ea06aea3f3fb05f5abe8
6
+ metadata.gz: 35e89ddeea3a42db4ac6503d09484c61f26af35fc5dba415bc76b215dbe552e3f4aef9306b8d2c1bd9db0208297e87b9ed7a0f7b36f0cc04a6acabede102fa22
7
+ data.tar.gz: 4ebfa11010d02440c2fbb633d6ef96e08164d78b13861f84a93f33f647b54410d4080befb0462b6b563deeca47e6457d309a3384ae704d9c57c962d60b6a705b
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Codeship
2
2
 
3
- interact with Codeship
3
+ interact with Codeship.
4
+
5
+ ![Build Status](https://www.codeship.io/projects/e8bf3890-ee53-0130-957a-52ea4b2c7608/status)
6
+
4
7
 
5
8
  ## Installation
6
9
 
@@ -28,6 +31,17 @@ Or install it yourself as:
28
31
  project_status = Codeship::Status.new "my_project_uuid", branch: "development"
29
32
  project_status.status #=> :error
30
33
 
34
+ ### Get a list of your available projects
35
+
36
+ projects = Codeship::Projects.new "my_api_key"
37
+ projects.list #=> [{"id"=>1, "builds"=>[], "repository_name"=>"abcd/repo-name"}, {"id"=>2, "builds"=>[], "repository_name"=>"abcd/another-repo-name"}]
38
+
39
+ ### Get a single project
40
+
41
+ projects = Codeship::Projects.new "my_api_key"
42
+ projects.project 1 #=> {"id"=>1, "builds"=>[], "repository_name"=>"abcd/repo-name"}
43
+
44
+
31
45
  ### States
32
46
 
33
47
  :branchnotfound, :error, :ignored, :projectnotfound, :success, :testing, :waiting
@@ -39,3 +53,18 @@ Or install it yourself as:
39
53
  3. Commit your changes (`git commit -am 'Add some feature'`)
40
54
  4. Push to the branch (`git push origin my-new-feature`)
41
55
  5. Create new Pull Request
56
+
57
+ ## Disclaimer
58
+
59
+ We cannot garantuee any compatibilty with upcoming versions of this Gem.
60
+
61
+
62
+ ## License
63
+
64
+ Copyright (c) 2011 Benjamin Fritsch, Codeship.
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
69
+
70
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "Open an irb session preloaded with this library"
4
+ task :console do
5
+ sh "irb -rubygems -I lib -r codeship.rb"
6
+ end
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "json"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  spec.add_development_dependency "rspec", "~> 2.9"
@@ -1,5 +1,6 @@
1
1
  require "codeship/version"
2
2
  require "codeship/status"
3
+ require "codeship/projects"
3
4
 
4
5
  module Codeship
5
6
  end
@@ -0,0 +1,36 @@
1
+ require "codeship/request"
2
+ require "codeship/response"
3
+
4
+ module Codeship
5
+ class Projects
6
+
7
+ include Request
8
+ include Response
9
+
10
+ def initialize api_key = nil
11
+ @api_key = api_key
12
+ end
13
+
14
+ def list
15
+ raise ArgumentError, 'You need to set API key' if !@api_key
16
+ resp = http_request.request_get projects_url
17
+ handle(resp)['projects']
18
+ end
19
+
20
+ def project id
21
+ raise ArgumentError, 'You need to set API key' if !@api_key
22
+ @project_id = id
23
+ resp = http_request.request_get projects_url
24
+ handle(resp)
25
+ end
26
+
27
+ private
28
+
29
+ def projects_url
30
+ url = "/api/v1/projects.json"
31
+ url = "/api/v1/projects/#{@project_id}.json" if @project_id
32
+ url << "?api_key=#{@api_key}"
33
+ url
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,13 @@
1
+ require 'net/http'
2
+
3
+ module Codeship
4
+ module Request
5
+
6
+ def http_request
7
+ http = Net::HTTP.new "www.codeship.io", 443
8
+ http.use_ssl = true
9
+ http
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module Codeship
5
+ module Response
6
+
7
+ def handle resp
8
+ resp.value()
9
+ JSON.parse resp.body
10
+ end
11
+
12
+ end
13
+ end
@@ -1,7 +1,10 @@
1
- require 'net/http'
1
+ require "codeship/request"
2
2
 
3
3
  module Codeship
4
4
  class Status
5
+
6
+ include Request
7
+
5
8
  STATES = [:branchnotfound, :error, :ignored, :projectnotfound,
6
9
  :success, :testing, :waiting]
7
10
 
@@ -30,10 +33,5 @@ module Codeship
30
33
  url
31
34
  end
32
35
 
33
- def http_request
34
- http = Net::HTTP.new "www.codeship.io", 443
35
- http.use_ssl = true
36
- http
37
- end
38
36
  end
39
37
  end
@@ -1,3 +1,3 @@
1
1
  module Codeship
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,83 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - beanieboi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-23 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ~>
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
33
  version: '1.3'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ~>
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: '1.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ~>
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
61
  version: '2.9'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ~>
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '2.9'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: vcr
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ~>
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
75
  version: '2.5'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ~>
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '2.5'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: webmock
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  description: easily interact with Codeship.io
@@ -87,13 +101,16 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
- - .gitignore
104
+ - ".gitignore"
91
105
  - Gemfile
92
106
  - LICENSE.txt
93
107
  - README.md
94
108
  - Rakefile
95
109
  - codeship.gemspec
96
110
  - lib/codeship.rb
111
+ - lib/codeship/projects.rb
112
+ - lib/codeship/request.rb
113
+ - lib/codeship/response.rb
97
114
  - lib/codeship/status.rb
98
115
  - lib/codeship/version.rb
99
116
  - spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_branchnotfound.yml
@@ -122,17 +139,17 @@ require_paths:
122
139
  - lib
123
140
  required_ruby_version: !ruby/object:Gem::Requirement
124
141
  requirements:
125
- - - '>='
142
+ - - ">="
126
143
  - !ruby/object:Gem::Version
127
144
  version: '0'
128
145
  required_rubygems_version: !ruby/object:Gem::Requirement
129
146
  requirements:
130
- - - '>='
147
+ - - ">="
131
148
  - !ruby/object:Gem::Version
132
149
  version: '0'
133
150
  requirements: []
134
151
  rubyforge_project:
135
- rubygems_version: 2.0.2
152
+ rubygems_version: 2.2.2
136
153
  signing_key:
137
154
  specification_version: 4
138
155
  summary: easily interact with Codeship.io