stash_core_api 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 155d22d04c61e8dfe6d7d30a0cae55544d049b49
4
+ data.tar.gz: 87729890cc2298048b7df1a9c5514ae94f477904
5
+ SHA512:
6
+ metadata.gz: 5463bc3c4ff544f1eadea7551a869f7aa8a8740f2f663872c5aa2b8ac44e1305386938db63c0cc11410e79887ca80f60aff599daea00c36e35d8ea3c88940fe2
7
+ data.tar.gz: 69efdaeb8d2c2b661236ef0563080ea8dca2d4fe477602d10e1bc39273b12e13342308eb4240e8b1ba6ffe0d72d6e4887611a9785d2f44ff5c1d8622033f1c99
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ - 2.2
5
+ before_install: gem update bundler
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ Change Log
2
+ ==========
3
+
4
+ Version 0.1.3 *(2015-12-09)*
5
+ ----------------------------
6
+
7
+ Initial release of StashCoreAPI
8
+
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,11 @@
1
+ Contributing
2
+ ============
3
+
4
+ If you would like to contribute code to this project you can do so through GitHub by
5
+ forking the repository and sending a pull request.
6
+
7
+ Before your code can be accepted into the project you must also sign the
8
+ [Individual Contributor License Agreement (CLA)][1].
9
+
10
+
11
+ [1]: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://www.rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'kramdown'
7
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stash_core_api (0.1.3)
5
+ http (~> 0.8.12)
6
+
7
+ GEM
8
+ remote: https://www.rubygems.org/
9
+ specs:
10
+ addressable (2.3.8)
11
+ crack (0.4.2)
12
+ safe_yaml (~> 1.0.0)
13
+ diff-lcs (1.2.5)
14
+ domain_name (0.5.25)
15
+ unf (>= 0.0.5, < 1.0.0)
16
+ http (0.8.12)
17
+ addressable (~> 2.3)
18
+ http-cookie (~> 1.0)
19
+ http-form_data (~> 1.0.1)
20
+ http_parser.rb (~> 0.6.0)
21
+ http-cookie (1.0.2)
22
+ domain_name (~> 0.5)
23
+ http-form_data (1.0.1)
24
+ http_parser.rb (0.6.0)
25
+ kramdown (1.9.0)
26
+ rake (10.4.2)
27
+ rspec (3.3.0)
28
+ rspec-core (~> 3.3.0)
29
+ rspec-expectations (~> 3.3.0)
30
+ rspec-mocks (~> 3.3.0)
31
+ rspec-core (3.3.2)
32
+ rspec-support (~> 3.3.0)
33
+ rspec-expectations (3.3.1)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.3.0)
36
+ rspec-mocks (3.3.2)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.3.0)
39
+ rspec-support (3.3.0)
40
+ safe_yaml (1.0.4)
41
+ unf (0.1.4)
42
+ unf_ext
43
+ unf_ext (0.0.7.1)
44
+ webmock (1.21.0)
45
+ addressable (>= 2.3.6)
46
+ crack (>= 0.3.2)
47
+ yard (0.8.7.6)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ bundler (~> 1.2)
54
+ kramdown
55
+ rake (~> 10.0)
56
+ rspec (~> 3.0)
57
+ stash_core_api!
58
+ webmock (~> 1.21)
59
+ yard (~> 0.8)
60
+
61
+ BUNDLED WITH
62
+ 1.10.5
data/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # stash_core_api
2
+
3
+ * [Homepage](https://rubygems.org/gems/stash_core_api)
4
+ * [Documentation](http://rubydoc.info/gems/stash_core_api/frames)
5
+ * [Email](mailto:arp at squareup.com)
6
+
7
+ ## Description
8
+
9
+ Make basic auth requests to Stash Core REST API.
10
+
11
+ ## Features
12
+
13
+ * Provides client to make requests to Stash
14
+
15
+ ## Examples
16
+
17
+ require 'stash_core_api'
18
+
19
+ ### Using client to get commit and pull request info
20
+
21
+ require 'stash_core_api'
22
+ stash_client = StashCoreAPI::Client.new(
23
+ user: user,
24
+ pass: pass,
25
+ project: project,
26
+ repository: stash_repo,
27
+ stash_url: stash_url,
28
+ )
29
+
30
+ # commits
31
+ stash_client.commits(since: sha1, until_: sha2)
32
+
33
+ # pull requests
34
+ stash_client.info(pull_request_id)
35
+ stash_client.can_merge?(pull_request_id)
36
+
37
+ ## Implementing More Endpoints
38
+
39
+ This gem only implements a few of the many ones that Stash Core REST API offers, which can be seen [here](https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html).
40
+
41
+ Note: filenames in this gem are pulled from the following pattern: `rest/api/1.0/projects/{projectKey}/repos/{respositorySlug}/<file-name>`, which corresponds to the file `lib/stash_core_api/file_name.rb` in this gem.
42
+
43
+ ### Add method to an existing endpoint
44
+
45
+ Implementing [watch pull requests](https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html#idp186608):
46
+
47
+ 1. Implement method `watch` in `lib/stash_core_api/pull_requests.rb`
48
+
49
+ Using the stash client above, you can now call this method:
50
+
51
+ stash_client.watch(pull_request_id)
52
+
53
+ ### Add new endpoint
54
+
55
+
56
+ Implementing [branches](https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html#idp959232):
57
+
58
+ 1. Create file `lib/stash_core_api/branches.rb`
59
+ 2. Implement method `branches` in `lib/stash_core_api/pull_requests.rb`
60
+ 3. Include `StashCoreAPI::Branches` in `lib/stash_core_api/api.rb`
61
+
62
+ Using the stash client above, you can now call this method:
63
+
64
+ stash_client.branches
65
+
66
+ ## Install
67
+
68
+ $ gem install stash_core_api
69
+
70
+ ## License
71
+
72
+ Copyright 2015 Square, Inc.
73
+
74
+ Licensed under the Apache License, Version 2.0 (the "License");
75
+ you may not use this file except in compliance with the License.
76
+ You may obtain a copy of the License at
77
+
78
+ http://www.apache.org/licenses/LICENSE-2.0
79
+
80
+ Unless required by applicable law or agreed to in writing, software
81
+ distributed under the License is distributed on an "AS IS" BASIS,
82
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83
+ See the License for the specific language governing permissions and
84
+ limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler/setup'
4
+
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new
7
+
8
+ task default: 'spec'
9
+
10
+ begin
11
+ require 'yard'
12
+
13
+ YARD::Rake::YardocTask.new
14
+ rescue LoadError => e
15
+ task :yard do
16
+ warn e.message
17
+ end
18
+ end
19
+ task doc: 'yard'
data/kochiku.yml ADDED
@@ -0,0 +1,11 @@
1
+ test_command: 'script/ci'
2
+ language: ruby
3
+ ruby:
4
+ - 2.0.0
5
+ - 2.1.2
6
+ - jruby-1.7.13
7
+
8
+ targets:
9
+ - type: unit
10
+ glob: 'spec/**/*_spec.rb'
11
+ workers: 1
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+ require 'stash_core_api/version'
3
+ require 'stash_core_api/client'
@@ -0,0 +1,10 @@
1
+ require 'stash_core_api/commits'
2
+ require 'stash_core_api/pull_requests'
3
+
4
+ module StashCoreAPI
5
+ # All methods have been separated into modules and
6
+ # follow the same grouping used in:
7
+ # https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html.
8
+ include StashCoreAPI::Commits
9
+ include StashCoreAPI::PullRequests
10
+ end
@@ -0,0 +1,22 @@
1
+ require 'stash_core_api/api'
2
+ require 'stash_core_api/utils'
3
+
4
+ module StashCoreAPI
5
+ # Client to interact with Atlassian Stash CoreAPI API
6
+ class Client
7
+ include StashCoreAPI
8
+ include StashCoreAPI::Utils
9
+
10
+ attr_accessor :user, :pass, :project, :repository, :stash_url
11
+
12
+ # Initializes a new Client object
13
+ #
14
+ # @param options [Hash]
15
+ # @return StashCoreAPI::Client
16
+ def initialize(options = {})
17
+ options.each do |key, value|
18
+ instance_variable_set("@#{key}", value)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ require 'stash_core_api/utils'
2
+
3
+ module StashCoreAPI
4
+ # Interfaces with commits endpoints of Stash CoreAPI API
5
+ module Commits
6
+ include StashCoreAPI::Utils
7
+
8
+ # @see https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html#idp2028464
9
+ #
10
+ # @param path [String] an optional path to filter commits by
11
+ # @param since [String] the commit ID or ref (exclusively) to retrieve
12
+ # commits after
13
+ # @param until [String] the commit ID (SHA1) or ref (inclusively) to
14
+ # retrieve commits before if until is unspecified, the tip of the
15
+ # repository's default branch is assumed
16
+ # @param limit [Integer] the maximum number of commits to return
17
+ # Stash defaults to 25
18
+ # @param withCounts [Boolean] optionally include the total number of
19
+ # commits and total number of unique authors
20
+ def commits(path: nil, since: nil, until_: nil, limit: nil,
21
+ with_counts: nil)
22
+ endpoint = '/commits'
23
+ if path || since || until_ || limit || with_counts
24
+ endpoint = "#{endpoint}?"
25
+ endpoint = "#{endpoint}path=#{sanitized_path(path)}&" if path
26
+ endpoint = "#{endpoint}since=#{since}&" if since
27
+ endpoint = "#{endpoint}until=#{until_}&" if until_
28
+ endpoint = "#{endpoint}limit=#{limit}&" if limit
29
+ endpoint = "#{endpoint}withCounts=#{with_counts}&" if with_counts
30
+ end
31
+ perform_get(endpoint)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ module StashCoreAPI
2
+ # Base class for all errors emanating from Stash.
3
+ class Error < StandardError
4
+ # Raised when Stash returns a 4xx HTTP status code
5
+ ClientError = Class.new(self)
6
+
7
+ # Raised when Stash returns the HTTP status code 400
8
+ BadRequest = Class.new(ClientError)
9
+
10
+ # Raised when Stash returns the HTTP status code 401
11
+ Unauthorized = Class.new(ClientError)
12
+
13
+ # Raised when Stash returns the HTTP status code 403
14
+ Forbidden = Class.new(ClientError)
15
+
16
+ # Raised when Stash returns the HTTP status code 404
17
+ NotFound = Class.new(ClientError)
18
+
19
+ # Raised when Stash returns the HTTP status code 405
20
+ MethodNotAllowed = Class.new(ClientError)
21
+
22
+ # Raised when Stash returns the HTTP status code 409
23
+ Conflict = Class.new(ClientError)
24
+
25
+ # Raised when Stash returns the HTTP status code 415
26
+ UnsupportedMediaType = Class.new(ClientError)
27
+
28
+ ERRORS = {
29
+ 400 => StashCoreAPI::Error::BadRequest,
30
+ 401 => StashCoreAPI::Error::Unauthorized,
31
+ 403 => StashCoreAPI::Error::Forbidden,
32
+ 404 => StashCoreAPI::Error::NotFound,
33
+ 405 => StashCoreAPI::Error::MethodNotAllowed,
34
+ 409 => StashCoreAPI::Error::Conflict,
35
+ 415 => StashCoreAPI::Error::UnsupportedMediaType
36
+ }
37
+
38
+ # Initializes a new Error object
39
+ #
40
+ # @param message [Exception, String]
41
+ # @param code [Integer]
42
+ # @return [StashCoreAPI::Error]
43
+ def initialize(body = {})
44
+ message = body.fetch('errors', {}).fetch(0, {}).fetch('message', '')
45
+ super(message)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,34 @@
1
+ require 'stash_core_api/utils'
2
+
3
+ module StashCoreAPI
4
+ # Interfaces with pull requests endpoints of Stash CoreAPI API
5
+ module PullRequests
6
+ include StashCoreAPI::Utils
7
+
8
+ # @see https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html#idp2785024
9
+ # @authentication Requires basic auth
10
+ # @todo @raise [StashCoreAPI::Error::Unauthorized] Error raised when supplied
11
+ # user credentials are not valid
12
+ # @param options [Hash] A customizable set of options.
13
+ #
14
+ # @param pull_request_id [Integer] the id of the pull request within the
15
+ # repository
16
+ # @return [Boolean] Returns true if PR can be merged, false if not.
17
+ def can_merge?(pull_request_id)
18
+ perform_get("/pull-requests/#{pull_request_id}/merge")['canMerge']
19
+ end
20
+
21
+ # @see https://developer.atlassian.com/static/rest/stash/3.9.2/stash-rest.html#idp2840064
22
+ # @authentication Requires basic auth
23
+ # @todo @raise [StashCoreAPI::Error::Unauthorized] Error raised when supplied
24
+ # user credentials are not valid
25
+ # @param options [Hash] A customizable set of options.
26
+ #
27
+ # @param pull_request_id [Integer] the id of the pull request within
28
+ # the repository
29
+ # @return
30
+ def info(pull_request_id)
31
+ perform_get("/pull-requests/#{pull_request_id}")
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,46 @@
1
+ require 'http'
2
+ require 'json'
3
+ require 'stash_core_api/error'
4
+
5
+ module StashCoreAPI
6
+ # Wrapper around HTTP, does basic auth on every request
7
+ class Request
8
+ BASE_API_PATH = '/rest/api/1.0'
9
+
10
+ def initialize(client, endpoint)
11
+ @client = client
12
+ @endpoint = endpoint
13
+ end
14
+
15
+ def get
16
+ response = HTTP
17
+ .basic_auth(user: @client.user, pass: @client.pass)
18
+ .get(req_url(@endpoint))
19
+ process(response)
20
+ end
21
+
22
+ private
23
+
24
+ def process(response)
25
+ code = response.code
26
+ body = response.parse
27
+
28
+ error = error(code, body)
29
+ fail(error) if error
30
+ body
31
+ end
32
+
33
+ def error(code, body)
34
+ klass = StashCoreAPI::Error::ERRORS[code]
35
+ klass.new(body) if klass
36
+ end
37
+
38
+ def req_url(endpoint)
39
+ # build req_url and remove double slashes from it
40
+ project = "/projects/#{@client.project}"
41
+ repo = "/repos/#{@client.repository}"
42
+ url = "#{@client.stash_url}/#{BASE_API_PATH}/#{project}/#{repo}/#{endpoint}"
43
+ url.gsub(%r{([^:])//}, '\1/')
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,17 @@
1
+ require 'stash_core_api/request'
2
+
3
+ module StashCoreAPI
4
+ # Utilities for CoreAPI API modules/classes
5
+ module Utils
6
+ private
7
+
8
+ def perform_get(path)
9
+ StashCoreAPI::Request.new(self, path).get
10
+ end
11
+
12
+ def sanitized_path(path)
13
+ # strip out any leading '/' which will break the Stash API
14
+ path.sub(/^\/*/, '')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ # StashCoreAPI module
4
+ module StashCoreAPI
5
+ VERSION = '0.1.3'
6
+ end
@@ -0,0 +1 @@
1
+ {"canMerge":true,"conflicted":false,"vetoes":[]}
@@ -0,0 +1 @@
1
+ {"canMerge":false,"conflicted":false,"vetoes":[]}
@@ -0,0 +1 @@
1
+ {"values":[{"id":"EZPKJBSUXAQWOYABQAZUJHJJQFJLLXXJUNGTTSXQIBOZMGXQAA","displayId":"EZPKJBSUXAQ","author":{"name":"person0","emailAddress":"person0@example.com","id":983,"displayName":"person0","active":true,"slug":"person0","type":"NORMAL","link":{"url":"/users/person0","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person0"}]}},"authorTimestamp":1434487394000,"message":"Adding 0 changes","parents":[{"id":"DWNFGAWKZQUGSKVDYAWMMAMXGJPWQSKPLXCWAPMPTEQSSHVTIY","displayId":"DWNFGAWKZQU"},{"id":"MAKILSIHLMZAHKRPASWRKDRDFBOBMDVIJXXJEGXADSHEYLRDCP","displayId":"MAKILSIHLMZ"}]},{"id":"RJQZKVTUVXAKYOVJCLKGXYLUKMNDQGDLRFDJALMAGUAKAZZRXL","displayId":"RJQZKVTUVXA","author":{"name":"person1","emailAddress":"person1@example.com","id":988,"displayName":"person1","active":true,"slug":"person1","type":"NORMAL","link":{"url":"/users/person1","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person1"}]}},"authorTimestamp":1434487394000,"message":"Adding 1 changes","parents":[{"id":"SEOJSTPDXZXBBCQUMWCSZHVSHPJDGRPOWPKMNYJFADKZIHPXLB","displayId":"SEOJSTPDXZX"},{"id":"YIPXJHZHZNMLDIZJSADAYQJGXOKHVREWWFCMAIAWFMLKPWCVSK","displayId":"YIPXJHZHZNM"}]},{"id":"BCCEZOSURMHBLXXIUUMYUGIUVCOAILCGKRCBWFQPQPTDMBOBOE","displayId":"BCCEZOSURMH","author":{"name":"person2","emailAddress":"person2@example.com","id":227,"displayName":"person2","active":true,"slug":"person2","type":"NORMAL","link":{"url":"/users/person2","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person2"}]}},"authorTimestamp":1434487394000,"message":"Adding 2 changes","parents":[{"id":"GMJPDYVGTTZGHXIINNVZRVHPXCPZTYDXOJAXFXGVZUPJIXWROS","displayId":"GMJPDYVGTTZ"},{"id":"JNDEHYAPDXIHCGHBBUBTFNUBASBUMOLQHQCGGSTCZWVZMMRSIT","displayId":"JNDEHYAPDXI"}]},{"id":"ZGGZNJLIMSJXYRGAWXPBQJUNVEWSDIKAZPAQLXYMOQXRWCRAKJ","displayId":"ZGGZNJLIMSJ","author":{"name":"person3","emailAddress":"person3@example.com","id":114,"displayName":"person3","active":true,"slug":"person3","type":"NORMAL","link":{"url":"/users/person3","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person3"}]}},"authorTimestamp":1434487394000,"message":"Adding 3 changes","parents":[{"id":"OOEAVBCEALAKPZISZDPINAJTUMBAKRWDVDVQZYGGXFDZBJDLBB","displayId":"OOEAVBCEALA"},{"id":"RGLDECPEBESGZPIFQUQEWEJMBEFAZPYWTLELJHDLIBKIRWNIFL","displayId":"RGLDECPEBES"}]},{"id":"VAMUMHJSXAEFSHKVNWHKNZKELNXCKISNFTSURMQTFZKZXKAEBX","displayId":"VAMUMHJSXAE","author":{"name":"person4","emailAddress":"person4@example.com","id":253,"displayName":"person4","active":true,"slug":"person4","type":"NORMAL","link":{"url":"/users/person4","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person4"}]}},"authorTimestamp":1434487394000,"message":"Adding 4 changes","parents":[{"id":"LCZRILTIAHOVXPVNWEXSHAMHDJBSBBSXKTIOINEZMYXBPMPRVR","displayId":"LCZRILTIAHO"},{"id":"GKEZFNTKTQYKDLXQEUONUGCBAPLNXKZTJLNOHFARIEGDXNDJOC","displayId":"GKEZFNTKTQY"}]},{"id":"OIZCIRUOJMHUQWOWOZCTASQGKXAJZVRONNPVFTKGRHNPBCOMVL","displayId":"OIZCIRUOJMH","author":{"name":"person5","emailAddress":"person5@example.com","id":336,"displayName":"person5","active":true,"slug":"person5","type":"NORMAL","link":{"url":"/users/person5","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person5"}]}},"authorTimestamp":1434487394000,"message":"Adding 5 changes","parents":[{"id":"ZDVOTBRRMKPXPETUNRQGNPJYXPETNNRKATEIRIJVMKGKOMNBWL","displayId":"ZDVOTBRRMKP"},{"id":"YHPWGTBDKJFOSCFBXBXJCKIIELWTLOQCSTRDZRLEAVPWSZFECW","displayId":"YHPWGTBDKJF"}]},{"id":"NCTRLUEQSASCZECRYMLOZRTHZFKOWJDZSNIKWXAIYITERONYZS","displayId":"NCTRLUEQSAS","author":{"name":"person6","emailAddress":"person6@example.com","id":809,"displayName":"person6","active":true,"slug":"person6","type":"NORMAL","link":{"url":"/users/person6","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person6"}]}},"authorTimestamp":1434487394000,"message":"Adding 6 changes","parents":[{"id":"JGJBPTQIDVCNZGXBBRXQXPOHUHUXOXNZTBJZUTBTGJLMBNYSQW","displayId":"JGJBPTQIDVC"},{"id":"FBCZWNHBGHCUHBFRMDRZTAVHNWCIXOEMIFKOZCLYOKBLRMSXYA","displayId":"FBCZWNHBGHC"}]},{"id":"IYTBCYRIIGZYOSSYHFRZXQNVUSHYMQZHHKJOPRDDXESQRJNORZ","displayId":"IYTBCYRIIGZ","author":{"name":"person7","emailAddress":"person7@example.com","id":204,"displayName":"person7","active":true,"slug":"person7","type":"NORMAL","link":{"url":"/users/person7","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person7"}]}},"authorTimestamp":1434487394000,"message":"Adding 7 changes","parents":[{"id":"RLPRRIIMQODMTPJJLAXFLQKWBHYYTKGANJPDDNEVRQSFDUNIZE","displayId":"RLPRRIIMQOD"},{"id":"AIKERNZVHEDATWBNVWGMMPLGWKNFCGZUIZXWGNEAIEMTXYBJSK","displayId":"AIKERNZVHED"}]},{"id":"DFJUIVONXRLFSSEBCSCOFIZQMOWNSEHSIKVUTGCXFKKFSYSJBX","displayId":"DFJUIVONXRL","author":{"name":"person8","emailAddress":"person8@example.com","id":201,"displayName":"person8","active":true,"slug":"person8","type":"NORMAL","link":{"url":"/users/person8","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person8"}]}},"authorTimestamp":1434487394000,"message":"Adding 8 changes","parents":[{"id":"TNOBAWSJSBNYYSBXIQGEMAHIWXNQOMSUNFCLEVRTPDEOMHVXUN","displayId":"TNOBAWSJSBN"},{"id":"DHQNFIUAQMXCYWWDBYILTUELUBAVNCUSMOHJFGUQBYFQQUELWM","displayId":"DHQNFIUAQMX"}]},{"id":"UTZIFJJKMZFHUPKRITGYVIBZGREHGGJWNCOOBQHVBXARVXMQMD","displayId":"UTZIFJJKMZF","author":{"name":"person9","emailAddress":"person9@example.com","id":697,"displayName":"person9","active":true,"slug":"person9","type":"NORMAL","link":{"url":"/users/person9","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person9"}]}},"authorTimestamp":1434487394000,"message":"Adding 9 changes","parents":[{"id":"VUUXIVDXOBCJGFERHIJGPWQUQOFNXRSVIFNOVKSPVDVJUBIRUE","displayId":"VUUXIVDXOBC"},{"id":"DEBHENREJHCDKDOOXEGTYECSQKCGQBRYEYNPUWPKBDUQNYXXNL","displayId":"DEBHENREJHC"}]},{"id":"WCBKLMCRWYQSFAEUPUBCZKRNBLHIYBTPRFCRCGLQOKZNRAVFRT","displayId":"WCBKLMCRWYQ","author":{"name":"person10","emailAddress":"person10@example.com","id":331,"displayName":"person10","active":true,"slug":"person10","type":"NORMAL","link":{"url":"/users/person10","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person10"}]}},"authorTimestamp":1434487394000,"message":"Adding 10 changes","parents":[{"id":"KRGWFXQWCLYPGFOYOVWZUYKNZJYUJGPCOFFGNHEGQZKHQMXWLU","displayId":"KRGWFXQWCLY"},{"id":"XDELNHCXCHOXNNKHLCXWHGRDUIPNIYZDDMMLACNBJZFRLAPPOZ","displayId":"XDELNHCXCHO"}]},{"id":"IWIJQFROHYIEWMOEZQLGEFXLICUAOTSFIZINBGERETAEFDWXJL","displayId":"IWIJQFROHYI","author":{"name":"person11","emailAddress":"person11@example.com","id":764,"displayName":"person11","active":true,"slug":"person11","type":"NORMAL","link":{"url":"/users/person11","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person11"}]}},"authorTimestamp":1434487394000,"message":"Adding 11 changes","parents":[{"id":"XZACMCJYMZLMDRRRETSHUAJJJOPFAUPBBEEOINPSQMAHSRPRWV","displayId":"XZACMCJYMZL"},{"id":"XKWQEGKRDRRTUYFSCPUHTWAOSIPASYLLZSJXRHDNXWIVOITQIX","displayId":"XKWQEGKRDRR"}]},{"id":"MPGKZTRBSTESMWNWFQTRYGEAULVXLMOOIIQMDHYBVVUNFHOCUI","displayId":"MPGKZTRBSTE","author":{"name":"person12","emailAddress":"person12@example.com","id":263,"displayName":"person12","active":true,"slug":"person12","type":"NORMAL","link":{"url":"/users/person12","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person12"}]}},"authorTimestamp":1434487394000,"message":"Adding 12 changes","parents":[{"id":"SJEQJVPKKZHAKVHQUBKUVZIOQOGIFIVNNVBVYWHUALPFQEHVSB","displayId":"SJEQJVPKKZH"},{"id":"SOEHFNFMYEQLXRJXEDGVTHDJHPQNIXIBMRHVYQBHOHBVTUQADX","displayId":"SOEHFNFMYEQ"}]},{"id":"SJOEWYXAUSVKTHNOVCZVNLKRAMVWGASKUZOVIQTMRRUPZJSKZO","displayId":"SJOEWYXAUSV","author":{"name":"person13","emailAddress":"person13@example.com","id":22,"displayName":"person13","active":true,"slug":"person13","type":"NORMAL","link":{"url":"/users/person13","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person13"}]}},"authorTimestamp":1434487394000,"message":"Adding 13 changes","parents":[{"id":"CDOJINCLIICYNWTCMATXGYCYRFCJMBUZJXEXZXNFSYQCNBESBC","displayId":"CDOJINCLIIC"},{"id":"TWVZUGNZFQBPHYESIDIFJZLWNQAGLZDQDTHCELEBZHWNRHQVBU","displayId":"TWVZUGNZFQB"}]},{"id":"DZGBLEIEATAZPOATYRQPDWYSLEVKYYQMHMJMKQTIHWXDTQAHDU","displayId":"DZGBLEIEATA","author":{"name":"person14","emailAddress":"person14@example.com","id":386,"displayName":"person14","active":true,"slug":"person14","type":"NORMAL","link":{"url":"/users/person14","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person14"}]}},"authorTimestamp":1434487394000,"message":"Adding 14 changes","parents":[{"id":"YMICNYQKYGRLVFOUMASUTHPVNMSDKZJJPBCPGBEYMIJXOWOXSJ","displayId":"YMICNYQKYGR"},{"id":"HOQZLUTMOZDPUGTZBBLKRONJZLANPJEKZEJODIYRXUUPTDSHNY","displayId":"HOQZLUTMOZD"}]},{"id":"JWULWZKWGWZPGFQTDOUESHSAMJPGTFLAQAWEOQVEXPBNANDDGP","displayId":"JWULWZKWGWZ","author":{"name":"person15","emailAddress":"person15@example.com","id":824,"displayName":"person15","active":true,"slug":"person15","type":"NORMAL","link":{"url":"/users/person15","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person15"}]}},"authorTimestamp":1434487394000,"message":"Adding 15 changes","parents":[{"id":"BPRBRPGQRORGDUXHOOITKRYLWEQWAWIAPZQLEJYNPXZCESURCZ","displayId":"BPRBRPGQROR"},{"id":"ACXZOQGQSJLXSCAHNCRBUBFISPUOKUTDGTRBKBVDPZQXOJFOQJ","displayId":"ACXZOQGQSJL"}]},{"id":"KSNMQXNYSZQZUIKQDRPTYUTHORUWPPIWXFEMGDOOGJXTOMBOMI","displayId":"KSNMQXNYSZQ","author":{"name":"person16","emailAddress":"person16@example.com","id":490,"displayName":"person16","active":true,"slug":"person16","type":"NORMAL","link":{"url":"/users/person16","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person16"}]}},"authorTimestamp":1434487394000,"message":"Adding 16 changes","parents":[{"id":"MTIYPDLOSZBELEFSPUWGPVGWVLLOPTAABONPCDJWANDRTIFFZP","displayId":"MTIYPDLOSZB"},{"id":"RFOEEKOUABWIYMTPTJNBGRIVAXCSALYOGIBPECXYEVXFWKHGGP","displayId":"RFOEEKOUABW"}]},{"id":"ABARWXAJPYLPASOEMAIIYPLMDKMREVJGXYZWPFGKVFNLRGVSSV","displayId":"ABARWXAJPYL","author":{"name":"person17","emailAddress":"person17@example.com","id":36,"displayName":"person17","active":true,"slug":"person17","type":"NORMAL","link":{"url":"/users/person17","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person17"}]}},"authorTimestamp":1434487394000,"message":"Adding 17 changes","parents":[{"id":"GSNEBWZOQOSBAZBBSEFLXEOFQFNJOUBOHTUIWWALVANWVZUTQU","displayId":"GSNEBWZOQOS"},{"id":"AZEEMIOLMCNWDAKINXOJKMJYYWVJCIOVFPOVKOFTDYCVFFEBAF","displayId":"AZEEMIOLMCN"}]},{"id":"ADSWWWNDEJXPLCCYUCGUONDHSFKPXEGQPHYZYCRVLAXGOFZRHQ","displayId":"ADSWWWNDEJX","author":{"name":"person18","emailAddress":"person18@example.com","id":117,"displayName":"person18","active":true,"slug":"person18","type":"NORMAL","link":{"url":"/users/person18","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person18"}]}},"authorTimestamp":1434487394000,"message":"Adding 18 changes","parents":[{"id":"HKOSXFNESHLRPZLQURFZXSTHNQTBXWQVOIHCCGDZLSSPZJBAEC","displayId":"HKOSXFNESHL"},{"id":"SGBZKFQSCGRQOZLKLEKAOICYGTLMKMKSBRQVGEVFOYOXBGLMRG","displayId":"SGBZKFQSCGR"}]},{"id":"CNDFNCNZGCKPIBFHQVPVKTJXSXNALMCAAFJNONBPIOIHJZKOPY","displayId":"CNDFNCNZGCK","author":{"name":"person19","emailAddress":"person19@example.com","id":336,"displayName":"person19","active":true,"slug":"person19","type":"NORMAL","link":{"url":"/users/person19","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person19"}]}},"authorTimestamp":1434487394000,"message":"Adding 19 changes","parents":[{"id":"BHLBWRNSVTJYOFXLFZHFSCQJNJZXAUNJAISGPAQMGTSKEAMUPS","displayId":"BHLBWRNSVTJ"},{"id":"EXKIYGLXETCPOINBJLGFHISTTJVAOUCJFHIFZOSALFHRUEOADK","displayId":"EXKIYGLXETC"}]},{"id":"CXNSEMKWEETKWWYVWHPQOSXMSOSGEWGTATHYYYWGAQOCUNYSQS","displayId":"CXNSEMKWEET","author":{"name":"person20","emailAddress":"person20@example.com","id":958,"displayName":"person20","active":true,"slug":"person20","type":"NORMAL","link":{"url":"/users/person20","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person20"}]}},"authorTimestamp":1434487394000,"message":"Adding 20 changes","parents":[{"id":"XUAEERTOSKPXAHJFTFYOOEDKYNEGPJAGHXRPNONMLOCEZNCLDC","displayId":"XUAEERTOSKP"},{"id":"PBSHIYFMVRAEHWUGRYLIHYQZQIAHZOVVHEPFVMNLITLQNRWQXN","displayId":"PBSHIYFMVRA"}]},{"id":"SNRKTJZTBECVDMYAYXDCACOHPSDDJYUKWBLXIOUHARTQVCGAWF","displayId":"SNRKTJZTBEC","author":{"name":"person21","emailAddress":"person21@example.com","id":737,"displayName":"person21","active":true,"slug":"person21","type":"NORMAL","link":{"url":"/users/person21","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person21"}]}},"authorTimestamp":1434487394000,"message":"Adding 21 changes","parents":[{"id":"OPKWVSEYTIWJFHTAZCMYKUAUSIRFAFVRJVLIKIROLMLFYVZLOU","displayId":"OPKWVSEYTIW"},{"id":"PQTQAYINOVMVAWPTDIQSULUDGMGUZPAKGOYPENQUTQLMTGOKRU","displayId":"PQTQAYINOVM"}]},{"id":"KGMBNXFXQJIBEKIMHOZFZYYRJGVPJTOVKKPPZODBWVTTJDXICE","displayId":"KGMBNXFXQJI","author":{"name":"person22","emailAddress":"person22@example.com","id":99,"displayName":"person22","active":true,"slug":"person22","type":"NORMAL","link":{"url":"/users/person22","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person22"}]}},"authorTimestamp":1434487394000,"message":"Adding 22 changes","parents":[{"id":"IFZFJZINGANOOFYBRJKQMHVMKBLETXHKJOVGQUMQYCNDNQIVGI","displayId":"IFZFJZINGAN"},{"id":"BGAQXPIEZGETDDRSYJNYQMXUBLVQBZFUFWOQJDYETPXWPYASGY","displayId":"BGAQXPIEZGE"}]},{"id":"DXRMTTIEVYXNCVJOKNWLFNWRDFHFZAYXNIFWFCDEILCBLXASSO","displayId":"DXRMTTIEVYX","author":{"name":"person23","emailAddress":"person23@example.com","id":329,"displayName":"person23","active":true,"slug":"person23","type":"NORMAL","link":{"url":"/users/person23","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person23"}]}},"authorTimestamp":1434487394000,"message":"Adding 23 changes","parents":[{"id":"FTQQQFLVMOKCCQTJILNJRLZLZIEDDBZAVRYIWTJKQFFBUXJPNR","displayId":"FTQQQFLVMOK"},{"id":"LFBHJLZTGARKZDIFNRIBQPMHRBAMDHPWYGLRMRVCAWDXKENJQK","displayId":"LFBHJLZTGAR"}]},{"id":"APYEEUQLGCTSSCXAROMSURWILREVRBLVRJFZZJTFCSVZWWTTOD","displayId":"APYEEUQLGCT","author":{"name":"person24","emailAddress":"person24@example.com","id":941,"displayName":"person24","active":true,"slug":"person24","type":"NORMAL","link":{"url":"/users/person24","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person24"}]}},"authorTimestamp":1434487394000,"message":"Adding 24 changes","parents":[{"id":"ZNIRTSJUHYFKDBAFEVBWTYCYSVANQFMPOEAVMOMOOEAWGVEOLZ","displayId":"ZNIRTSJUHYF"},{"id":"DFDDTBLYKASYFSFIGCVIVEQUDYIFSYXKKDEWDOPABKOGIVSSLS","displayId":"DFDDTBLYKAS"}]}],"size":25,"isLastPage":false,"start":0,"limit":25,"nextPageStart":25}
@@ -0,0 +1 @@
1
+ {"values":[{"id":"NJVEADEYBBQHUSISCWBHVNTYRGCXGXKNVNNGPUHKMYSBQMKPRI","displayId":"NJVEADEYBBQ","author":{"name":"person0","emailAddress":"person0@example.com","id":50,"displayName":"person0","active":true,"slug":"person0","type":"NORMAL","link":{"url":"/users/person0","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person0"}]}},"authorTimestamp":1434487394000,"message":"Adding 0 changes","parents":[{"id":"HLXPCNEVMGKBCIQFIXVLBYXWJUMSPXGHRLJMQBBLPQPLZZCIHY","displayId":"HLXPCNEVMGK"},{"id":"GFYGLKHALELGSYOXDWXRPEJDPNWWWSEXEXZCDIMJKDDXBUUCVK","displayId":"GFYGLKHALEL"}]},{"id":"NZWAEVBASPUTGDCXWIBGKPHWFXSEBDWBVQDFDPLPRVGFDOISUJ","displayId":"NZWAEVBASPU","author":{"name":"person1","emailAddress":"person1@example.com","id":894,"displayName":"person1","active":true,"slug":"person1","type":"NORMAL","link":{"url":"/users/person1","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person1"}]}},"authorTimestamp":1434487394000,"message":"Adding 1 changes","parents":[{"id":"VCUSBAFTOSQWCKBXHURRZEQVTQHJAXIWCPMCCFTIODZIMWNQFW","displayId":"VCUSBAFTOSQ"},{"id":"MNEAZAIBRKKDOZQINWPFVDFBIQZZKUZZDLDYMCQJUFEQNNZVDL","displayId":"MNEAZAIBRKK"}]}],"size":2,"isLastPage":false,"start":0,"limit":2,"nextPageStart":2}
@@ -0,0 +1 @@
1
+ {"values":[{"id":"EZPKJBSUXAQWOYABQAZUJHJJQFJLLXXJUNGTTSXQIBOZMGXQAA","displayId":"EZPKJBSUXAQ","author":{"name":"person0","emailAddress":"person0@example.com","id":983,"displayName":"person0","active":true,"slug":"person0","type":"NORMAL","link":{"url":"/users/person0","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person0"}]}},"authorTimestamp":1434487394000,"message":"Adding 0 changes","parents":[{"id":"DWNFGAWKZQUGSKVDYAWMMAMXGJPWQSKPLXCWAPMPTEQSSHVTIY","displayId":"DWNFGAWKZQU"},{"id":"MAKILSIHLMZAHKRPASWRKDRDFBOBMDVIJXXJEGXADSHEYLRDCP","displayId":"MAKILSIHLMZ"}]},{"id":"RJQZKVTUVXAKYOVJCLKGXYLUKMNDQGDLRFDJALMAGUAKAZZRXL","displayId":"RJQZKVTUVXA","author":{"name":"person1","emailAddress":"person1@example.com","id":988,"displayName":"person1","active":true,"slug":"person1","type":"NORMAL","link":{"url":"/users/person1","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person1"}]}},"authorTimestamp":1434487394000,"message":"Adding 1 changes","parents":[{"id":"SEOJSTPDXZXBBCQUMWCSZHVSHPJDGRPOWPKMNYJFADKZIHPXLB","displayId":"SEOJSTPDXZX"},{"id":"YIPXJHZHZNMLDIZJSADAYQJGXOKHVREWWFCMAIAWFMLKPWCVSK","displayId":"YIPXJHZHZNM"}]},{"id":"BCCEZOSURMHBLXXIUUMYUGIUVCOAILCGKRCBWFQPQPTDMBOBOE","displayId":"BCCEZOSURMH","author":{"name":"person2","emailAddress":"person2@example.com","id":227,"displayName":"person2","active":true,"slug":"person2","type":"NORMAL","link":{"url":"/users/person2","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person2"}]}},"authorTimestamp":1434487394000,"message":"Adding 2 changes","parents":[{"id":"GMJPDYVGTTZGHXIINNVZRVHPXCPZTYDXOJAXFXGVZUPJIXWROS","displayId":"GMJPDYVGTTZ"},{"id":"JNDEHYAPDXIHCGHBBUBTFNUBASBUMOLQHQCGGSTCZWVZMMRSIT","displayId":"JNDEHYAPDXI"}]},{"id":"ZGGZNJLIMSJXYRGAWXPBQJUNVEWSDIKAZPAQLXYMOQXRWCRAKJ","displayId":"ZGGZNJLIMSJ","author":{"name":"person3","emailAddress":"person3@example.com","id":114,"displayName":"person3","active":true,"slug":"person3","type":"NORMAL","link":{"url":"/users/person3","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person3"}]}},"authorTimestamp":1434487394000,"message":"Adding 3 changes","parents":[{"id":"OOEAVBCEALAKPZISZDPINAJTUMBAKRWDVDVQZYGGXFDZBJDLBB","displayId":"OOEAVBCEALA"},{"id":"RGLDECPEBESGZPIFQUQEWEJMBEFAZPYWTLELJHDLIBKIRWNIFL","displayId":"RGLDECPEBES"}]},{"id":"VAMUMHJSXAEFSHKVNWHKNZKELNXCKISNFTSURMQTFZKZXKAEBX","displayId":"VAMUMHJSXAE","author":{"name":"person4","emailAddress":"person4@example.com","id":253,"displayName":"person4","active":true,"slug":"person4","type":"NORMAL","link":{"url":"/users/person4","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person4"}]}},"authorTimestamp":1434487394000,"message":"Adding 4 changes","parents":[{"id":"LCZRILTIAHOVXPVNWEXSHAMHDJBSBBSXKTIOINEZMYXBPMPRVR","displayId":"LCZRILTIAHO"},{"id":"GKEZFNTKTQYKDLXQEUONUGCBAPLNXKZTJLNOHFARIEGDXNDJOC","displayId":"GKEZFNTKTQY"}]},{"id":"OIZCIRUOJMHUQWOWOZCTASQGKXAJZVRONNPVFTKGRHNPBCOMVL","displayId":"OIZCIRUOJMH","author":{"name":"person5","emailAddress":"person5@example.com","id":336,"displayName":"person5","active":true,"slug":"person5","type":"NORMAL","link":{"url":"/users/person5","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person5"}]}},"authorTimestamp":1434487394000,"message":"Adding 5 changes","parents":[{"id":"ZDVOTBRRMKPXPETUNRQGNPJYXPETNNRKATEIRIJVMKGKOMNBWL","displayId":"ZDVOTBRRMKP"},{"id":"YHPWGTBDKJFOSCFBXBXJCKIIELWTLOQCSTRDZRLEAVPWSZFECW","displayId":"YHPWGTBDKJF"}]},{"id":"NCTRLUEQSASCZECRYMLOZRTHZFKOWJDZSNIKWXAIYITERONYZS","displayId":"NCTRLUEQSAS","author":{"name":"person6","emailAddress":"person6@example.com","id":809,"displayName":"person6","active":true,"slug":"person6","type":"NORMAL","link":{"url":"/users/person6","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person6"}]}},"authorTimestamp":1434487394000,"message":"Adding 6 changes","parents":[{"id":"JGJBPTQIDVCNZGXBBRXQXPOHUHUXOXNZTBJZUTBTGJLMBNYSQW","displayId":"JGJBPTQIDVC"},{"id":"FBCZWNHBGHCUHBFRMDRZTAVHNWCIXOEMIFKOZCLYOKBLRMSXYA","displayId":"FBCZWNHBGHC"}]},{"id":"IYTBCYRIIGZYOSSYHFRZXQNVUSHYMQZHHKJOPRDDXESQRJNORZ","displayId":"IYTBCYRIIGZ","author":{"name":"person7","emailAddress":"person7@example.com","id":204,"displayName":"person7","active":true,"slug":"person7","type":"NORMAL","link":{"url":"/users/person7","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person7"}]}},"authorTimestamp":1434487394000,"message":"Adding 7 changes","parents":[{"id":"RLPRRIIMQODMTPJJLAXFLQKWBHYYTKGANJPDDNEVRQSFDUNIZE","displayId":"RLPRRIIMQOD"},{"id":"AIKERNZVHEDATWBNVWGMMPLGWKNFCGZUIZXWGNEAIEMTXYBJSK","displayId":"AIKERNZVHED"}]},{"id":"DFJUIVONXRLFSSEBCSCOFIZQMOWNSEHSIKVUTGCXFKKFSYSJBX","displayId":"DFJUIVONXRL","author":{"name":"person8","emailAddress":"person8@example.com","id":201,"displayName":"person8","active":true,"slug":"person8","type":"NORMAL","link":{"url":"/users/person8","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person8"}]}},"authorTimestamp":1434487394000,"message":"Adding 8 changes","parents":[{"id":"TNOBAWSJSBNYYSBXIQGEMAHIWXNQOMSUNFCLEVRTPDEOMHVXUN","displayId":"TNOBAWSJSBN"},{"id":"DHQNFIUAQMXCYWWDBYILTUELUBAVNCUSMOHJFGUQBYFQQUELWM","displayId":"DHQNFIUAQMX"}]},{"id":"UTZIFJJKMZFHUPKRITGYVIBZGREHGGJWNCOOBQHVBXARVXMQMD","displayId":"UTZIFJJKMZF","author":{"name":"person9","emailAddress":"person9@example.com","id":697,"displayName":"person9","active":true,"slug":"person9","type":"NORMAL","link":{"url":"/users/person9","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person9"}]}},"authorTimestamp":1434487394000,"message":"Adding 9 changes","parents":[{"id":"VUUXIVDXOBCJGFERHIJGPWQUQOFNXRSVIFNOVKSPVDVJUBIRUE","displayId":"VUUXIVDXOBC"},{"id":"DEBHENREJHCDKDOOXEGTYECSQKCGQBRYEYNPUWPKBDUQNYXXNL","displayId":"DEBHENREJHC"}]},{"id":"WCBKLMCRWYQSFAEUPUBCZKRNBLHIYBTPRFCRCGLQOKZNRAVFRT","displayId":"WCBKLMCRWYQ","author":{"name":"person10","emailAddress":"person10@example.com","id":331,"displayName":"person10","active":true,"slug":"person10","type":"NORMAL","link":{"url":"/users/person10","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person10"}]}},"authorTimestamp":1434487394000,"message":"Adding 10 changes","parents":[{"id":"KRGWFXQWCLYPGFOYOVWZUYKNZJYUJGPCOFFGNHEGQZKHQMXWLU","displayId":"KRGWFXQWCLY"},{"id":"XDELNHCXCHOXNNKHLCXWHGRDUIPNIYZDDMMLACNBJZFRLAPPOZ","displayId":"XDELNHCXCHO"}]},{"id":"IWIJQFROHYIEWMOEZQLGEFXLICUAOTSFIZINBGERETAEFDWXJL","displayId":"IWIJQFROHYI","author":{"name":"person11","emailAddress":"person11@example.com","id":764,"displayName":"person11","active":true,"slug":"person11","type":"NORMAL","link":{"url":"/users/person11","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person11"}]}},"authorTimestamp":1434487394000,"message":"Adding 11 changes","parents":[{"id":"XZACMCJYMZLMDRRRETSHUAJJJOPFAUPBBEEOINPSQMAHSRPRWV","displayId":"XZACMCJYMZL"},{"id":"XKWQEGKRDRRTUYFSCPUHTWAOSIPASYLLZSJXRHDNXWIVOITQIX","displayId":"XKWQEGKRDRR"}]},{"id":"MPGKZTRBSTESMWNWFQTRYGEAULVXLMOOIIQMDHYBVVUNFHOCUI","displayId":"MPGKZTRBSTE","author":{"name":"person12","emailAddress":"person12@example.com","id":263,"displayName":"person12","active":true,"slug":"person12","type":"NORMAL","link":{"url":"/users/person12","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person12"}]}},"authorTimestamp":1434487394000,"message":"Adding 12 changes","parents":[{"id":"SJEQJVPKKZHAKVHQUBKUVZIOQOGIFIVNNVBVYWHUALPFQEHVSB","displayId":"SJEQJVPKKZH"},{"id":"SOEHFNFMYEQLXRJXEDGVTHDJHPQNIXIBMRHVYQBHOHBVTUQADX","displayId":"SOEHFNFMYEQ"}]},{"id":"SJOEWYXAUSVKTHNOVCZVNLKRAMVWGASKUZOVIQTMRRUPZJSKZO","displayId":"SJOEWYXAUSV","author":{"name":"person13","emailAddress":"person13@example.com","id":22,"displayName":"person13","active":true,"slug":"person13","type":"NORMAL","link":{"url":"/users/person13","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person13"}]}},"authorTimestamp":1434487394000,"message":"Adding 13 changes","parents":[{"id":"CDOJINCLIICYNWTCMATXGYCYRFCJMBUZJXEXZXNFSYQCNBESBC","displayId":"CDOJINCLIIC"},{"id":"TWVZUGNZFQBPHYESIDIFJZLWNQAGLZDQDTHCELEBZHWNRHQVBU","displayId":"TWVZUGNZFQB"}]},{"id":"DZGBLEIEATAZPOATYRQPDWYSLEVKYYQMHMJMKQTIHWXDTQAHDU","displayId":"DZGBLEIEATA","author":{"name":"person14","emailAddress":"person14@example.com","id":386,"displayName":"person14","active":true,"slug":"person14","type":"NORMAL","link":{"url":"/users/person14","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person14"}]}},"authorTimestamp":1434487394000,"message":"Adding 14 changes","parents":[{"id":"YMICNYQKYGRLVFOUMASUTHPVNMSDKZJJPBCPGBEYMIJXOWOXSJ","displayId":"YMICNYQKYGR"},{"id":"HOQZLUTMOZDPUGTZBBLKRONJZLANPJEKZEJODIYRXUUPTDSHNY","displayId":"HOQZLUTMOZD"}]},{"id":"JWULWZKWGWZPGFQTDOUESHSAMJPGTFLAQAWEOQVEXPBNANDDGP","displayId":"JWULWZKWGWZ","author":{"name":"person15","emailAddress":"person15@example.com","id":824,"displayName":"person15","active":true,"slug":"person15","type":"NORMAL","link":{"url":"/users/person15","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person15"}]}},"authorTimestamp":1434487394000,"message":"Adding 15 changes","parents":[{"id":"BPRBRPGQRORGDUXHOOITKRYLWEQWAWIAPZQLEJYNPXZCESURCZ","displayId":"BPRBRPGQROR"},{"id":"ACXZOQGQSJLXSCAHNCRBUBFISPUOKUTDGTRBKBVDPZQXOJFOQJ","displayId":"ACXZOQGQSJL"}]},{"id":"KSNMQXNYSZQZUIKQDRPTYUTHORUWPPIWXFEMGDOOGJXTOMBOMI","displayId":"KSNMQXNYSZQ","author":{"name":"person16","emailAddress":"person16@example.com","id":490,"displayName":"person16","active":true,"slug":"person16","type":"NORMAL","link":{"url":"/users/person16","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person16"}]}},"authorTimestamp":1434487394000,"message":"Adding 16 changes","parents":[{"id":"MTIYPDLOSZBELEFSPUWGPVGWVLLOPTAABONPCDJWANDRTIFFZP","displayId":"MTIYPDLOSZB"},{"id":"RFOEEKOUABWIYMTPTJNBGRIVAXCSALYOGIBPECXYEVXFWKHGGP","displayId":"RFOEEKOUABW"}]},{"id":"ABARWXAJPYLPASOEMAIIYPLMDKMREVJGXYZWPFGKVFNLRGVSSV","displayId":"ABARWXAJPYL","author":{"name":"person17","emailAddress":"person17@example.com","id":36,"displayName":"person17","active":true,"slug":"person17","type":"NORMAL","link":{"url":"/users/person17","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person17"}]}},"authorTimestamp":1434487394000,"message":"Adding 17 changes","parents":[{"id":"GSNEBWZOQOSBAZBBSEFLXEOFQFNJOUBOHTUIWWALVANWVZUTQU","displayId":"GSNEBWZOQOS"},{"id":"AZEEMIOLMCNWDAKINXOJKMJYYWVJCIOVFPOVKOFTDYCVFFEBAF","displayId":"AZEEMIOLMCN"}]},{"id":"ADSWWWNDEJXPLCCYUCGUONDHSFKPXEGQPHYZYCRVLAXGOFZRHQ","displayId":"ADSWWWNDEJX","author":{"name":"person18","emailAddress":"person18@example.com","id":117,"displayName":"person18","active":true,"slug":"person18","type":"NORMAL","link":{"url":"/users/person18","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person18"}]}},"authorTimestamp":1434487394000,"message":"Adding 18 changes","parents":[{"id":"HKOSXFNESHLRPZLQURFZXSTHNQTBXWQVOIHCCGDZLSSPZJBAEC","displayId":"HKOSXFNESHL"},{"id":"SGBZKFQSCGRQOZLKLEKAOICYGTLMKMKSBRQVGEVFOYOXBGLMRG","displayId":"SGBZKFQSCGR"}]},{"id":"CNDFNCNZGCKPIBFHQVPVKTJXSXNALMCAAFJNONBPIOIHJZKOPY","displayId":"CNDFNCNZGCK","author":{"name":"person19","emailAddress":"person19@example.com","id":336,"displayName":"person19","active":true,"slug":"person19","type":"NORMAL","link":{"url":"/users/person19","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person19"}]}},"authorTimestamp":1434487394000,"message":"Adding 19 changes","parents":[{"id":"BHLBWRNSVTJYOFXLFZHFSCQJNJZXAUNJAISGPAQMGTSKEAMUPS","displayId":"BHLBWRNSVTJ"},{"id":"EXKIYGLXETCPOINBJLGFHISTTJVAOUCJFHIFZOSALFHRUEOADK","displayId":"EXKIYGLXETC"}]},{"id":"CXNSEMKWEETKWWYVWHPQOSXMSOSGEWGTATHYYYWGAQOCUNYSQS","displayId":"CXNSEMKWEET","author":{"name":"person20","emailAddress":"person20@example.com","id":958,"displayName":"person20","active":true,"slug":"person20","type":"NORMAL","link":{"url":"/users/person20","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person20"}]}},"authorTimestamp":1434487394000,"message":"Adding 20 changes","parents":[{"id":"XUAEERTOSKPXAHJFTFYOOEDKYNEGPJAGHXRPNONMLOCEZNCLDC","displayId":"XUAEERTOSKP"},{"id":"PBSHIYFMVRAEHWUGRYLIHYQZQIAHZOVVHEPFVMNLITLQNRWQXN","displayId":"PBSHIYFMVRA"}]},{"id":"SNRKTJZTBECVDMYAYXDCACOHPSDDJYUKWBLXIOUHARTQVCGAWF","displayId":"SNRKTJZTBEC","author":{"name":"person21","emailAddress":"person21@example.com","id":737,"displayName":"person21","active":true,"slug":"person21","type":"NORMAL","link":{"url":"/users/person21","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person21"}]}},"authorTimestamp":1434487394000,"message":"Adding 21 changes","parents":[{"id":"OPKWVSEYTIWJFHTAZCMYKUAUSIRFAFVRJVLIKIROLMLFYVZLOU","displayId":"OPKWVSEYTIW"},{"id":"PQTQAYINOVMVAWPTDIQSULUDGMGUZPAKGOYPENQUTQLMTGOKRU","displayId":"PQTQAYINOVM"}]},{"id":"KGMBNXFXQJIBEKIMHOZFZYYRJGVPJTOVKKPPZODBWVTTJDXICE","displayId":"KGMBNXFXQJI","author":{"name":"person22","emailAddress":"person22@example.com","id":99,"displayName":"person22","active":true,"slug":"person22","type":"NORMAL","link":{"url":"/users/person22","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person22"}]}},"authorTimestamp":1434487394000,"message":"Adding 22 changes","parents":[{"id":"IFZFJZINGANOOFYBRJKQMHVMKBLETXHKJOVGQUMQYCNDNQIVGI","displayId":"IFZFJZINGAN"},{"id":"BGAQXPIEZGETDDRSYJNYQMXUBLVQBZFUFWOQJDYETPXWPYASGY","displayId":"BGAQXPIEZGE"}]},{"id":"DXRMTTIEVYXNCVJOKNWLFNWRDFHFZAYXNIFWFCDEILCBLXASSO","displayId":"DXRMTTIEVYX","author":{"name":"person23","emailAddress":"person23@example.com","id":329,"displayName":"person23","active":true,"slug":"person23","type":"NORMAL","link":{"url":"/users/person23","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person23"}]}},"authorTimestamp":1434487394000,"message":"Adding 23 changes","parents":[{"id":"FTQQQFLVMOKCCQTJILNJRLZLZIEDDBZAVRYIWTJKQFFBUXJPNR","displayId":"FTQQQFLVMOK"},{"id":"LFBHJLZTGARKZDIFNRIBQPMHRBAMDHPWYGLRMRVCAWDXKENJQK","displayId":"LFBHJLZTGAR"}]},{"id":"APYEEUQLGCTSSCXAROMSURWILREVRBLVRJFZZJTFCSVZWWTTOD","displayId":"APYEEUQLGCT","author":{"name":"person24","emailAddress":"person24@example.com","id":941,"displayName":"person24","active":true,"slug":"person24","type":"NORMAL","link":{"url":"/users/person24","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/person24"}]}},"authorTimestamp":1434487394000,"message":"Adding 24 changes","parents":[{"id":"ZNIRTSJUHYFKDBAFEVBWTYCYSVANQFMPOEAVMOMOOEAWGVEOLZ","displayId":"ZNIRTSJUHYF"},{"id":"DFDDTBLYKASYFSFIGCVIVEQUDYIFSYXKKDEWDOPABKOGIVSSLS","displayId":"DFDDTBLYKAS"}]}],"size":25,"isLastPage":false,"start":0,"limit":25,"nextPageStart":25, "authorCount":25,"totalCount":25}
@@ -0,0 +1 @@
1
+ {"id":393,"version":1,"title":"Greatest PR of all time","state":"OPEN","open":true,"closed":false,"createdDate":1434386363252,"updatedDate":1434386363252,"fromRef":{"id":"refs/heads/feature-branch","displayId":"feature-branch","latestChangeset":"1b6b0f262d3b2850dea3ce222a2c99603d89924b","repository":{"slug":"greatest_repo","id":215,"name":"greatest_repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"CoolProject","id":1,"name":"Company","public":true,"type":"NORMAL","link":{"url":"/projects/CoolProject","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/projects/CoolProject"}]}},"public":false,"link":{"url":"/projects/CoolProject/repos/greatest_repo/browse","rel":"self"},"cloneUrl":"https://deploy-bot@some-stash-host.com/scm/sq/greatest_repo.git","links":{"clone":[{"href":"https://deploy-bot@some-stash-host.com/scm/sq/greatest_repo.git","name":"http"},{"href":"ssh://git@git.some-stash-host/sq/greatest_repo.git","name":"ssh"}],"self":[{"href":"https://some-stash-host.com/projects/CoolProject/repos/greatest_repo/browse"}]}}},"toRef":{"id":"refs/heads/master","displayId":"master","latestChangeset":"a180d9f0e6743197e766baf46affc0cf100103a1","repository":{"slug":"greatest_repo","id":215,"name":"greatest_repo","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"CoolProject","id":1,"name":"Company","public":true,"type":"NORMAL","link":{"url":"/projects/CoolProject","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/projects/CoolProject"}]}},"public":false,"link":{"url":"/projects/CoolProject/repos/greatest_repo/browse","rel":"self"},"cloneUrl":"https://deploy-bot@some-stash-host.com/scm/sq/greatest_repo.git","links":{"clone":[{"href":"https://deploy-bot@some-stash-host.com/scm/sq/greatest_repo.git","name":"http"},{"href":"ssh://git@git.some-stash-host/sq/greatest_repo.git","name":"ssh"}],"self":[{"href":"https://some-stash-host.com/projects/CoolProject/repos/greatest_repo/browse"}]}}},"locked":false,"author":{"user":{"name":"ada","emailAddress":"ada@example.com","id":2520,"displayName":"Ada Lovelace","active":true,"slug":"ada","type":"NORMAL","link":{"url":"/users/ada","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/users/ada"}]}},"role":"AUTHOR","approved":false},"reviewers":[],"participants":[],"link":{"url":"/projects/CoolProject/repos/greatest_repo/pull-requests/393","rel":"self"},"links":{"self":[{"href":"https://some-stash-host.com/projects/CoolProject/repos/greatest_repo/pull-requests/393"}]}}
@@ -0,0 +1 @@
1
+ {"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":null}]}
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rspec'
4
+ require 'stash_core_api'
5
+ require 'webmock/rspec'
6
+
7
+ RSpec.configure(&:disable_monkey_patching!)
8
+
9
+ def stub_get(client, path)
10
+ stub_request(:get, scrub(client.stash_url + path))
11
+ end
12
+
13
+ def scrub(path)
14
+ path.gsub(%r{([^:])//}, '\1/')
15
+ end
16
+
17
+ def base_path(client)
18
+ StashCoreAPI::Request::BASE_API_PATH +
19
+ "/projects/#{client.project}/repos/#{client.repository}"
20
+ end
21
+
22
+ def fixture_path
23
+ File.expand_path('../fixtures', __FILE__)
24
+ end
25
+
26
+ def fixture(file)
27
+ File.new(fixture_path + '/' + file)
28
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe StashCoreAPI::Client do
4
+ let(:client) do
5
+ StashCoreAPI::Client.new(
6
+ user: 'user',
7
+ pass: 'pass',
8
+ project: 'project',
9
+ repository: 'repository',
10
+ stash_url: 'https://stash.com',
11
+ )
12
+ end
13
+
14
+ describe '#new' do
15
+ it 'takes a hash and returns a StashCoreAPI::Client object' do
16
+ expect(client).to be_a StashCoreAPI::Client
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe StashCoreAPI::Client do
4
+ let(:client) do
5
+ StashCoreAPI::Client.new(
6
+ user: 'user',
7
+ pass: 'pass',
8
+ project: 'project',
9
+ repository: 'repository',
10
+ stash_url: 'https://stash.com',
11
+ )
12
+ end
13
+
14
+ describe '#commits' do
15
+ context 'limit' do
16
+ it 'defaults to 25 if no limit is specified' do
17
+ endpoint = "/#{base_path(client)}/commits"
18
+ stub_get(client, endpoint).to_return(
19
+ body: fixture('commits.json'),
20
+ headers: { 'Content-Type' => 'application/json' }
21
+ )
22
+ commits = client.commits
23
+ expect(commits['size']).to eq(25)
24
+ end
25
+
26
+ it 'is the same as number of commits returned' do
27
+ limit = 2
28
+ endpoint = "/#{base_path(client)}/commits?limit=#{limit}"
29
+ stub_get(client, endpoint).to_return(
30
+ body: fixture('commits_with_limit.json'),
31
+ headers: { 'Content-Type' => 'application/json' }
32
+ )
33
+ commits = client.commits(limit: 2)
34
+ expect(commits['size']).to eq(limit)
35
+ end
36
+ end
37
+
38
+ context 'with_count' do
39
+ let(:count_keys) { %w( authorCount totalCount ) }
40
+
41
+ it 'does not include count keys if with_count is not set' do
42
+ endpoint = "/#{base_path(client)}/commits"
43
+ stub_get(client, endpoint).to_return(
44
+ body: fixture('commits.json'),
45
+ headers: { 'Content-Type' => 'application/json' }
46
+ )
47
+ commits = client.commits
48
+ expect(count_keys - commits.keys).to eq(count_keys)
49
+ end
50
+
51
+ it 'includes count keys if with_count is set' do
52
+ endpoint = "/#{base_path(client)}/commits?withCounts=true"
53
+ stub_get(client, endpoint).to_return(
54
+ body: fixture('commits_with_with_count.json'),
55
+ headers: { 'Content-Type' => 'application/json' }
56
+ )
57
+ commits = client.commits(with_counts: true)
58
+ expect(count_keys - commits.keys).to be_empty
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe StashCoreAPI::Error do
4
+ describe '#new' do
5
+ it 'parses out the error message from body' do
6
+ body = { 'errors' => [{ 'message' => 'error' }] }
7
+ error = StashCoreAPI::Error::ClientError.new(body)
8
+ expect(error.message).to eq('error')
9
+ end
10
+
11
+ it 'handles an empty hash' do
12
+ error = StashCoreAPI::Error::ClientError.new({})
13
+ expect(error.message).to eq('')
14
+ end
15
+
16
+ it 'handles an empty errors' do
17
+ error = StashCoreAPI::Error::ClientError.new('errors' => [])
18
+ expect(error.message).to eq('')
19
+ end
20
+
21
+ it 'handles an empty inner message' do
22
+ error = StashCoreAPI::Error::ClientError.new('errors' => [{}])
23
+ expect(error.message).to eq('')
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe StashCoreAPI::Client do
4
+ let(:client) do
5
+ StashCoreAPI::Client.new(
6
+ user: 'user',
7
+ pass: 'pass',
8
+ project: 'project',
9
+ repository: 'repository',
10
+ stash_url: 'https://stash.com',
11
+ )
12
+ end
13
+
14
+ describe '#can_merge?' do
15
+ let(:pr_id) { 1 }
16
+ let(:endpoint) { "/#{base_path(client)}/pull-requests/#{pr_id}/merge" }
17
+
18
+ it 'returns true if pr can be merged' do
19
+ stub_get(client, endpoint).to_return(
20
+ body: fixture('can_merge.json'),
21
+ headers: { 'Content-Type' => 'application/json' }
22
+ )
23
+ expect(client.can_merge?(pr_id)).to be true
24
+ end
25
+
26
+ it 'returns false if pr cannot be merged' do
27
+ stub_get(client, endpoint).to_return(
28
+ body: fixture('cannot_merge.json'),
29
+ headers: { 'Content-Type' => 'application/json' }
30
+ )
31
+ expect(client.can_merge?(pr_id)).to be false
32
+ end
33
+ end
34
+
35
+ describe '#info' do
36
+ let(:pr_id) { 393 }
37
+ let(:endpoint) { "/#{base_path(client)}/pull-requests/#{pr_id}" }
38
+
39
+ it 'returns a JSON hash of body' do
40
+ stub_get(client, endpoint).to_return(
41
+ body: fixture('info.json'),
42
+ headers: { 'Content-Type' => 'application/json' }
43
+ )
44
+ expect(client.info(pr_id)).to eq(JSON.parse(fixture('info.json').read))
45
+ end
46
+
47
+ it 'returns expected keys in hash' do
48
+ stub_get(client, endpoint).to_return(
49
+ body: fixture('info.json'),
50
+ headers: { 'Content-Type' => 'application/json' }
51
+ )
52
+ info = client.info(pr_id)
53
+ expected_keys = %w( id version title state open closed createdDate
54
+ updatedDate fromRef toRef locked author reviewers
55
+ participants link links )
56
+ expect(info.keys).to eq(expected_keys)
57
+ end
58
+
59
+ context 'pull request id' do
60
+ it 'matches id in JSON body' do
61
+ stub_get(client, endpoint).to_return(
62
+ body: fixture('info.json'),
63
+ headers: { 'Content-Type' => 'application/json' }
64
+ )
65
+ info = client.info(pr_id)
66
+ expect(info['id']).to eq(pr_id)
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe StashCoreAPI::Request do
4
+ let(:client) do
5
+ StashCoreAPI::Client.new(
6
+ user: 'user',
7
+ pass: 'pass',
8
+ project: 'project',
9
+ repository: 'repository',
10
+ stash_url: 'https://stash.com',
11
+ )
12
+ end
13
+
14
+ describe 'error handling' do
15
+ let(:endpoint) { "/#{base_path(client)}/endpoint" }
16
+ let(:request) { StashCoreAPI::Request.new(client, '/endpoint') }
17
+
18
+ it 'raises an UnauthorizedError for invalid credentials' do
19
+ stub_get(client, endpoint).to_return(
20
+ body: fixture('unauthorized_error.json'),
21
+ status: 401,
22
+ headers: { 'Content-Type' => 'application/json' }
23
+ )
24
+ expect { request.get }.to raise_error(StashCoreAPI::Error::Unauthorized)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'stash_core_api'
5
+
6
+ RSpec.describe StashCoreAPI do
7
+ it 'should have a VERSION constant' do
8
+ expect(subject.const_get('VERSION')).not_to be_empty
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.expand_path('../lib/stash_core_api/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'stash_core_api'
7
+ gem.version = StashCoreAPI::VERSION
8
+ gem.summary = 'Atlassian Stash Core REST API Client'
9
+ gem.description = 'Make basic auth requests to Stash Core REST API'
10
+ gem.license = 'Apache-2.0'
11
+ gem.authors = ['Alyssa Pohahau']
12
+ gem.email = 'arp@squareup.com'
13
+ gem.homepage = 'https://rubygems.org/gems/stash_core_api'
14
+
15
+ gem.files = `git ls-files`.split($RS)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ['lib']
19
+
20
+ gem.required_ruby_version = '>= 2.0'
21
+
22
+ gem.add_dependency 'http', '~> 0.8.12'
23
+
24
+ gem.add_development_dependency 'bundler', '~> 1.2'
25
+ gem.add_development_dependency 'rake', '~> 10.0'
26
+ gem.add_development_dependency 'rspec', '~> 3.0'
27
+ gem.add_development_dependency 'webmock', '~> 1.21'
28
+ gem.add_development_dependency 'yard', '~> 0.8'
29
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stash_core_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Alyssa Pohahau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.12
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.12
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.21'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.21'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
97
+ description: Make basic auth requests to Stash Core REST API
98
+ email: arp@squareup.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - ".travis.yml"
104
+ - CHANGELOG.md
105
+ - CONTRIBUTING.md
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - kochiku.yml
112
+ - lib/stash_core_api.rb
113
+ - lib/stash_core_api/api.rb
114
+ - lib/stash_core_api/client.rb
115
+ - lib/stash_core_api/commits.rb
116
+ - lib/stash_core_api/error.rb
117
+ - lib/stash_core_api/pull_requests.rb
118
+ - lib/stash_core_api/request.rb
119
+ - lib/stash_core_api/utils.rb
120
+ - lib/stash_core_api/version.rb
121
+ - spec/fixtures/can_merge.json
122
+ - spec/fixtures/cannot_merge.json
123
+ - spec/fixtures/commits.json
124
+ - spec/fixtures/commits_with_limit.json
125
+ - spec/fixtures/commits_with_with_count.json
126
+ - spec/fixtures/info.json
127
+ - spec/fixtures/unauthorized_error.json
128
+ - spec/spec_helper.rb
129
+ - spec/stash_core_api/client_spec.rb
130
+ - spec/stash_core_api/commits_spec.rb
131
+ - spec/stash_core_api/error_spec.rb
132
+ - spec/stash_core_api/pull_requests_spec.rb
133
+ - spec/stash_core_api/request_spec.rb
134
+ - spec/stash_core_api_spec.rb
135
+ - stash_core_api.gemspec
136
+ homepage: https://rubygems.org/gems/stash_core_api
137
+ licenses:
138
+ - Apache-2.0
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '2.0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.5.0
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Atlassian Stash Core REST API Client
160
+ test_files:
161
+ - spec/fixtures/can_merge.json
162
+ - spec/fixtures/cannot_merge.json
163
+ - spec/fixtures/commits.json
164
+ - spec/fixtures/commits_with_limit.json
165
+ - spec/fixtures/commits_with_with_count.json
166
+ - spec/fixtures/info.json
167
+ - spec/fixtures/unauthorized_error.json
168
+ - spec/spec_helper.rb
169
+ - spec/stash_core_api/client_spec.rb
170
+ - spec/stash_core_api/commits_spec.rb
171
+ - spec/stash_core_api/error_spec.rb
172
+ - spec/stash_core_api/pull_requests_spec.rb
173
+ - spec/stash_core_api/request_spec.rb
174
+ - spec/stash_core_api_spec.rb
175
+ has_rdoc: