gitlab 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,5 +9,6 @@ module Gitlab
9
9
  include Gitlab::Client::Snippets
10
10
  include Gitlab::Client::Projects
11
11
  include Gitlab::Client::Repositories
12
+ include Gitlab::Client::MergeRequests
12
13
  end
13
14
  end
@@ -0,0 +1,32 @@
1
+ class Gitlab::Client
2
+ # Defines methods related to merge requests.
3
+ module MergeRequests
4
+ # Gets a list of project merge requests.
5
+ #
6
+ # @example
7
+ # Gitlab.merge_requests(5)
8
+ # Gitlab.merge_requests('gitlab', :per_page => 40)
9
+ #
10
+ # @param [Integer, String] project The ID or code name of a project.
11
+ # @param [Hash] options A customizable set of options.
12
+ # @option options [Integer] :page The page number.
13
+ # @option options [Integer] :per_page The number of results per page.
14
+ # @return [Array<Gitlab::ObjectifiedHash>]
15
+ def merge_requests(project, options={})
16
+ get("/projects/#{project}/merge_requests", :query => options)
17
+ end
18
+
19
+ # Gets a single merge request.
20
+ #
21
+ # @example
22
+ # Gitlab.merge_request(5, 36)
23
+ # Gitlab.merge_request('gitlab', 42)
24
+ #
25
+ # @param [Integer, String] project The ID or code name of a project.
26
+ # @param [Integer] id The ID of a merge request.
27
+ # @return [Array<Gitlab::ObjectifiedHash>]
28
+ def merge_request(project, id)
29
+ get("/projects/#{project}/merge_request/#{id}")
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module Gitlab
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -0,0 +1 @@
1
+ {"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}
@@ -0,0 +1 @@
1
+ [{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}]
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gitlab::Client do
4
+ describe ".merge_requests" do
5
+ before do
6
+ stub_get("/projects/3/merge_requests", "merge_requests")
7
+ @merge_requests = Gitlab.merge_requests(3)
8
+ end
9
+
10
+ it "should get the correct resource" do
11
+ a_get("/projects/3/merge_requests").should have_been_made
12
+ end
13
+
14
+ it "should return an array of project's merge requests" do
15
+ @merge_requests.should be_an Array
16
+ @merge_requests.first.project_id.should == 3
17
+ end
18
+ end
19
+
20
+ describe ".merge_request" do
21
+ before do
22
+ stub_get("/projects/3/merge_request/1", "merge_request")
23
+ @merge_request = Gitlab.merge_request(3, 1)
24
+ end
25
+
26
+ it "should get the correct resource" do
27
+ a_get("/projects/3/merge_request/1").should have_been_made
28
+ end
29
+
30
+ it "should return information about a merge request" do
31
+ @merge_request.project_id.should == 3
32
+ @merge_request.assignee.name.should == "Jack Smith"
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-22 00:00:00.000000000 Z
12
+ date: 2012-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -93,6 +93,7 @@ files:
93
93
  - lib/gitlab/api.rb
94
94
  - lib/gitlab/client.rb
95
95
  - lib/gitlab/client/issues.rb
96
+ - lib/gitlab/client/merge_requests.rb
96
97
  - lib/gitlab/client/milestones.rb
97
98
  - lib/gitlab/client/projects.rb
98
99
  - lib/gitlab/client/repositories.rb
@@ -107,6 +108,8 @@ files:
107
108
  - spec/fixtures/issues.json
108
109
  - spec/fixtures/key.json
109
110
  - spec/fixtures/keys.json
111
+ - spec/fixtures/merge_request.json
112
+ - spec/fixtures/merge_requests.json
110
113
  - spec/fixtures/milestone.json
111
114
  - spec/fixtures/milestones.json
112
115
  - spec/fixtures/project.json
@@ -126,6 +129,7 @@ files:
126
129
  - spec/fixtures/user.json
127
130
  - spec/fixtures/users.json
128
131
  - spec/gitlab/client/issues_spec.rb
132
+ - spec/gitlab/client/merge_requests_spec.rb
129
133
  - spec/gitlab/client/milestones_spec.rb
130
134
  - spec/gitlab/client/projects_spec.rb
131
135
  - spec/gitlab/client/repositories_spec.rb
@@ -147,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
151
  version: '0'
148
152
  segments:
149
153
  - 0
150
- hash: 2246136145939191408
154
+ hash: 2963667120197220798
151
155
  required_rubygems_version: !ruby/object:Gem::Requirement
152
156
  none: false
153
157
  requirements:
@@ -156,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
160
  version: '0'
157
161
  segments:
158
162
  - 0
159
- hash: 2246136145939191408
163
+ hash: 2963667120197220798
160
164
  requirements: []
161
165
  rubyforge_project:
162
166
  rubygems_version: 1.8.24
@@ -168,6 +172,8 @@ test_files:
168
172
  - spec/fixtures/issues.json
169
173
  - spec/fixtures/key.json
170
174
  - spec/fixtures/keys.json
175
+ - spec/fixtures/merge_request.json
176
+ - spec/fixtures/merge_requests.json
171
177
  - spec/fixtures/milestone.json
172
178
  - spec/fixtures/milestones.json
173
179
  - spec/fixtures/project.json
@@ -187,6 +193,7 @@ test_files:
187
193
  - spec/fixtures/user.json
188
194
  - spec/fixtures/users.json
189
195
  - spec/gitlab/client/issues_spec.rb
196
+ - spec/gitlab/client/merge_requests_spec.rb
190
197
  - spec/gitlab/client/milestones_spec.rb
191
198
  - spec/gitlab/client/projects_spec.rb
192
199
  - spec/gitlab/client/repositories_spec.rb