universal-git-client 1.2.4 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b4c37347ad2d272fb542744b0f095e9901b45d5a422eb0ef13eba7144377a2a
4
- data.tar.gz: a6e42628553bbe0674131e8d90f270e2e91d52aa8048dd7a374abd2d368df3a4
3
+ metadata.gz: d586b92fbf25a887fd3d22be2102eeb6cd43707e43210259dd29b01f5ee83f91
4
+ data.tar.gz: 1e63b3f3ec9d2eab5cbb089ec8d95264413bc467ca9e9e9a382bcc5fdabe7028
5
5
  SHA512:
6
- metadata.gz: 45d3c7fde797319a54f5b05e79b9993ce17ebb3305ee6145f898c70e375edd9952b302e7efacdecf27befa97ce2712e8af1a2cc0eaf596efab43cc2e2d698d01
7
- data.tar.gz: 461a1270d635a7a15a96a3912313d8377220c1e58cc4879d4afd2ef48a4a22cf6232eea81e511ac06aecb2de8a3d1dbb447bbe755384f1fab66c88e8eab53d44
6
+ metadata.gz: ca113697918244cb981c8e4ea760233a74f5d2a9a027b56cc8f639bc297709f84ee77439911e6db11600043880253d638728a1ab8566a01e6b8fbb6a216a0b75
7
+ data.tar.gz: 3842d99fbbb97fa1f42e849b8def3c0d0313f21a1ecc2e8bec1699447f004145b4dd83441a8280759702d94ed4978dfe406a0e4aede4862c36d7adb1000bd306
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.2.9
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'universal-git-client/normalizers/github'
2
4
  require 'universal-git-client/normalizers/gitlab'
3
5
  require 'universal-git-client/normalizers/bitbucket'
4
6
  require 'universal-git-client/normalizers/bitbucket_server'
5
7
 
6
-
7
8
  module UniversalGitClient
8
9
  class Client
9
10
  attr_reader :provider, :http_client
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'universal-git-client/http/response_validation'
2
4
  require 'httparty'
3
5
  require 'down'
@@ -62,7 +64,11 @@ module UniversalGitClient
62
64
 
63
65
  def down_default_options
64
66
  options = default_options[:headers].reject { |k, _v| %w[Accept Content-Type].include?(k) }
65
- options.reject { |k, _v| [:base_uri, :logger, :log_level, :log_format].include?(k) }
67
+ options.reject { |k, _v| %i[base_uri logger log_level log_format].include?(k) }
68
+ # By default Down allows 2 redirections before raising.
69
+ # We're cranking this up as Bitbucket seems to do more redirects
70
+ # when a project has moved.
71
+ options.merge(max_redirects: 5)
66
72
  end
67
73
  end
68
74
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'universal-git-client/http/base'
2
4
  require 'uri'
3
5
 
@@ -13,28 +15,28 @@ module UniversalGitClient
13
15
  def organizations(page: 1, per_page: nil)
14
16
  with_response_validation! do
15
17
  self.class.get(
16
- '/teams',
18
+ '/workspaces',
17
19
  default_options.merge(
18
20
  query: {
19
- role: 'member',
20
21
  page: page,
21
22
  pagelen: per_page || default_elements_per_page,
22
- },
23
+ q: %(uuid!="#{user['uuid']}")
24
+ }
23
25
  )
24
26
  )
25
27
  end
26
28
  end
27
29
 
28
30
  def user_repos(page: 1, per_page: nil)
29
- current_user_uuid = URI.encode_www_form_component(self.user['uuid'])
31
+ current_user_uuid = URI.encode_www_form_component(user['uuid'])
30
32
  with_response_validation! do
31
33
  self.class.get(
32
34
  "/repositories/#{current_user_uuid}",
33
35
  default_options.merge(
34
36
  query: {
35
37
  page: page,
36
- pagelen: per_page || default_elements_per_page,
37
- },
38
+ pagelen: per_page || default_elements_per_page
39
+ }
38
40
  )
39
41
  )
40
42
  end
@@ -47,8 +49,8 @@ module UniversalGitClient
47
49
  default_options.merge(
48
50
  query: {
49
51
  page: page,
50
- pagelen: per_page || default_elements_per_page,
51
- },
52
+ pagelen: per_page || default_elements_per_page
53
+ }
52
54
  )
53
55
  )
54
56
  end
@@ -67,17 +69,18 @@ module UniversalGitClient
67
69
  default_options.merge(
68
70
  query: {
69
71
  page: page,
70
- pagelen: per_page || default_elements_per_page,
71
- },
72
+ pagelen: per_page || default_elements_per_page
73
+ }
72
74
  )
73
75
  )
74
76
  end
75
77
  end
76
78
 
77
79
  def branch(owner:, repo:, branch:)
80
+ encoded_branch = URI.encode_www_form_component(branch)
78
81
  with_response_validation! do
79
82
  self.class.get(
80
- "/repositories/#{owner}/#{repo}/refs/branches/#{branch}",
83
+ "/repositories/#{owner}/#{repo}/refs/branches/#{encoded_branch}",
81
84
  default_options
82
85
  )
83
86
  end
@@ -97,9 +100,9 @@ module UniversalGitClient
97
100
  url: webhook_secret ? "#{webhook_url}?secret=#{webhook_secret}" : webhook_url,
98
101
  active: true,
99
102
  events: [
100
- 'repo:push',
101
- ],
102
- }.to_json,
103
+ 'repo:push'
104
+ ]
105
+ }.to_json
103
106
  )
104
107
  )
105
108
  end
@@ -74,9 +74,10 @@ module UniversalGitClient
74
74
  end
75
75
 
76
76
  def branch(owner:, repo:, branch:)
77
+ encoded_branch = URI.encode_www_form_component(branch)
77
78
  with_response_validation! do
78
79
  self.class.get(
79
- "/repos/#{owner}/#{repo}/branches/#{branch}",
80
+ "/repos/#{owner}/#{repo}/branches/#{encoded_branch}",
80
81
  default_options
81
82
  )
82
83
  end
@@ -78,9 +78,10 @@ module UniversalGitClient
78
78
 
79
79
  def branch(owner:, repo:, branch:)
80
80
  encoded_namespace = encode_namespace(owner, repo)
81
+ encoded_branch = URI.encode_www_form_component(branch)
81
82
  with_response_validation! do
82
83
  self.class.get(
83
- "/projects/#{encoded_namespace}/repository/branches/#{branch}",
84
+ "/projects/#{encoded_namespace}/repository/branches/#{encoded_branch}",
84
85
  default_options
85
86
  )
86
87
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'universal-git-client/errors'
2
4
 
3
5
  module UniversalGitClient
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'fast_jsonapi'
3
5
  require 'deep_merge'
@@ -49,9 +51,9 @@ module UniversalGitClient
49
51
  prev: prev_page_index,
50
52
  next: next_page_index,
51
53
  last: last_page_index,
52
- per_page: per_page_index,
53
- },
54
- },
54
+ per_page: per_page_index
55
+ }
56
+ }
55
57
  }
56
58
  end
57
59
 
@@ -86,7 +88,7 @@ module UniversalGitClient
86
88
  private
87
89
 
88
90
  def fetch_rel_value(rel)
89
- Hash[URI::decode_www_form(links.by_rel(rel).target.query)]['page']
91
+ Hash[URI.decode_www_form(links.by_rel(rel).target.query)]['page']
90
92
  rescue StandardError
91
93
  nil
92
94
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'universal-git-client/normalizers/base'
2
4
 
3
5
  module UniversalGitClient
@@ -29,7 +31,7 @@ module UniversalGitClient
29
31
 
30
32
  def get_page_index(rel)
31
33
  Hash[
32
- URI::decode_www_form(
34
+ URI.decode_www_form(
33
35
  URI.parse(response[rel]).query
34
36
  )
35
37
  ]['page']
@@ -49,7 +51,7 @@ module UniversalGitClient
49
51
 
50
52
  class OrganizationSerializer < BaseSerializer
51
53
  set_id :uuid
52
- attribute :login, &:username
54
+ attribute :login, &:slug
53
55
 
54
56
  attribute :avatar_url do |object|
55
57
  object.links.avatar.href
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universal-git-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - HipTest
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-30 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -298,7 +298,7 @@ homepage: https://github.com/SmartBear/universal-git-client
298
298
  licenses:
299
299
  - MIT
300
300
  metadata: {}
301
- post_install_message:
301
+ post_install_message:
302
302
  rdoc_options: []
303
303
  require_paths:
304
304
  - lib
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  version: '0'
315
315
  requirements: []
316
316
  rubygems_version: 3.0.3
317
- signing_key:
317
+ signing_key:
318
318
  specification_version: 4
319
319
  summary: Use this gem to normalize git providers api responses
320
320
  test_files: []