stash-api 1.1.30.0 → 1.1.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/stash-api/client.rb +8 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzY3YWFkOGIyN2NmNTg0MjIxZTEwNzc5YzZiMTA4OTUzMWUxMmJjMA==
4
+ MWMxMTMyMmQwMTc3OTViMjllNTNmMGNiZmE4MDk1ZjM1NjE1ZWI4Yw==
5
5
  data.tar.gz: !binary |-
6
- Nzc3MDdhZmYzZTU0MDJjOTNmNjNlN2IzODJiNWQ3M2VhNzQ5MmQ5NA==
6
+ YjM5YjA0ZWZjZTc1ZTM3N2QzYzlmNTkxOGYxZWRiNzE4N2RjZGQ2NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmE2NDg3M2FkZmM0MzgzMDZjNDQ3ZjRiZGNiN2M0OGZkNjBkZmViNjg1OGNl
10
- ZmJjYmFjYmRmZmRjYzM0NDA5NDk0OTNhYzg4ZmMxNWE1ZDU1NzVkMjg4MWRk
11
- MTViODJlOTQxYmU2YjBjODIzNjhkMDZmYTc0NjFjZTI3NWFhNTE=
9
+ MjY2ZjBhMTJhZjQ3NjlmYWRjYzcxZmIyMDEzMTJjOTBiZTRkODM0MzljYjkz
10
+ N2E1NGFjYTE3Y2ExZTE1NjkzOWUzYmEzZGZiZTk5NWRmNGVkMDFkNTc3ZDJm
11
+ Nzg0NTJlZThiZjgyOGE4MmM4Y2E1NjIyNzJmOTcwNTdiMzBiYzI=
12
12
  data.tar.gz: !binary |-
13
- YzI5ZDU5M2E2YWJiNzc4YWUzNjk1OWYyODk1NWE2MDc0NDgzMGFlZjAxZDM4
14
- ZDY3NjY0M2YzYmFiNzRiOGViNDQ5ZGQyZmQ3MTRmOTBiYmQ3NTJlZDE2M2Vl
15
- YjI3NzRkMTFmNzI3NGFlZTJiNWMzYmFhYjIwYzY5NTc4NjM5NzA=
13
+ MmI3MDVmMmVlYWE5NDhhMzYwMWIzY2QxMjI2OGU2OGE5MDc5ODZiY2E0ZTU0
14
+ OWIwZGE0N2VlOGY5YTVhMTE0Y2YxMjhkZjFmZGY5Zjg3NGU1MjQwZjVmZjM4
15
+ Y2Y1YzZiNmJiYWQwN2Q0N2NjZTk4ZmNkNjlhYmM0YjUwNmY5OGQ=
@@ -16,16 +16,12 @@ module Stash
16
16
 
17
17
  match = remote_origin_url.match(/(ssh|https?):\/\/([^@]*@)?(?<server>[^\:\/]*)[^\/]*\/(scm\/)?(?<project>[^\/].*)\/(?<repository_name>[^\/]*)\.git$/)
18
18
  raise "Remote origin cannot be inferred from the url: #{remote_origin_url}. Run `git remote add origin URL` to add an origin." if !match
19
-
20
- @remote_api_url = File.join("https://#{match[:server]}", 'rest', 'api', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
21
- @branch_permissions_url = File.join("https://#{match[:server]}", 'rest', 'branch-permissions', '2.0', 'projects', match[:project], 'repos', match[:repository_name], 'restrictions')
22
- @branchring_model_url = File.join("https://#{match[:server]}", 'rest', 'branch-utils', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
23
- @pull_request_settings = File.join("https://#{match[:server]}", 'rest', 'pullrequest-settings', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
19
+ @server = match[:server]
24
20
 
25
21
  repository_information = nil
26
22
  RestClient::Request.new(
27
23
  :method => :get,
28
- :url => URI::encode(@remote_api_url),
24
+ :url => URI::encode(File.join("https://#{@server}", 'rest', 'api', '1.0', 'projects', match[:project], 'repos', match[:repository_name])),
29
25
  :user => @username,
30
26
  :password => @password,
31
27
  :headers => { :accept => :json, :content_type => :json }).execute do |response, request, result|
@@ -39,6 +35,12 @@ module Stash
39
35
  @project = repository_information['project']['key']
40
36
  @repository_name = repository_information['slug']
41
37
  @ssh_url = repository_information['links']['clone'].select{|link| link['name'].match(/^ssh$/i)}.first['href']
38
+
39
+ #Set remote api URLs
40
+ @remote_api_url = File.join("https://#{@server}", 'rest', 'api', '1.0', 'projects', @project, 'repos', @repository_name)
41
+ @branch_permissions_url = File.join("https://#{@server}", 'rest', 'branch-permissions', '2.0', 'projects', @project, 'repos', @repository_name, 'restrictions')
42
+ @branchring_model_url = File.join("https://#{@server}", 'rest', 'branch-utils', '1.0', 'projects', @project, 'repos', @repository_name)
43
+ @pull_request_settings = File.join("https://#{@server}", 'rest', 'pullrequest-settings', '1.0', 'projects', @project, 'repos', @repository_name)
42
44
  end
43
45
 
44
46
  SETTINGS_HOOKS_URL = File.join('settings', 'hooks')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.30.0
4
+ version: 1.1.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warren Parad