tinybucket 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +10 -1
  3. data/Gemfile +8 -7
  4. data/README.md +28 -5
  5. data/Rakefile +1 -0
  6. data/lib/faraday_middleware/follow_oauth_redirects.rb +5 -2
  7. data/lib/tinybucket.rb +2 -0
  8. data/lib/tinybucket/api.rb +3 -0
  9. data/lib/tinybucket/api/base_api.rb +2 -0
  10. data/lib/tinybucket/api/branch_restrictions_api.rb +6 -5
  11. data/lib/tinybucket/api/branches_api.rb +48 -0
  12. data/lib/tinybucket/api/build_status_api.rb +15 -1
  13. data/lib/tinybucket/api/comments_api.rb +7 -6
  14. data/lib/tinybucket/api/commits_api.rb +25 -4
  15. data/lib/tinybucket/api/diff_api.rb +4 -3
  16. data/lib/tinybucket/api/helper.rb +3 -0
  17. data/lib/tinybucket/api/helper/api_helper.rb +2 -0
  18. data/lib/tinybucket/api/helper/branch_restrictions_helper.rb +2 -0
  19. data/lib/tinybucket/api/helper/branches_helper.rb +29 -0
  20. data/lib/tinybucket/api/helper/build_status_helper.rb +11 -0
  21. data/lib/tinybucket/api/helper/comments_helper.rb +2 -0
  22. data/lib/tinybucket/api/helper/commits_helper.rb +8 -0
  23. data/lib/tinybucket/api/helper/diff_helper.rb +2 -0
  24. data/lib/tinybucket/api/helper/pull_requests_helper.rb +2 -0
  25. data/lib/tinybucket/api/helper/repo_helper.rb +2 -0
  26. data/lib/tinybucket/api/helper/repos_helper.rb +2 -0
  27. data/lib/tinybucket/api/helper/team_helper.rb +2 -0
  28. data/lib/tinybucket/api/helper/user_helper.rb +2 -0
  29. data/lib/tinybucket/api/pull_requests_api.rb +4 -3
  30. data/lib/tinybucket/api/repo_api.rb +4 -3
  31. data/lib/tinybucket/api/repos_api.rb +3 -1
  32. data/lib/tinybucket/api/team_api.rb +4 -2
  33. data/lib/tinybucket/api/user_api.rb +3 -1
  34. data/lib/tinybucket/api_factory.rb +2 -0
  35. data/lib/tinybucket/client.rb +3 -2
  36. data/lib/tinybucket/config.rb +5 -1
  37. data/lib/tinybucket/connection.rb +21 -8
  38. data/lib/tinybucket/constants.rb +2 -0
  39. data/lib/tinybucket/enumerator.rb +2 -0
  40. data/lib/tinybucket/error.rb +2 -0
  41. data/lib/tinybucket/error/base_error.rb +2 -0
  42. data/lib/tinybucket/error/conflict.rb +2 -0
  43. data/lib/tinybucket/error/not_found.rb +2 -0
  44. data/lib/tinybucket/error/service_error.rb +2 -0
  45. data/lib/tinybucket/iterator.rb +4 -2
  46. data/lib/tinybucket/model.rb +3 -0
  47. data/lib/tinybucket/model/base.rb +2 -2
  48. data/lib/tinybucket/model/branch.rb +48 -0
  49. data/lib/tinybucket/model/branch_restriction.rb +4 -2
  50. data/lib/tinybucket/model/build_status.rb +3 -1
  51. data/lib/tinybucket/model/comment.rb +4 -2
  52. data/lib/tinybucket/model/commit.rb +6 -2
  53. data/lib/tinybucket/model/concerns.rb +2 -0
  54. data/lib/tinybucket/model/concerns/acceptable_attributes.rb +2 -0
  55. data/lib/tinybucket/model/concerns/api_callable.rb +2 -0
  56. data/lib/tinybucket/model/concerns/enumerable.rb +2 -0
  57. data/lib/tinybucket/model/concerns/reloadable.rb +2 -0
  58. data/lib/tinybucket/model/concerns/repository_keys.rb +2 -0
  59. data/lib/tinybucket/model/error_response.rb +4 -2
  60. data/lib/tinybucket/model/page.rb +4 -2
  61. data/lib/tinybucket/model/profile.rb +4 -2
  62. data/lib/tinybucket/model/pull_request.rb +4 -2
  63. data/lib/tinybucket/model/repository.rb +31 -5
  64. data/lib/tinybucket/model/team.rb +4 -2
  65. data/lib/tinybucket/null_logger.rb +2 -0
  66. data/lib/tinybucket/parser.rb +5 -0
  67. data/lib/tinybucket/parser/base_parser.rb +3 -2
  68. data/lib/tinybucket/parser/branch_parser.rb +13 -0
  69. data/lib/tinybucket/parser/branch_restriction_parser.rb +2 -0
  70. data/lib/tinybucket/parser/branch_restrictions_parser.rb +2 -0
  71. data/lib/tinybucket/parser/branches_parser.rb +11 -0
  72. data/lib/tinybucket/parser/build_status_parser.rb +2 -0
  73. data/lib/tinybucket/parser/builds_parser.rb +11 -0
  74. data/lib/tinybucket/parser/comment_parser.rb +2 -0
  75. data/lib/tinybucket/parser/comments_parser.rb +2 -0
  76. data/lib/tinybucket/parser/commit_parser.rb +2 -0
  77. data/lib/tinybucket/parser/commits_parser.rb +2 -0
  78. data/lib/tinybucket/parser/profile_parser.rb +2 -0
  79. data/lib/tinybucket/parser/profiles_parser.rb +2 -0
  80. data/lib/tinybucket/parser/pull_request_parser.rb +2 -0
  81. data/lib/tinybucket/parser/pull_requests_parser.rb +2 -0
  82. data/lib/tinybucket/parser/repo_parser.rb +2 -0
  83. data/lib/tinybucket/parser/repos_parser.rb +2 -0
  84. data/lib/tinybucket/parser/team_parser.rb +2 -0
  85. data/lib/tinybucket/parser/teams_parser.rb +2 -0
  86. data/lib/tinybucket/request.rb +2 -0
  87. data/lib/tinybucket/resource.rb +3 -0
  88. data/lib/tinybucket/resource/base.rb +6 -0
  89. data/lib/tinybucket/resource/branch_restrictions.rb +2 -0
  90. data/lib/tinybucket/resource/branches.rb +35 -0
  91. data/lib/tinybucket/resource/commit/base.rb +2 -0
  92. data/lib/tinybucket/resource/commit/build_statuses.rb +6 -3
  93. data/lib/tinybucket/resource/commit/comments.rb +2 -0
  94. data/lib/tinybucket/resource/commits.rb +13 -0
  95. data/lib/tinybucket/resource/forks.rb +2 -0
  96. data/lib/tinybucket/resource/pull_request/base.rb +2 -0
  97. data/lib/tinybucket/resource/pull_request/comments.rb +2 -0
  98. data/lib/tinybucket/resource/pull_request/commits.rb +2 -0
  99. data/lib/tinybucket/resource/pull_requests.rb +2 -0
  100. data/lib/tinybucket/resource/repos.rb +2 -0
  101. data/lib/tinybucket/resource/team/base.rb +2 -0
  102. data/lib/tinybucket/resource/team/followers.rb +2 -0
  103. data/lib/tinybucket/resource/team/following.rb +2 -0
  104. data/lib/tinybucket/resource/team/members.rb +2 -0
  105. data/lib/tinybucket/resource/team/repos.rb +2 -0
  106. data/lib/tinybucket/resource/user/base.rb +2 -0
  107. data/lib/tinybucket/resource/user/followers.rb +2 -0
  108. data/lib/tinybucket/resource/user/following.rb +2 -0
  109. data/lib/tinybucket/resource/user/repos.rb +2 -0
  110. data/lib/tinybucket/resource/watchers.rb +2 -0
  111. data/lib/tinybucket/response.rb +2 -0
  112. data/lib/tinybucket/response/handler.rb +2 -0
  113. data/lib/tinybucket/version.rb +3 -1
  114. data/tinybucket.gemspec +1 -1
  115. metadata +11 -193
  116. data/.coveralls.yml +0 -1
  117. data/.gitignore +0 -33
  118. data/.rspec +0 -1
  119. data/.travis.yml +0 -13
  120. data/Guardfile +0 -13
  121. data/spec/fixtures/branch_restriction.json +0 -17
  122. data/spec/fixtures/build_status.json +0 -16
  123. data/spec/fixtures/comment.json +0 -30
  124. data/spec/fixtures/commit.json +0 -83
  125. data/spec/fixtures/profile.json +0 -29
  126. data/spec/fixtures/pull_request.json +0 -106
  127. data/spec/fixtures/repositories/get.json +0 -78
  128. data/spec/fixtures/repositories/test_owner/get.json +0 -78
  129. data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/1/get.json +0 -17
  130. data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/get.json +0 -101
  131. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/approve/post.json +0 -16
  132. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/1/get.json +0 -38
  133. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/get.json +0 -40
  134. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/get.json +0 -83
  135. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/post.json +0 -16
  136. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/get.json +0 -16
  137. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/put.json +0 -16
  138. data/spec/fixtures/repositories/test_owner/test_repo/commits/get.json +0 -73
  139. data/spec/fixtures/repositories/test_owner/test_repo/diff/1/get.json +0 -21
  140. data/spec/fixtures/repositories/test_owner/test_repo/forks/get.json +0 -78
  141. data/spec/fixtures/repositories/test_owner/test_repo/get.json +0 -71
  142. data/spec/fixtures/repositories/test_owner/test_repo/patch/1/get.json +0 -29
  143. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/delete.json +0 -3
  144. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/post.json +0 -3
  145. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json +0 -30
  146. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json +0 -44
  147. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json +0 -66
  148. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json +0 -116
  149. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt +0 -13
  150. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json +0 -164
  151. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/merge/post.json +0 -123
  152. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json +0 -112
  153. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json +0 -112
  154. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json +0 -112
  155. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_open.json +0 -112
  156. data/spec/fixtures/repositories/test_owner/test_repo/watchers/get.json +0 -32
  157. data/spec/fixtures/repository.json +0 -72
  158. data/spec/fixtures/team.json +0 -32
  159. data/spec/fixtures/teams/test_team/followers/get.json +0 -36
  160. data/spec/fixtures/teams/test_team/following/get.json +0 -39
  161. data/spec/fixtures/teams/test_team/get.json +0 -32
  162. data/spec/fixtures/teams/test_team/members/get.json +0 -36
  163. data/spec/fixtures/teams/test_team/repositories/get.json +0 -125
  164. data/spec/fixtures/users/test_owner/followers/get.json +0 -65
  165. data/spec/fixtures/users/test_owner/following/get.json +0 -100
  166. data/spec/fixtures/users/test_owner/get.json +0 -29
  167. data/spec/lib/tinybucket/api/branch_restrictions_api_spec.rb +0 -77
  168. data/spec/lib/tinybucket/api/build_status_api_spec.rb +0 -65
  169. data/spec/lib/tinybucket/api/comments_api_spec.rb +0 -132
  170. data/spec/lib/tinybucket/api/commits_api_spec.rb +0 -152
  171. data/spec/lib/tinybucket/api/diff_api_spec.rb +0 -5
  172. data/spec/lib/tinybucket/api/pull_requests_api_spec.rb +0 -259
  173. data/spec/lib/tinybucket/api/repo_api_spec.rb +0 -99
  174. data/spec/lib/tinybucket/api/repos_api_spec.rb +0 -27
  175. data/spec/lib/tinybucket/api/team_api_spec.rb +0 -82
  176. data/spec/lib/tinybucket/api/user_api_spec.rb +0 -73
  177. data/spec/lib/tinybucket/api_factory_spec.rb +0 -18
  178. data/spec/lib/tinybucket/client_spec.rb +0 -100
  179. data/spec/lib/tinybucket/connection_spec.rb +0 -30
  180. data/spec/lib/tinybucket/error/service_error_spec.rb +0 -23
  181. data/spec/lib/tinybucket/model/branch_restriction_spec.rb +0 -35
  182. data/spec/lib/tinybucket/model/build_status_spec.rb +0 -66
  183. data/spec/lib/tinybucket/model/comment_spec.rb +0 -37
  184. data/spec/lib/tinybucket/model/commit_spec.rb +0 -108
  185. data/spec/lib/tinybucket/model/page_spec.rb +0 -28
  186. data/spec/lib/tinybucket/model/profile_spec.rb +0 -52
  187. data/spec/lib/tinybucket/model/pull_request_spec.rb +0 -141
  188. data/spec/lib/tinybucket/model/repository_spec.rb +0 -131
  189. data/spec/lib/tinybucket/model/team_spec.rb +0 -70
  190. data/spec/lib/tinybucket/null_logger_spec.rb +0 -53
  191. data/spec/lib/tinybucket/resource/branch_restrictions_spec.rb +0 -60
  192. data/spec/lib/tinybucket/resource/commit/build_statuses_spec.rb +0 -50
  193. data/spec/lib/tinybucket/resource/commit/comments_spec.rb +0 -49
  194. data/spec/lib/tinybucket/resource/commits_spec.rb +0 -43
  195. data/spec/lib/tinybucket/resource/forks_spec.rb +0 -36
  196. data/spec/lib/tinybucket/resource/pull_request/comments_spec.rb +0 -41
  197. data/spec/lib/tinybucket/resource/pull_request/commits_spec.rb +0 -41
  198. data/spec/lib/tinybucket/resource/pull_requests_spec.rb +0 -59
  199. data/spec/lib/tinybucket/resource/repos_spec.rb +0 -76
  200. data/spec/lib/tinybucket/resource/team/followers_spec.rb +0 -27
  201. data/spec/lib/tinybucket/resource/team/following_spec.rb +0 -27
  202. data/spec/lib/tinybucket/resource/team/members_spec.rb +0 -27
  203. data/spec/lib/tinybucket/resource/team/repos_spec.rb +0 -27
  204. data/spec/lib/tinybucket/resource/user/followers_spec.rb +0 -27
  205. data/spec/lib/tinybucket/resource/user/following_spec.rb +0 -27
  206. data/spec/lib/tinybucket/resource/user/repos_spec.rb +0 -27
  207. data/spec/lib/tinybucket/resource/watchers_spec.rb +0 -38
  208. data/spec/lib/tinybucket_spec.rb +0 -42
  209. data/spec/spec_helper.rb +0 -45
  210. data/spec/support/api_response_macros.rb +0 -74
  211. data/spec/support/fixture_macros.rb +0 -5
  212. data/spec/support/model_macros.rb +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef69fc38261a66035f6b72b1e767ec749151ef63
4
- data.tar.gz: d286e78ed4b5d57e1ab9281e7387b5e3e53b5c8d
3
+ metadata.gz: ed12324002ab5952c612faf543af7d705047ed6c
4
+ data.tar.gz: db4392d5bbb95d6e40169ca48742baaa9051d8cd
5
5
  SHA512:
6
- metadata.gz: 56e151d12522b22a2661d46a88d6f63cfaae6d233774e74ecaa79ceb0d5495d1a249b58184d1c678f054791c0e26414199eb946731cbc85b70240214f762f25f
7
- data.tar.gz: 565f64d75e6100c5bb87297368dad0fc07da3ad3716885965ed56f118d0c98d5a897a25b1a547441ff8c257c34fb0a403d344ae88e260f1e82cfdf774796cba5
6
+ metadata.gz: 6ecc10dd11258c440125c0c302540ce6aec02024a00e19d0d82216afc65c5a73048d0bc7c7474f339e7c0b0b4d512785a59aac3998ceef55d3cc1507c7b0dff0
7
+ data.tar.gz: 72b1d6d150ce83c0b804264159fa37de12d7ab76992ceae6be809f2a80147ba700a62cffd151e51e2098bfee5f5f1a22dcab6b2ea064e84c1eeae980b3713bed
@@ -2,7 +2,7 @@ AllCops:
2
2
  Include:
3
3
  - 'lib/**/*.rb'
4
4
  Exclude:
5
- - 'app.rb'
5
+ - '*.rb'
6
6
  - 'spec/**/*'
7
7
  - 'features/**/*'
8
8
  - 'test/**/*'
@@ -44,5 +44,14 @@ Style/AlignHash:
44
44
  Style/RaiseArgs:
45
45
  Enabled: false
46
46
 
47
+ Style/RedundantFreeze:
48
+ Enabled: false
49
+
47
50
  Metrics/AbcSize:
48
51
  Max: 18
52
+
53
+ Metrics/LineLength:
54
+ Max: 100
55
+ IgnoredPatterns: [
56
+ '^\s*#'
57
+ ]
data/Gemfile CHANGED
@@ -3,12 +3,7 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in bitbucket.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rake', '~> 10.4'
7
- gem 'rspec', '~> 3.4'
8
- gem 'rspec-mocks', '~> 3.4'
9
- gem 'webmock', '~> 1.24'
10
- gem 'rubocop', '~> 0.41'
11
-
6
+ gem 'simple-auth', '~> 0.3.1'
12
7
  gem 'yard', '~> 0.8.7'
13
8
  gem 'yardstick', '~> 0.9'
14
9
 
@@ -23,10 +18,16 @@ group :development, :test do
23
18
 
24
19
  gem 'guard-rubocop'
25
20
  gem 'gem-release'
21
+
22
+ gem 'rake', '~> 10.4'
23
+ gem 'rspec', '~> 3.4'
24
+ gem 'rspec-mocks', '~> 3.4'
25
+ gem 'webmock', '~> 1.24'
26
+ gem 'rubocop', '~> 0.46.0'
26
27
  end
27
28
 
28
29
  group :test do
29
30
  gem 'simplecov', '~> 0.11', require: false
30
31
  gem 'coveralls', '~> 0.8', require: false
31
- gem 'codeclimate-test-reporter', require: nil
32
+ gem 'codeclimate-test-reporter', '~> 1.0.0', require: nil
32
33
  end
data/README.md CHANGED
@@ -27,7 +27,7 @@ And then execute:
27
27
 
28
28
  Or install it yourself as:
29
29
 
30
- $ gem install bitbucket
30
+ $ gem install tinybucket
31
31
 
32
32
  ## Usage
33
33
 
@@ -54,7 +54,11 @@ Tinybucket.configure do |config|
54
54
  # optional, default: nil (disable request cache)
55
55
  config.cache_store_options = { store: Rails.cache, logger: logger }
56
56
 
57
- # Configure oauth_token/oauth_secret
57
+ # Configure access_token if you can prepare OAuth2 access_token.
58
+ config.access_token = 'your_access_token'
59
+
60
+ # Configure oauth_token/oauth_secret if you want to use OAuth1.0 authentication.
61
+ # (This config will be ignored if you configure OAuth2 access_token.)
58
62
  config.oauth_token = 'key'
59
63
  config.oauth_secret = 'secret'
60
64
  end
@@ -76,15 +80,15 @@ repos = repos('my_name').select do |repo|
76
80
  end.map(&:full_name)
77
81
  ```
78
82
 
79
- This enumerable feature depends on [Paging through object collections](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) at Bitbucket Cloud REST API.
83
+ This enumerable feature depends on [Paging through object collections](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) at Bitbucket Cloud REST API.
80
84
 
81
85
  #### NOTE: About `size` attribute
82
86
 
83
- [object collections wrapper](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) has `size` attribute at Bitbucket Cloud REST API.
87
+ [object collections wrapper](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) has `size` attribute at Bitbucket Cloud REST API.
84
88
 
85
89
  The `size` attribute describe as `optional` attribute.
86
90
 
87
- In tinybucket gem, collection size depend on `side` attribute of [object collections wrapper](https://confluence.atlassian.com/bitbucket/version-2-423626329.html#Version2-Pagingthroughobjectcollections) in Bitbucket Cloud REST API.
91
+ In tinybucket gem, collection size depend on `side` attribute of [object collections wrapper](https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination) in Bitbucket Cloud REST API.
88
92
 
89
93
  So enumerator's `size` attribute may return `nil`.
90
94
 
@@ -261,6 +265,25 @@ commit.approve
261
265
  commit.unapprove
262
266
  ```
263
267
 
268
+ ##### branches Resource
269
+
270
+ ###### Collection Methods
271
+
272
+ ```ruby
273
+ repo = bucket.repo('someone', 'great_repo')
274
+
275
+ # [x ] GET a list of branches
276
+ branches = repo.branches(options)
277
+ ```
278
+
279
+ ###### Object Methods
280
+ ```ruby
281
+ repo = bucket.repo('someone', 'great_repo')
282
+
283
+ # [x] GET a specific branch
284
+ branch = repo.branch(branch_name)
285
+ ```
286
+
264
287
  ##### branch-restrictions Resource
265
288
 
266
289
  ###### Collection Methods
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ desc 'cleanup rcov, doc directories'
7
7
  task :clean do
8
8
  rm_rf 'coverage'
9
9
  rm_rf 'doc'
10
+ rm_rf 'measurement'
10
11
  end
11
12
 
12
13
  # https://github.com/sferik/twitter/blob/master/Rakefile
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'faraday_middleware'
3
5
 
@@ -13,8 +15,9 @@ module FaradayMiddleware
13
15
  env = super(env, request_body, response)
14
16
 
15
17
  # update Authentication Header
16
- env[:request_headers][OAuth::AUTH_HEADER] = \
17
- oauth_header(env).to_s if oauth_signed_request?(env)
18
+ if oauth_signed_request?(env)
19
+ env[:request_headers][OAuth::AUTH_HEADER] = oauth_header(env).to_s
20
+ end
18
21
 
19
22
  env
20
23
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tinybucket/version'
2
4
 
3
5
  require 'active_support/dependencies/autoload'
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  extend ActiveSupport::Autoload
4
6
 
5
7
  [
6
8
  :BaseApi,
9
+ :BranchesApi,
7
10
  :BranchRestrictionsApi,
8
11
  :BuildStatusApi,
9
12
  :CommitsApi,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  class BaseApi
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  # BranchRestrictions API client
4
6
  #
5
- # @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html
7
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions
6
8
  # branch-restrictions Resource
7
9
  #
8
10
  # @!attribute [rw] repo_owner
9
11
  # @return [String] repository owner name.
10
12
  # @!attribute [rw] repo_slug
11
- # @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
12
- # repo_slug})
13
+ # @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
13
14
  class BranchRestrictionsApi < BaseApi
14
15
  include Tinybucket::Api::Helper::BranchRestrictionsHelper
15
16
 
@@ -17,7 +18,7 @@ module Tinybucket
17
18
 
18
19
  # Send 'GET the branch-restrictions' request.
19
20
  #
20
- # @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html#branch-restrictionsResource-GETthebranch-restrictions
21
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions#get
21
22
  # GET the branch-restrictions
22
23
  #
23
24
  # @param options [Hash]
@@ -32,7 +33,7 @@ module Tinybucket
32
33
 
33
34
  # Send 'GET a specific restriction' request.
34
35
  #
35
- # @see https://confluence.atlassian.com/bitbucket/branch-restrictions-resource-387449181.html#branch-restrictionsResource-GETaspecificrestriction
36
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions/%7Bid%7D#get
36
37
  # GET a specific restriction
37
38
  #
38
39
  # @param restriction_id [String] The restriction's identifier
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tinybucket
4
+ module Api
5
+ # Branches Api client
6
+ #
7
+ # @!attribute [rw] repo_owner
8
+ # @return [String] repository owner name.
9
+ # @!attribute [rw] repo_slug
10
+ # @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repo_slug}.
11
+ class BranchesApi < BaseApi
12
+ include Tinybucket::Api::Helper::BranchesHelper
13
+
14
+ attr_accessor :repo_owner, :repo_slug
15
+
16
+ # Send 'GET a branches list for a repository' request
17
+ #
18
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches#get
19
+ # GET a branches list for a repository
20
+ #
21
+ # @param options [Hash]
22
+ # @return [Tinybucket::Model::Page]
23
+ def list(options = {})
24
+ get_path(
25
+ path_to_list,
26
+ options,
27
+ Tinybucket::Parser::BranchesParser
28
+ )
29
+ end
30
+
31
+ # Send 'GET an individual branch' request
32
+ #
33
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches/%7Bname%7D#get
34
+ # GET an individual branch
35
+ #
36
+ # @param name [String] The branch name
37
+ # @param options [Hash]
38
+ # @return [Tinybucket::Model::Branch]
39
+ def find(name, options = {})
40
+ get_path(
41
+ path_to_find(name),
42
+ options,
43
+ Tinybucket::Parser::BranchParser
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  # BuildStatus Api client
@@ -7,7 +9,19 @@ module Tinybucket
7
9
  class BuildStatusApi < BaseApi
8
10
  include Tinybucket::Api::Helper::BuildStatusHelper
9
11
 
10
- attr_accessor :repo_owner, :repo_slug
12
+ attr_accessor :revision, :repo_owner, :repo_slug
13
+
14
+ # Send 'GET a builds list for a commit' request
15
+ #
16
+ # @param options [Hash]
17
+ # @return [Tinybucket::Model::Page]
18
+ def list(options = {})
19
+ get_path(
20
+ path_to_list,
21
+ options,
22
+ Tinybucket::Parser::BuildsParser
23
+ )
24
+ end
11
25
 
12
26
  # Send 'GET the build status for a commit' request
13
27
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  # Comments Api client
@@ -5,8 +7,7 @@ module Tinybucket
5
7
  # @!attribute [rw] repo_owner
6
8
  # @return [String] repository owner name.
7
9
  # @!attribute [rw] repo_slug
8
- # @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
9
- # repo_slug})
10
+ # @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
10
11
  # @!attribute [rw] commented_to
11
12
  # @return [Tinybucket::Model::Commit, Tinybucket::Model::PullRequest]
12
13
  class CommentsApi < BaseApi
@@ -21,10 +22,10 @@ module Tinybucket
21
22
  # This method send different request depend on 'commented_to' attribute.
22
23
  #
23
24
  # @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
24
- # this method send {https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETalistofcommitcomments
25
+ # this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments#get
25
26
  # GET a list of commit comments}.
26
27
  # @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
27
- # this method send {https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETalistofapullrequestcomments
28
+ # this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments#get
28
29
  # GET a list of pull request comments}.
29
30
  #
30
31
  # @param options [Hash]
@@ -43,10 +44,10 @@ module Tinybucket
43
44
  # This method send different request depend on 'commented_to' attribute.
44
45
  #
45
46
  # @note When 'commented_to' is {Tinybucket::Model::Commit} instance,
46
- # this method send {https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETanindividualcommitcomment
47
+ # this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments/%7Bcomment_id%7D#get
47
48
  # GET an individual commit comment}.
48
49
  # @note When 'commented_to' is {Tinybucket::Model::PullRequest} instance,
49
- # this method send {https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETanindividualpullrequestcomment
50
+ # this method send {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bsha%7D/comments/%7Bcomment_id%7D#get
50
51
  # GET an individual pull request comment}.
51
52
  #
52
53
  # @param comment_id [String] comment identifier
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  # Commits Api client
@@ -5,8 +7,7 @@ module Tinybucket
5
7
  # @!attribute [rw] repo_owner
6
8
  # @return [String] repository owner name.
7
9
  # @!attribute [rw] repo_slug
8
- # @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
9
- # repo_slug})
10
+ # @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
10
11
  class CommitsApi < BaseApi
11
12
  include Tinybucket::Api::Helper::CommitsHelper
12
13
 
@@ -14,7 +15,7 @@ module Tinybucket
14
15
 
15
16
  # Send 'GET a commits list for a repository' request
16
17
  #
17
- # @see https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETacommitslistforarepositoryorcomparecommitsacrossbranches
18
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits#get
18
19
  # GET a commits list for a repository
19
20
  #
20
21
  # @note This method does not support 'compare commits across branches'
@@ -32,7 +33,7 @@ module Tinybucket
32
33
 
33
34
  # Send 'GET an individual commit' request
34
35
  #
35
- # @see https://confluence.atlassian.com/bitbucket/commits-or-commit-resource-389775478.html#commitsorcommitResource-GETanindividualcommit
36
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits/%7Brevision%7D#get
36
37
  # GET an individual commit
37
38
  #
38
39
  # @param revision [String] A SHA1 value for the commit.
@@ -47,6 +48,8 @@ module Tinybucket
47
48
  end
48
49
 
49
50
  # Send 'POST a commit approval' request
51
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#post
52
+ # POST a commit approval request
50
53
  #
51
54
  # @param revision [String]
52
55
  # @param options [Hash]
@@ -60,6 +63,8 @@ module Tinybucket
60
63
  end
61
64
 
62
65
  # Send 'DELETE a commit approval' request
66
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/approve#delete
67
+ # DELETE a commit approval (unapprove the commit)
63
68
  #
64
69
  # @param revision [String]
65
70
  # @param options [Hash]
@@ -71,6 +76,22 @@ module Tinybucket
71
76
  logger.debug 'Already unapproved: ' + e.inspect
72
77
  true
73
78
  end
79
+
80
+ # Send 'GET commits for a branch' request
81
+ #
82
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commits
83
+ # GET an individual commit
84
+ #
85
+ # @param name [String] The branch name or a SHA1 value for the commit.
86
+ # @param options [Hash]
87
+ # @return [Tinybucket::Model::Commit]
88
+ def branch(name, options = {})
89
+ get_path(
90
+ path_to_branch(name),
91
+ options,
92
+ Tinybucket::Parser::CommitsParser
93
+ )
94
+ end
74
95
  end
75
96
  end
76
97
  end
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  # Diff Api client
4
6
  #
5
- # @see https://confluence.atlassian.com/bitbucket/diff-resource-425462484.html
7
+ # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/diff/%7Bspec%7D
6
8
  # diff Resource
7
9
  #
8
10
  # @!attribute [rw] repo_owner
9
11
  # @return [String] repository owner name.
10
12
  # @!attribute [rw] repo_slug
11
- # @return [String] repository slug. (about {https://confluence.atlassian.com/bitbucket/repositories-endpoint-423626330.html#repositoriesEndpoint-Overview
12
- # repo_slug})
13
+ # @return [String] {https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D repository slug}.
13
14
  class DiffApi < BaseApi
14
15
  include Tinybucket::Api::Helper::DiffHelper
15
16
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tinybucket
2
4
  module Api
3
5
  module Helper
@@ -5,6 +7,7 @@ module Tinybucket
5
7
 
6
8
  [
7
9
  :ApiHelper,
10
+ :BranchesHelper,
8
11
  :BranchRestrictionsHelper,
9
12
  :BuildStatusHelper,
10
13
  :CommitsHelper,