tinybucket 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +32 -3
  3. data/Gemfile +5 -6
  4. data/lib/tinybucket/api/base_api.rb +28 -0
  5. data/lib/tinybucket/api/branch_restrictions_api.rb +2 -2
  6. data/lib/tinybucket/api/branches_api.rb +2 -2
  7. data/lib/tinybucket/api/build_status_api.rb +4 -4
  8. data/lib/tinybucket/api/comments_api.rb +2 -2
  9. data/lib/tinybucket/api/commits_api.rb +3 -3
  10. data/lib/tinybucket/api/helper/projects_helper.rb +2 -3
  11. data/lib/tinybucket/api/projects_api.rb +2 -2
  12. data/lib/tinybucket/api/pull_requests_api.rb +3 -3
  13. data/lib/tinybucket/api/repo_api.rb +3 -3
  14. data/lib/tinybucket/api/repos_api.rb +1 -1
  15. data/lib/tinybucket/api/team_api.rb +6 -6
  16. data/lib/tinybucket/api/user_api.rb +4 -4
  17. data/lib/tinybucket/connection.rb +2 -2
  18. data/lib/tinybucket/iterator.rb +1 -1
  19. data/lib/tinybucket/model/repository.rb +3 -1
  20. data/lib/tinybucket/parser.rb +2 -20
  21. data/lib/tinybucket/parser/collection_parser.rb +17 -0
  22. data/lib/tinybucket/parser/object_parser.rb +17 -0
  23. data/lib/tinybucket/request.rb +1 -1
  24. data/lib/tinybucket/version.rb +1 -1
  25. data/tinybucket.gemspec +2 -1
  26. metadata +5 -25
  27. data/lib/tinybucket/parser/base_parser.rb +0 -18
  28. data/lib/tinybucket/parser/branch_parser.rb +0 -13
  29. data/lib/tinybucket/parser/branch_restriction_parser.rb +0 -13
  30. data/lib/tinybucket/parser/branch_restrictions_parser.rb +0 -13
  31. data/lib/tinybucket/parser/branches_parser.rb +0 -11
  32. data/lib/tinybucket/parser/build_status_parser.rb +0 -11
  33. data/lib/tinybucket/parser/builds_parser.rb +0 -11
  34. data/lib/tinybucket/parser/comment_parser.rb +0 -11
  35. data/lib/tinybucket/parser/comments_parser.rb +0 -13
  36. data/lib/tinybucket/parser/commit_parser.rb +0 -11
  37. data/lib/tinybucket/parser/commits_parser.rb +0 -11
  38. data/lib/tinybucket/parser/profile_parser.rb +0 -11
  39. data/lib/tinybucket/parser/profiles_parser.rb +0 -11
  40. data/lib/tinybucket/parser/project_parser.rb +0 -11
  41. data/lib/tinybucket/parser/projects_parser.rb +0 -11
  42. data/lib/tinybucket/parser/pull_request_parser.rb +0 -11
  43. data/lib/tinybucket/parser/pull_requests_parser.rb +0 -13
  44. data/lib/tinybucket/parser/repo_parser.rb +0 -11
  45. data/lib/tinybucket/parser/repos_parser.rb +0 -13
  46. data/lib/tinybucket/parser/team_parser.rb +0 -11
  47. data/lib/tinybucket/parser/teams_parser.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f42b53730576e67f269f5aa243c527103ba436d
4
- data.tar.gz: b4698fa51271a601768478a9edbced27951565ef
3
+ metadata.gz: 0ef8e0d832790b9b2bda723c4a00de4124de5aff
4
+ data.tar.gz: 60b500ce7ca4ce398a26f9d82eaa7974a1bb23b0
5
5
  SHA512:
6
- metadata.gz: 8f2b3f55425472e949b21b6f1b299864fd2881cad2572c74e11a00f36eb1425b43015c3e59003a3c33ac1e4b6cfe18f339c1e1877c862d2ae1baeb482af216ef
7
- data.tar.gz: 6743cbf5df0c11df0bae18bda9168a3537ed684867f0918fedf8dec45a1aa6f565d96b49c36f93534396540d0da09cfe964dff36e849d7653906063902b32b4c
6
+ metadata.gz: 82b7ba303ea1b9ee30097ab0c95db11a17b3aed327d3ee45de3cb6b6a441c4701ae298a61f1de121582c1a76f9fca06ea840cfd5fa7e0256208e636b25a9783c
7
+ data.tar.gz: 4f4768d11b7f118522190e9a8202dd55d155bb749c88cc5ef8ba092473467411136dbc32ee12307cc92c0e56ca0ea9da7a15a93e565f6ef1ea9eac3af9e922f9
@@ -6,6 +6,10 @@ AllCops:
6
6
  - 'spec/**/*'
7
7
  - 'features/**/*'
8
8
  - 'test/**/*'
9
+ - 'Gemfile'
10
+ - 'Guardfile'
11
+ - 'Rakefile'
12
+ - '*.gemspec'
9
13
 
10
14
  Metrics/ClassLength:
11
15
  Max: 150
@@ -22,7 +26,7 @@ AndOr:
22
26
  ParenthesesAroundCondition:
23
27
  Enabled: false
24
28
 
25
- MethodCallParentheses:
29
+ Style/MethodCallWithoutArgsParentheses:
26
30
  Enabled: false
27
31
 
28
32
  # why use this option ?
@@ -38,7 +42,7 @@ CyclomaticComplexity:
38
42
  Next:
39
43
  Enabled: false
40
44
 
41
- Style/AlignHash:
45
+ Layout/AlignHash:
42
46
  Enabled: false
43
47
 
44
48
  Style/RaiseArgs:
@@ -53,5 +57,30 @@ Metrics/AbcSize:
53
57
  Metrics/LineLength:
54
58
  Max: 100
55
59
  IgnoredPatterns: [
56
- '^\s*#'
60
+ '^\s*#',
61
+ 'ruby wrapper for the Bitbucket REST API*'
57
62
  ]
63
+
64
+ Style/SymbolArray:
65
+ Enabled: false
66
+
67
+ Style/FormatStringToken:
68
+ Enabled: false
69
+
70
+ Style/RescueStandardError:
71
+ Enabled: false
72
+
73
+ Style/PercentLiteralDelimiters:
74
+ Enabled: false
75
+
76
+ Layout/SpaceAroundOperators:
77
+ Enabled: false
78
+
79
+ Layout/ExtraSpacing:
80
+ Enabled: false
81
+
82
+ Style/SafeNavigation:
83
+ Enabled: false
84
+
85
+ Lint/DuplicateMethods:
86
+ Enabled: false
data/Gemfile CHANGED
@@ -4,8 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'simple-auth', '~> 0.3.1'
7
- gem 'yard', '~> 0.8.7'
8
- gem 'yardstick', '~> 0.9'
7
+ gem 'yard', '~> 0.9.12'
8
+ gem 'yardstick', '~> 0.9.9'
9
9
 
10
10
  group :development, :test do
11
11
  gem 'pry'
@@ -23,11 +23,10 @@ group :development, :test do
23
23
  gem 'rspec', '~> 3.4'
24
24
  gem 'rspec-mocks', '~> 3.4'
25
25
  gem 'webmock', '~> 1.24'
26
- gem 'rubocop', '~> 0.46.0'
26
+ gem 'rubocop', '~> 0.52.1'
27
27
  end
28
28
 
29
29
  group :test do
30
- gem 'simplecov', '~> 0.11', require: false
31
- gem 'coveralls', '~> 0.8', require: false
32
- gem 'codeclimate-test-reporter', '~> 1.0.0', require: nil
30
+ gem 'simplecov', '~> 0.13.0', require: false
31
+ gem 'codeclimate-test-reporter', '~> 1.0.8', require: nil
33
32
  end
@@ -2,10 +2,38 @@
2
2
 
3
3
  module Tinybucket
4
4
  module Api
5
+ class Parser
6
+ attr_reader :type, :options
7
+
8
+ def initialize(type, model_class)
9
+ parser_class =
10
+ case type
11
+ when :collection then Tinybucket::Parser::CollectionParser
12
+ when :object then Tinybucket::Parser::ObjectParser
13
+ else throw "Unknown parser type: #{type}"
14
+ end
15
+
16
+ @type = parser_class
17
+ @options = { model_class: model_class }
18
+ end
19
+ end
20
+
5
21
  class BaseApi
6
22
  include Tinybucket::Connection
7
23
  include Tinybucket::Request
8
24
 
25
+ protected
26
+
27
+ #
28
+ # Get parser
29
+ #
30
+ # @param type [Symbol] :collection or :object
31
+ # @param model_class [Tinybucket::Model::Base] SubClass of Tinybucket::Model::Base
32
+ # @return [Hash]
33
+ def get_parser(type, model_class)
34
+ Tinybucket::Api::Parser.new(type, model_class)
35
+ end
36
+
9
37
  private
10
38
 
11
39
  def logger
@@ -27,7 +27,7 @@ module Tinybucket
27
27
  get_path(
28
28
  path_to_list,
29
29
  options,
30
- Tinybucket::Parser::BranchRestrictionsParser
30
+ get_parser(:collection, Tinybucket::Model::BranchRestriction)
31
31
  )
32
32
  end
33
33
 
@@ -43,7 +43,7 @@ module Tinybucket
43
43
  get_path(
44
44
  path_to_find(restriction_id),
45
45
  options,
46
- Tinybucket::Parser::BranchRestrictionParser
46
+ get_parser(:object, Tinybucket::Model::BranchRestriction)
47
47
  )
48
48
  end
49
49
  end
@@ -24,7 +24,7 @@ module Tinybucket
24
24
  get_path(
25
25
  path_to_list,
26
26
  options,
27
- Tinybucket::Parser::BranchesParser
27
+ get_parser(:collection, Tinybucket::Model::Branch)
28
28
  )
29
29
  end
30
30
 
@@ -40,7 +40,7 @@ module Tinybucket
40
40
  get_path(
41
41
  path_to_find(name),
42
42
  options,
43
- Tinybucket::Parser::BranchParser
43
+ get_parser(:object, Tinybucket::Model::Branch)
44
44
  )
45
45
  end
46
46
  end
@@ -19,7 +19,7 @@ module Tinybucket
19
19
  get_path(
20
20
  path_to_list,
21
21
  options,
22
- Tinybucket::Parser::BuildsParser
22
+ get_parser(:collection, Tinybucket::Model::BuildStatus)
23
23
  )
24
24
  end
25
25
 
@@ -33,7 +33,7 @@ module Tinybucket
33
33
  get_path(
34
34
  path_to_find(revision, key),
35
35
  options,
36
- Tinybucket::Parser::BuildStatusParser
36
+ get_parser(:object, Tinybucket::Model::BuildStatus)
37
37
  )
38
38
  end
39
39
 
@@ -47,7 +47,7 @@ module Tinybucket
47
47
  post_path(
48
48
  path_to_post(revision),
49
49
  options.merge(key: key),
50
- Tinybucket::Parser::BuildStatusParser
50
+ get_parser(:object, Tinybucket::Model::BuildStatus)
51
51
  )
52
52
  end
53
53
 
@@ -61,7 +61,7 @@ module Tinybucket
61
61
  put_path(
62
62
  path_to_put(revision, key),
63
63
  options,
64
- Tinybucket::Parser::BuildStatusParser
64
+ get_parser(:object, Tinybucket::Model::BuildStatus)
65
65
  )
66
66
  end
67
67
  end
@@ -33,7 +33,7 @@ module Tinybucket
33
33
  def list(options = {})
34
34
  list = get_path(path_to_list,
35
35
  options,
36
- Tinybucket::Parser::CommentsParser)
36
+ get_parser(:collection, Tinybucket::Model::Comment))
37
37
 
38
38
  associate_with_target(list)
39
39
  list
@@ -56,7 +56,7 @@ module Tinybucket
56
56
  def find(comment_id, options = {})
57
57
  comment = get_path(path_to_find(comment_id),
58
58
  options,
59
- Tinybucket::Parser::CommentParser)
59
+ get_parser(:object, Tinybucket::Model::Comment))
60
60
 
61
61
  associate_with_target(comment)
62
62
  comment
@@ -27,7 +27,7 @@ module Tinybucket
27
27
  get_path(
28
28
  path_to_list,
29
29
  options,
30
- Tinybucket::Parser::CommitsParser
30
+ get_parser(:collection, Tinybucket::Model::Commit)
31
31
  )
32
32
  end
33
33
 
@@ -43,7 +43,7 @@ module Tinybucket
43
43
  get_path(
44
44
  path_to_find(revision),
45
45
  options,
46
- Tinybucket::Parser::CommitParser
46
+ get_parser(:object, Tinybucket::Model::Commit)
47
47
  )
48
48
  end
49
49
 
@@ -89,7 +89,7 @@ module Tinybucket
89
89
  get_path(
90
90
  path_to_branch(name),
91
91
  options,
92
- Tinybucket::Parser::CommitsParser
92
+ get_parser(:collection, Tinybucket::Model::Commit)
93
93
  )
94
94
  end
95
95
  end
@@ -9,7 +9,7 @@ module Tinybucket
9
9
  private
10
10
 
11
11
  def path_to_list(owner)
12
- base_path(owner)
12
+ build_path(base_path(owner), '/')
13
13
  end
14
14
 
15
15
  def path_to_find(owner, project_key)
@@ -20,8 +20,7 @@ module Tinybucket
20
20
  def base_path(owner)
21
21
  build_path('/teams',
22
22
  [owner, 'owner'],
23
- 'projects',
24
- '/')
23
+ 'projects')
25
24
  end
26
25
  end
27
26
  end
@@ -10,7 +10,7 @@ module Tinybucket
10
10
  get_path(
11
11
  path_to_list(owner),
12
12
  options,
13
- Tinybucket::Parser::ProjectsParser
13
+ get_parser(:collection, Tinybucket::Model::Project)
14
14
  )
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ module Tinybucket
18
18
  get_path(
19
19
  path_to_find(owner, project_key),
20
20
  options,
21
- Tinybucket::Parser::ProjectParser
21
+ get_parser(:object, Tinybucket::Model::Project)
22
22
  )
23
23
  end
24
24
  end
@@ -24,7 +24,7 @@ module Tinybucket
24
24
  get_path(
25
25
  path_to_list,
26
26
  options,
27
- Tinybucket::Parser::PullRequestsParser
27
+ get_parser(:collection, Tinybucket::Model::PullRequest)
28
28
  )
29
29
  end
30
30
 
@@ -37,7 +37,7 @@ module Tinybucket
37
37
  get_path(
38
38
  path_to_find(pr_id),
39
39
  options,
40
- Tinybucket::Parser::PullRequestParser
40
+ get_parser(:object, Tinybucket::Model::PullRequest)
41
41
  )
42
42
  end
43
43
 
@@ -50,7 +50,7 @@ module Tinybucket
50
50
  get_path(
51
51
  path_to_commits(pr_id),
52
52
  options,
53
- Tinybucket::Parser::CommitsParser
53
+ get_parser(:collection, Tinybucket::Model::Commit)
54
54
  )
55
55
  end
56
56
 
@@ -24,7 +24,7 @@ module Tinybucket
24
24
  get_path(
25
25
  path_to_find,
26
26
  options,
27
- Tinybucket::Parser::RepoParser
27
+ get_parser(:object, Tinybucket::Model::Repository)
28
28
  )
29
29
  end
30
30
 
@@ -36,7 +36,7 @@ module Tinybucket
36
36
  get_path(
37
37
  path_to_watchers,
38
38
  options,
39
- Tinybucket::Parser::ProfilesParser
39
+ get_parser(:collection, Tinybucket::Model::Profile)
40
40
  )
41
41
  end
42
42
 
@@ -48,7 +48,7 @@ module Tinybucket
48
48
  get_path(
49
49
  path_to_forks,
50
50
  options,
51
- Tinybucket::Parser::ReposParser
51
+ get_parser(:collection, Tinybucket::Model::Repository)
52
52
  )
53
53
  end
54
54
  end
@@ -20,7 +20,7 @@ module Tinybucket
20
20
  get_path(
21
21
  path_to_list(options),
22
22
  opts,
23
- Tinybucket::Parser::ReposParser
23
+ get_parser(:collection, Tinybucket::Model::Repository)
24
24
  )
25
25
  end
26
26
  end
@@ -18,7 +18,7 @@ module Tinybucket
18
18
  get_path(
19
19
  path_to_list,
20
20
  { role: role_name }.merge(options),
21
- Tinybucket::Parser::TeamsParser
21
+ get_parser(:collection, Tinybucket::Model::Team)
22
22
  )
23
23
  end
24
24
 
@@ -31,7 +31,7 @@ module Tinybucket
31
31
  get_path(
32
32
  path_to_find(name),
33
33
  options,
34
- Tinybucket::Parser::TeamParser
34
+ get_parser(:object, Tinybucket::Model::Team)
35
35
  )
36
36
  end
37
37
 
@@ -44,7 +44,7 @@ module Tinybucket
44
44
  get_path(
45
45
  path_to_members(name),
46
46
  options,
47
- Tinybucket::Parser::TeamsParser
47
+ get_parser(:collection, Tinybucket::Model::Team)
48
48
  )
49
49
  end
50
50
 
@@ -57,7 +57,7 @@ module Tinybucket
57
57
  get_path(
58
58
  path_to_followers(name),
59
59
  options,
60
- Tinybucket::Parser::TeamsParser
60
+ get_parser(:collection, Tinybucket::Model::Team)
61
61
  )
62
62
  end
63
63
 
@@ -70,7 +70,7 @@ module Tinybucket
70
70
  get_path(
71
71
  path_to_following(name),
72
72
  options,
73
- Tinybucket::Parser::TeamsParser
73
+ get_parser(:collection, Tinybucket::Model::Team)
74
74
  )
75
75
  end
76
76
 
@@ -83,7 +83,7 @@ module Tinybucket
83
83
  get_path(
84
84
  path_to_repos(name),
85
85
  options,
86
- Tinybucket::Parser::ReposParser
86
+ get_parser(:collection, Tinybucket::Model::Repository)
87
87
  )
88
88
  end
89
89
  end
@@ -22,7 +22,7 @@ module Tinybucket
22
22
  get_path(
23
23
  path_to_find,
24
24
  options,
25
- Tinybucket::Parser::ProfileParser
25
+ get_parser(:object, Tinybucket::Model::Profile)
26
26
  )
27
27
  end
28
28
 
@@ -34,7 +34,7 @@ module Tinybucket
34
34
  get_path(
35
35
  path_to_followers,
36
36
  options,
37
- Tinybucket::Parser::ProfilesParser
37
+ get_parser(:collection, Tinybucket::Model::Profile)
38
38
  )
39
39
  end
40
40
 
@@ -46,7 +46,7 @@ module Tinybucket
46
46
  get_path(
47
47
  path_to_following,
48
48
  options,
49
- Tinybucket::Parser::ProfilesParser
49
+ get_parser(:collection, Tinybucket::Model::Profile)
50
50
  )
51
51
  end
52
52
 
@@ -58,7 +58,7 @@ module Tinybucket
58
58
  get_path(
59
59
  path_to_repos,
60
60
  options,
61
- Tinybucket::Parser::ReposParser
61
+ get_parser(:collection, Tinybucket::Model::Repository)
62
62
  )
63
63
  end
64
64
  end
@@ -12,7 +12,7 @@ module Tinybucket
12
12
  !@connection.nil?
13
13
  end
14
14
 
15
- def connection(options = {}, parser = nil)
15
+ def connection(parser = nil, options = {})
16
16
  conn_options = default_options(options)
17
17
  clear_cache
18
18
 
@@ -76,7 +76,7 @@ module Tinybucket
76
76
 
77
77
  # TODO: cache stack for each (options, parser) pairs
78
78
  Faraday::RackBuilder.new do |conn|
79
- conn.use parser if parser.present?
79
+ conn.use parser.type, parser_options: parser.options if parser.present?
80
80
  default_middleware(options).call(conn)
81
81
  end
82
82
  end
@@ -69,7 +69,7 @@ module Tinybucket
69
69
  {}
70
70
  else
71
71
  query = URI.parse(@attrs[:next]).query
72
- Hash[*query.split(/&|=/).map { |v| URI.unescape(v) }]
72
+ Hash[*query.split(/&|=/).map { |v| CGI.unescape(v) }]
73
73
  end
74
74
 
75
75
  @args[-1].merge!(params)
@@ -43,6 +43,8 @@ module Tinybucket
43
43
  # @return [String]
44
44
  # @!attribute [rw] type
45
45
  # @return [String]
46
+ # @!attribute [rw] project
47
+ # @return [Hash]
46
48
  class Repository < Base
47
49
  include Tinybucket::Model::Concerns::RepositoryKeys
48
50
 
@@ -50,7 +52,7 @@ module Tinybucket
50
52
  :scm, :has_wiki, :description, :links, :updated_on,
51
53
  :fork_policy, :created_on, :owner, :size, :parent, :uuid,
52
54
  :has_issues, :is_private, :full_name, :name, :language,
53
- :website, :type
55
+ :website, :type, :project
54
56
 
55
57
  def initialize(json)
56
58
  super(json)
@@ -6,26 +6,8 @@ module Tinybucket
6
6
 
7
7
  [
8
8
  :BaseParser,
9
- :BranchParser,
10
- :BranchesParser,
11
- :BranchRestrictionParser,
12
- :BranchRestrictionsParser,
13
- :BuildStatusParser,
14
- :BuildsParser,
15
- :CommitParser,
16
- :CommitsParser,
17
- :CommentParser,
18
- :CommentsParser,
19
- :ProfileParser,
20
- :ProfilesParser,
21
- :ProjectParser,
22
- :ProjectsParser,
23
- :PullRequestParser,
24
- :PullRequestsParser,
25
- :RepoParser,
26
- :ReposParser,
27
- :TeamParser,
28
- :TeamsParser
9
+ :ObjectParser,
10
+ :CollectionParser
29
11
  ].each do |klass_name|
30
12
  autoload klass_name
31
13
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tinybucket
4
+ module Parser
5
+ class CollectionParser < FaradayMiddleware::ResponseMiddleware
6
+ define_parser do |hash, parser_options|
7
+ cls = parser_options[:model_class]
8
+ throw 'model_class option does not provided' unless cls
9
+ ::Tinybucket::Model::Page.new(hash, cls)
10
+ end
11
+
12
+ def parse_response?(env)
13
+ env[:body].is_a? Hash
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tinybucket
4
+ module Parser
5
+ class ObjectParser < FaradayMiddleware::ResponseMiddleware
6
+ define_parser do |hash, parser_options|
7
+ cls = parser_options[:model_class]
8
+ throw 'model_class option does not provided' unless cls
9
+ cls.new(hash)
10
+ end
11
+
12
+ def parse_response?(env)
13
+ env[:body].is_a? Hash
14
+ end
15
+ end
16
+ end
17
+ end
@@ -27,7 +27,7 @@ module Tinybucket
27
27
  private
28
28
 
29
29
  def request(method, path, params, parser, options)
30
- conn = connection(options, parser)
30
+ conn = connection(parser, options)
31
31
 
32
32
  path = (conn.path_prefix + path).gsub(%r{//}, '/') \
33
33
  if conn.path_prefix != '/'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tinybucket
4
- VERSION = '1.5.1'.freeze
4
+ VERSION = '1.6.0'.freeze
5
5
  end
@@ -1,4 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'tinybucket/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinybucket
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hirakiuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2018-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -184,27 +184,8 @@ files:
184
184
  - lib/tinybucket/model/team.rb
185
185
  - lib/tinybucket/null_logger.rb
186
186
  - lib/tinybucket/parser.rb
187
- - lib/tinybucket/parser/base_parser.rb
188
- - lib/tinybucket/parser/branch_parser.rb
189
- - lib/tinybucket/parser/branch_restriction_parser.rb
190
- - lib/tinybucket/parser/branch_restrictions_parser.rb
191
- - lib/tinybucket/parser/branches_parser.rb
192
- - lib/tinybucket/parser/build_status_parser.rb
193
- - lib/tinybucket/parser/builds_parser.rb
194
- - lib/tinybucket/parser/comment_parser.rb
195
- - lib/tinybucket/parser/comments_parser.rb
196
- - lib/tinybucket/parser/commit_parser.rb
197
- - lib/tinybucket/parser/commits_parser.rb
198
- - lib/tinybucket/parser/profile_parser.rb
199
- - lib/tinybucket/parser/profiles_parser.rb
200
- - lib/tinybucket/parser/project_parser.rb
201
- - lib/tinybucket/parser/projects_parser.rb
202
- - lib/tinybucket/parser/pull_request_parser.rb
203
- - lib/tinybucket/parser/pull_requests_parser.rb
204
- - lib/tinybucket/parser/repo_parser.rb
205
- - lib/tinybucket/parser/repos_parser.rb
206
- - lib/tinybucket/parser/team_parser.rb
207
- - lib/tinybucket/parser/teams_parser.rb
187
+ - lib/tinybucket/parser/collection_parser.rb
188
+ - lib/tinybucket/parser/object_parser.rb
208
189
  - lib/tinybucket/request.rb
209
190
  - lib/tinybucket/resource.rb
210
191
  - lib/tinybucket/resource/base.rb
@@ -256,9 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
237
  version: '0'
257
238
  requirements: []
258
239
  rubyforge_project:
259
- rubygems_version: 2.6.10
240
+ rubygems_version: 2.6.11
260
241
  signing_key:
261
242
  specification_version: 4
262
243
  summary: ruby wrapper for the Bitbucket REST API (v2) with oauth
263
244
  test_files: []
264
- has_rdoc:
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BaseParser < FaradayMiddleware::ResponseMiddleware
6
- def process_response(env)
7
- env[:body] = convert(env[:body])
8
- end
9
-
10
- def parse_response?(env)
11
- (env[:body]).is_a?(Hash)
12
- end
13
-
14
- # override on subclass
15
- def convert(_json); end
16
- end
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BranchParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Branch.new(
8
- json
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BranchRestrictionParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::BranchRestriction.new(
8
- json
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BranchRestrictionsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(
8
- json, Tinybucket::Model::BranchRestriction
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BranchesParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::Branch)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BuildStatusParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::BuildStatus.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class BuildsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::BuildStatus)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class CommentParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Comment.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class CommentsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(
8
- json, Tinybucket::Model::Comment
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class CommitParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Commit.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class CommitsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::Commit)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class ProfileParser < BaseParser
6
- def convert(json)
7
- ::Tinybucket::Model::Profile.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class ProfilesParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::Profile)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class ProjectParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Project.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class ProjectsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::Project)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class PullRequestParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::PullRequest.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class PullRequestsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(
8
- json, Tinybucket::Model::PullRequest
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class RepoParser < BaseParser
6
- def convert(json)
7
- ::Tinybucket::Model::Repository.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class ReposParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(
8
- json, Tinybucket::Model::Repository
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class TeamParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Team.new(json)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Tinybucket
4
- module Parser
5
- class TeamsParser < BaseParser
6
- def convert(json)
7
- Tinybucket::Model::Page.new(json, Tinybucket::Model::Team)
8
- end
9
- end
10
- end
11
- end