bamboo-client 0.1.8 → 0.1.9

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: 224a6b075dd5f763b1ad322838359cc57b9c089d
4
- data.tar.gz: 66e9493a34ffbb55a0824e528e2880f137b895bc
3
+ metadata.gz: b7a987904bc39ab3246172e8bab30eeb058a30ec
4
+ data.tar.gz: 0fea1f048f1ec80381f47dc94b08e8fb9f1adce0
5
5
  SHA512:
6
- metadata.gz: acabe3c2d0be4778d1bb148bde7ef10f63147aefe9a9fb51481f97e4f9bc4c8433c7ca9b90caace18a169dd6f24adda439ce642026bbe38a7cb11dffe1aed374
7
- data.tar.gz: 6c96bdb30aa662164dcf38cb3a3f786dab380675ccb635651db6c6a0d9d66094c4d2acea498cbc6e9c122478d1f54175057c30efe3bcfecdf2b22cc057d4093b
6
+ metadata.gz: ee80274a412aafe3864ed8ec0ae45dbce49ff151c136466a2b0eb0b2348cb1d611847e678d35b9005875b6451a9302a6fe314ac35a3b7cd596899e219ee4e78b
7
+ data.tar.gz: ac6e8255c6f168d4a924ce9c25c4f75b702540f391524a18654c96dbfb60aa4b6872a765177c8a6a765ea2a36cc0aa5ff6d461146e3e6e7905051a398661f362
@@ -0,0 +1,43 @@
1
+ # bamboo-client
2
+
3
+ Ruby clients for Bamboo's REST APIs:
4
+
5
+ * http://confluence.atlassian.com/display/BAMBOO/Bamboo+REST+APIs
6
+ * http://confluence.atlassian.com/display/BAMBOO/Bamboo+Remote+API (deprecated)
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ client = Bamboo::Client.for(:rest, "http://bamboo.example.com/")
12
+ client.login(user, pass) # required for some API calls
13
+
14
+ project = client.projects.first
15
+ project.key
16
+ project.url
17
+
18
+ plan = project.plans.first
19
+ plan.key
20
+ plan.enabled?
21
+
22
+ plan.queue unless plan.building?
23
+ sleep 1 until plan.building?
24
+ sleep 1 while plan.building?
25
+
26
+ result = plan.results.first
27
+ result.key
28
+ result.successful?
29
+ result.start_time
30
+ result.completed_time
31
+ result.state
32
+ # etc
33
+ ```
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
@@ -5,6 +5,7 @@ Feature: Bamboo REST client
5
5
 
6
6
  Background:
7
7
  Given I am using the REST client
8
+ And I log in
8
9
 
9
10
  Scenario: Fetch plans
10
11
  When I fetch all the plans
@@ -27,7 +28,6 @@ Feature: Bamboo REST client
27
28
  And all results should have a state
28
29
 
29
30
  Scenario: Authenticated API
30
- When I log in
31
31
  Then I should get a session ID
32
32
  When I fetch all results
33
33
  Then all results should have a state
@@ -10,6 +10,8 @@ module Bamboo
10
10
 
11
11
  private
12
12
 
13
+ # argument is only an uri if its coming from a result set.
14
+ # in this case, we don't need to prefix the path anymore.
13
15
  def uri_for(uri_or_path, params = nil)
14
16
  if uri_or_path.kind_of? URI
15
17
  u = uri_or_path.dup
@@ -19,7 +21,7 @@ module Bamboo
19
21
  u.scheme = @uri.scheme
20
22
  else
21
23
  u = uri.dup
22
- u.path = uri_or_path
24
+ u.path = File.join(uri.path, uri_or_path)
23
25
  end
24
26
 
25
27
  u.query = query_string_for(params) if params
@@ -60,7 +60,7 @@ module Bamboo
60
60
  private
61
61
 
62
62
  def get(what, params = nil)
63
- @http.get File.join(SERVICE, what), params, @cookies
63
+ @http.get File.join(SERVICE, what), params
64
64
  end
65
65
 
66
66
  class Plan
@@ -1,5 +1,5 @@
1
1
  module Bamboo
2
2
  module Client
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
@@ -0,0 +1,21 @@
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
+
3
+ module Bamboo
4
+ module Client
5
+ module Http
6
+ describe Abstract do
7
+
8
+ it 'should translate a path with prefix' do
9
+ http = Http::Abstract.new('http://example.com/bamboo')
10
+ http.send(:uri_for, '/foobar').should == 'http://example.com/bamboo/foobar'
11
+ end
12
+
13
+ it 'should translate a path without prefix' do
14
+ http = Http::Abstract.new('http://example.com/')
15
+ http.send(:uri_for, '/foobar').should == 'http://example.com/foobar'
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -23,7 +23,6 @@ module Bamboo
23
23
 
24
24
  http.should_receive(:get).with(
25
25
  "/rest/api/latest/plan/",
26
- nil,
27
26
  nil
28
27
  ).and_return(document)
29
28
 
@@ -33,7 +32,7 @@ module Bamboo
33
32
  it "should be able to fetch projects" do
34
33
  document.should_receive(:auto_expand).with(Rest::Project, http).and_return %w[foo bar]
35
34
 
36
- http.should_receive(:get).with("/rest/api/latest/project/", nil, nil).
35
+ http.should_receive(:get).with("/rest/api/latest/project/", nil).
37
36
  and_return(document)
38
37
 
39
38
  client.projects.should == %w[foo bar]
@@ -42,7 +41,7 @@ module Bamboo
42
41
  it "should be able to fetch results" do
43
42
  document.should_receive(:auto_expand).with(Rest::Result, http).and_return %w[foo bar]
44
43
 
45
- http.should_receive(:get).with("/rest/api/latest/result/", nil, nil).
44
+ http.should_receive(:get).with("/rest/api/latest/result/", nil).
46
45
  and_return(document)
47
46
 
48
47
  client.results.should == %w[foo bar]
@@ -51,7 +50,7 @@ module Bamboo
51
50
  it "should be able to fetch the queue" do
52
51
  document.should_receive(:data).and_return('some' => 'data')
53
52
 
54
- http.should_receive(:get).with("/rest/api/latest/queue/", nil, nil).
53
+ http.should_receive(:get).with("/rest/api/latest/queue/", nil).
55
54
  and_return(document)
56
55
 
57
56
  client.queue().should be_kind_of(Rest::Queue)
@@ -60,7 +59,7 @@ module Bamboo
60
59
  it "should be able to fetch results for a specific key" do
61
60
  document.should_receive(:auto_expand).with(Rest::Result, http).and_return %w[foo bar]
62
61
 
63
- http.should_receive(:get).with("/rest/api/latest/result/SOME-KEY", nil, nil).
62
+ http.should_receive(:get).with("/rest/api/latest/result/SOME-KEY", nil).
64
63
  and_return(document)
65
64
 
66
65
  client.results_for("SOME-KEY").should == %w[foo bar]
@@ -69,7 +68,7 @@ module Bamboo
69
68
  it "should be able to fetch a plan for a specific key" do
70
69
  document.should_receive(:data).and_return('some' => 'data')
71
70
 
72
- http.should_receive(:get).with("/rest/api/latest/plan/SOME-KEY", nil, nil).
71
+ http.should_receive(:get).with("/rest/api/latest/plan/SOME-KEY", nil).
73
72
  and_return(document)
74
73
 
75
74
  client.plan_for("SOME-KEY").should be_kind_of(Rest::Plan)
@@ -79,7 +78,7 @@ module Bamboo
79
78
  it "should be able to fetch a project for a specific key" do
80
79
  document.should_receive(:data).and_return('some' => 'data')
81
80
 
82
- http.should_receive(:get).with("/rest/api/latest/project/SOME-KEY", nil, nil).
81
+ http.should_receive(:get).with("/rest/api/latest/project/SOME-KEY", nil).
83
82
  and_return(document)
84
83
 
85
84
  client.project_for("SOME-KEY").should be_kind_of(Rest::Project)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bamboo-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-10 00:00:00.000000000 Z
12
+ date: 2014-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2.5'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2.5'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: cucumber
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.10.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.10.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: simplecov
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0.9'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0.9'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: json
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - '>='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: nokogiri
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - '>='
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - '>='
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  description: Ruby client for Atlassian Bamboo's REST APIs
@@ -117,12 +117,12 @@ executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - ".gitignore"
121
- - ".rspec"
122
- - ".travis.yml"
120
+ - .gitignore
121
+ - .rspec
122
+ - .travis.yml
123
123
  - Gemfile
124
124
  - LICENSE
125
- - README
125
+ - README.md
126
126
  - Rakefile
127
127
  - bamboo-client.gemspec
128
128
  - cucumber.yml
@@ -141,6 +141,7 @@ files:
141
141
  - lib/bamboo-client/rest.rb
142
142
  - lib/bamboo-client/version.rb
143
143
  - spec/bamboo-client/client_spec.rb
144
+ - spec/bamboo-client/http/abstract_spec.rb
144
145
  - spec/bamboo-client/http/json_spec.rb
145
146
  - spec/bamboo-client/http/xml_spec.rb
146
147
  - spec/bamboo-client/remote_spec.rb
@@ -166,17 +167,17 @@ require_paths:
166
167
  - lib
167
168
  required_ruby_version: !ruby/object:Gem::Requirement
168
169
  requirements:
169
- - - ">="
170
+ - - '>='
170
171
  - !ruby/object:Gem::Version
171
172
  version: '0'
172
173
  required_rubygems_version: !ruby/object:Gem::Requirement
173
174
  requirements:
174
- - - ">="
175
+ - - '>='
175
176
  - !ruby/object:Gem::Version
176
177
  version: '0'
177
178
  requirements: []
178
179
  rubyforge_project: bamboo-client
179
- rubygems_version: 2.2.0
180
+ rubygems_version: 2.0.14
180
181
  signing_key:
181
182
  specification_version: 4
182
183
  summary: Ruby client for Atlassian Bamboo's REST APIs
@@ -187,6 +188,7 @@ test_files:
187
188
  - features/step_definitions/rest_steps.rb
188
189
  - features/support/env.rb
189
190
  - spec/bamboo-client/client_spec.rb
191
+ - spec/bamboo-client/http/abstract_spec.rb
190
192
  - spec/bamboo-client/http/json_spec.rb
191
193
  - spec/bamboo-client/http/xml_spec.rb
192
194
  - spec/bamboo-client/remote_spec.rb
data/README DELETED
@@ -1,4 +0,0 @@
1
- Ruby clients for Bamboo's REST APIs:
2
-
3
- * http://confluence.atlassian.com/display/BAMBOO/Bamboo+Remote+API (deprecated)
4
- * http://confluence.atlassian.com/display/BAMBOO/Bamboo+REST+APIs (new and shiny)