github_api 0.17.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/github_api.rb +38 -76
- data/lib/github_api/api.rb +35 -18
- data/lib/github_api/api/arguments.rb +5 -0
- data/lib/github_api/api/config.rb +2 -4
- data/lib/github_api/api/config/property_set.rb +1 -0
- data/lib/github_api/authorization.rb +2 -0
- data/lib/github_api/client.rb +2 -0
- data/lib/github_api/client/activity.rb +2 -0
- data/lib/github_api/client/activity/events.rb +2 -0
- data/lib/github_api/client/activity/feeds.rb +2 -0
- data/lib/github_api/client/activity/notifications.rb +2 -0
- data/lib/github_api/client/activity/starring.rb +2 -0
- data/lib/github_api/client/activity/watching.rb +2 -0
- data/lib/github_api/client/authorizations.rb +2 -0
- data/lib/github_api/client/authorizations/app.rb +3 -1
- data/lib/github_api/client/emojis.rb +2 -0
- data/lib/github_api/client/gists.rb +2 -0
- data/lib/github_api/client/gists/comments.rb +2 -0
- data/lib/github_api/client/git_data.rb +2 -0
- data/lib/github_api/client/git_data/blobs.rb +2 -1
- data/lib/github_api/client/git_data/commits.rb +2 -0
- data/lib/github_api/client/git_data/references.rb +2 -0
- data/lib/github_api/client/git_data/tags.rb +2 -0
- data/lib/github_api/client/git_data/trees.rb +2 -0
- data/lib/github_api/client/gitignore.rb +2 -0
- data/lib/github_api/client/issues.rb +2 -0
- data/lib/github_api/client/issues/assignees.rb +35 -0
- data/lib/github_api/client/issues/comments.rb +2 -0
- data/lib/github_api/client/issues/events.rb +2 -0
- data/lib/github_api/client/issues/labels.rb +2 -0
- data/lib/github_api/client/issues/milestones.rb +2 -0
- data/lib/github_api/client/markdown.rb +3 -1
- data/lib/github_api/client/meta.rb +2 -0
- data/lib/github_api/client/orgs.rb +2 -0
- data/lib/github_api/client/orgs/hooks.rb +2 -0
- data/lib/github_api/client/orgs/members.rb +2 -0
- data/lib/github_api/client/orgs/memberships.rb +2 -0
- data/lib/github_api/client/orgs/projects.rb +2 -0
- data/lib/github_api/client/orgs/teams.rb +2 -0
- data/lib/github_api/client/projects.rb +2 -0
- data/lib/github_api/client/projects/cards.rb +3 -1
- data/lib/github_api/client/projects/columns.rb +2 -0
- data/lib/github_api/client/pull_requests.rb +2 -0
- data/lib/github_api/client/pull_requests/comments.rb +2 -0
- data/lib/github_api/client/pull_requests/reviews.rb +2 -0
- data/lib/github_api/client/repos.rb +17 -13
- data/lib/github_api/client/repos/branches.rb +48 -0
- data/lib/github_api/client/repos/branches/protections.rb +75 -0
- data/lib/github_api/client/repos/collaborators.rb +2 -1
- data/lib/github_api/client/repos/comments.rb +2 -0
- data/lib/github_api/client/repos/commits.rb +2 -0
- data/lib/github_api/client/repos/contents.rb +2 -0
- data/lib/github_api/client/repos/deployments.rb +2 -0
- data/lib/github_api/client/repos/downloads.rb +2 -0
- data/lib/github_api/client/repos/forks.rb +2 -0
- data/lib/github_api/client/repos/hooks.rb +2 -0
- data/lib/github_api/client/repos/keys.rb +2 -0
- data/lib/github_api/client/repos/merging.rb +2 -0
- data/lib/github_api/client/repos/pages.rb +2 -0
- data/lib/github_api/client/repos/projects.rb +4 -2
- data/lib/github_api/client/repos/pub_sub_hubbub.rb +2 -0
- data/lib/github_api/client/repos/releases.rb +2 -0
- data/lib/github_api/client/repos/releases/assets.rb +3 -1
- data/lib/github_api/client/repos/releases/tags.rb +2 -0
- data/lib/github_api/client/repos/statistics.rb +2 -0
- data/lib/github_api/client/repos/statuses.rb +2 -0
- data/lib/github_api/client/say.rb +2 -0
- data/lib/github_api/client/scopes.rb +2 -0
- data/lib/github_api/client/search.rb +3 -0
- data/lib/github_api/client/search/legacy.rb +2 -0
- data/lib/github_api/client/users.rb +2 -0
- data/lib/github_api/client/users/emails.rb +3 -0
- data/lib/github_api/client/users/followers.rb +2 -0
- data/lib/github_api/client/users/keys.rb +2 -0
- data/lib/github_api/configuration.rb +2 -1
- data/lib/github_api/connection.rb +4 -0
- data/lib/github_api/error.rb +1 -4
- data/lib/github_api/error/client_error.rb +2 -0
- data/lib/github_api/error/service_error.rb +2 -0
- data/lib/github_api/ext/faraday.rb +1 -1
- data/lib/github_api/middleware.rb +7 -7
- data/lib/github_api/page_iterator.rb +4 -1
- data/lib/github_api/page_links.rb +4 -0
- data/lib/github_api/paged_request.rb +2 -0
- data/lib/github_api/pagination.rb +4 -1
- data/lib/github_api/parameter_filter.rb +4 -1
- data/lib/github_api/params_hash.rb +3 -0
- data/lib/github_api/request.rb +5 -5
- data/lib/github_api/request/jsonize.rb +0 -1
- data/lib/github_api/request/oauth2.rb +2 -0
- data/lib/github_api/request/verbs.rb +3 -0
- data/lib/github_api/response/header.rb +2 -0
- data/lib/github_api/response/raise_error.rb +2 -1
- data/lib/github_api/response_wrapper.rb +5 -0
- data/lib/github_api/utils/url.rb +2 -0
- data/lib/github_api/validations.rb +5 -8
- data/lib/github_api/validations/format.rb +2 -0
- data/lib/github_api/validations/presence.rb +2 -0
- data/lib/github_api/validations/required.rb +2 -0
- data/lib/github_api/version.rb +1 -1
- metadata +9 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11a8e6228c2919e3c6de1b8242da1ef610216b34
|
4
|
+
data.tar.gz: 0b7aa20dd2b819fb821a5610becad83c2a965dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c95237edd052e4baa7992814412a54e42160c9b72537b5205847ea957cb96abac0177f4c897e8968b4cb32393422ab39732d18277bc00d41f9af46ce4d2b7625
|
7
|
+
data.tar.gz: b8833f282be713c2c271035b4a6090aeee1e346062f944dab6611084a0db05831f7ab7d0e4351ef9ee03e7fb6d2352c3bb2b550f99ce87e59b2c37e463b62009
|
data/lib/github_api.rb
CHANGED
@@ -1,16 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'pp' if ENV['DEBUG']
|
4
|
+
|
4
5
|
require 'faraday'
|
5
|
-
|
6
|
-
require 'github_api/configuration'
|
7
|
-
require 'github_api/constants'
|
8
|
-
require 'github_api/utils/url'
|
9
|
-
require 'github_api/connection'
|
10
|
-
require 'github_api/deprecation'
|
11
|
-
require 'github_api/core_ext/ordered_hash'
|
12
|
-
require 'github_api/ext/faraday'
|
13
|
-
require 'github_api/middleware'
|
6
|
+
require_relative 'github_api/ext/faraday'
|
14
7
|
|
15
8
|
module Github
|
16
9
|
LIBNAME = 'github_api'
|
@@ -18,8 +11,32 @@ module Github
|
|
18
11
|
LIBDIR = File.expand_path("../#{LIBNAME}", __FILE__)
|
19
12
|
|
20
13
|
class << self
|
21
|
-
|
22
|
-
|
14
|
+
# The client configuration
|
15
|
+
#
|
16
|
+
# @return [Configuration]
|
17
|
+
#
|
18
|
+
# @api public
|
19
|
+
def configuration
|
20
|
+
@configuration ||= Configuration.new
|
21
|
+
end
|
22
|
+
alias_method :config, :configuration
|
23
|
+
|
24
|
+
# Configure options
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Github.configure do |c|
|
28
|
+
# c.some_option = true
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# @yield the configuration block
|
32
|
+
# @yieldparam configuration [Github::Configuration]
|
33
|
+
# the configuration instance
|
34
|
+
#
|
35
|
+
# @return [nil]
|
36
|
+
#
|
37
|
+
# @api public
|
38
|
+
def configure
|
39
|
+
yield configuration
|
23
40
|
end
|
24
41
|
|
25
42
|
# Alias for Github::Client.new
|
@@ -63,69 +80,14 @@ module Github
|
|
63
80
|
super(method_name, include_private)
|
64
81
|
end
|
65
82
|
end
|
66
|
-
|
67
|
-
module ClassMethods
|
68
|
-
# Requires internal libraries
|
69
|
-
#
|
70
|
-
# @param [String] prefix
|
71
|
-
# the relative path prefix
|
72
|
-
# @param [Array[String]] libs
|
73
|
-
# the array of libraries to require
|
74
|
-
#
|
75
|
-
# @return [self]
|
76
|
-
def require_all(prefix, *libs)
|
77
|
-
libs.each do |lib|
|
78
|
-
require "#{File.join(prefix, lib)}"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# The client configuration
|
83
|
-
#
|
84
|
-
# @return [Configuration]
|
85
|
-
#
|
86
|
-
# @api public
|
87
|
-
def configuration
|
88
|
-
@configuration ||= Configuration.new
|
89
|
-
end
|
90
|
-
alias_method :config, :configuration
|
91
|
-
|
92
|
-
# Configure options
|
93
|
-
#
|
94
|
-
# @example
|
95
|
-
# Github.configure do |c|
|
96
|
-
# c.some_option = true
|
97
|
-
# end
|
98
|
-
#
|
99
|
-
# @yield the configuration block
|
100
|
-
# @yieldparam configuration [Github::Configuration]
|
101
|
-
# the configuration instance
|
102
|
-
#
|
103
|
-
# @return [nil]
|
104
|
-
#
|
105
|
-
# @api public
|
106
|
-
def configure
|
107
|
-
yield configuration
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
extend ClassMethods
|
112
|
-
|
113
|
-
require_all LIBDIR,
|
114
|
-
'authorization',
|
115
|
-
'validations',
|
116
|
-
'normalizer',
|
117
|
-
'parameter_filter',
|
118
|
-
'api',
|
119
|
-
'client',
|
120
|
-
'pagination',
|
121
|
-
'request',
|
122
|
-
'response',
|
123
|
-
'response_wrapper',
|
124
|
-
'error',
|
125
|
-
'mime_type',
|
126
|
-
'page_links',
|
127
|
-
'paged_request',
|
128
|
-
'page_iterator',
|
129
|
-
'params_hash'
|
130
|
-
|
131
83
|
end # Github
|
84
|
+
|
85
|
+
require_relative 'github_api/api'
|
86
|
+
require_relative 'github_api/client'
|
87
|
+
require_relative 'github_api/configuration'
|
88
|
+
require_relative 'github_api/deprecation'
|
89
|
+
require_relative 'github_api/core_ext/array'
|
90
|
+
require_relative 'github_api/core_ext/hash'
|
91
|
+
require_relative 'github_api/core_ext/ordered_hash'
|
92
|
+
require_relative 'github_api/middleware'
|
93
|
+
require_relative 'github_api/version'
|
data/lib/github_api/api.rb
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require 'github_api/api/arguments'
|
3
|
+
require_relative 'authorization'
|
4
|
+
require_relative 'api/actions'
|
5
|
+
require_relative 'api/factory'
|
6
|
+
require_relative 'api/arguments'
|
7
|
+
require_relative 'configuration'
|
8
|
+
require_relative 'constants'
|
9
|
+
require_relative 'mime_type'
|
10
|
+
require_relative 'null_encoder'
|
11
|
+
require_relative 'rate_limit'
|
12
|
+
require_relative 'request/verbs'
|
13
|
+
require_relative 'validations'
|
15
14
|
|
16
15
|
module Github
|
17
16
|
# Core class responsible for api interface operations
|
18
17
|
class API
|
19
|
-
extend Github::ClassMethods
|
20
|
-
|
21
18
|
include Constants
|
22
19
|
include Authorization
|
23
20
|
include MimeType
|
24
|
-
include Request::Verbs
|
25
21
|
include RateLimit
|
22
|
+
include Request::Verbs
|
26
23
|
|
27
|
-
attr_reader
|
24
|
+
attr_reader(*Github.configuration.property_names)
|
28
25
|
|
29
|
-
attr_accessor
|
26
|
+
attr_accessor(*Validations::VALID_API_KEYS)
|
30
27
|
|
31
28
|
attr_accessor :current_options
|
32
29
|
|
@@ -40,6 +37,22 @@ module Github
|
|
40
37
|
end
|
41
38
|
end
|
42
39
|
|
40
|
+
# Requires internal libraries
|
41
|
+
#
|
42
|
+
# @param [String] prefix
|
43
|
+
# the relative path prefix
|
44
|
+
# @param [Array[String]] libs
|
45
|
+
# the array of libraries to require
|
46
|
+
#
|
47
|
+
# @return [self]
|
48
|
+
#
|
49
|
+
# @api public
|
50
|
+
def self.require_all(prefix, *libs)
|
51
|
+
libs.each do |lib|
|
52
|
+
require "#{File.join(prefix, lib)}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
43
56
|
# Create new API
|
44
57
|
#
|
45
58
|
# @api public
|
@@ -209,7 +222,7 @@ module Github
|
|
209
222
|
#
|
210
223
|
# @api private
|
211
224
|
def filter_callbacks(kind, action_name)
|
212
|
-
|
225
|
+
self.class.send("#{kind}_callbacks").select do |callback|
|
213
226
|
callback[:only].nil? || callback[:only].include?(action_name)
|
214
227
|
end
|
215
228
|
end
|
@@ -253,6 +266,10 @@ module Github
|
|
253
266
|
end
|
254
267
|
end
|
255
268
|
|
269
|
+
def respond_to?(method_name, include_private = false)
|
270
|
+
method_name.to_s.start_with?('clear_') || super
|
271
|
+
end
|
272
|
+
|
256
273
|
# Acts as setter and getter for api requests arguments parsing.
|
257
274
|
#
|
258
275
|
# Returns Arguments instance.
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative 'config/property'
|
4
|
+
require_relative 'config/property_set'
|
5
5
|
|
6
6
|
module Github
|
7
|
-
|
8
7
|
class API
|
9
8
|
# A base class for constructing api configuration
|
10
9
|
class Config
|
11
|
-
|
12
10
|
# Defines a property on an object's class or instance
|
13
11
|
#
|
14
12
|
# @example
|
data/lib/github_api/client.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require_relative '../../api'
|
4
|
+
|
3
5
|
module Github
|
4
6
|
class Client::Authorizations::App < Client::Authorizations
|
5
7
|
# Get-or-create an authorization for a specific app
|
@@ -47,7 +49,7 @@ module Github
|
|
47
49
|
if arguments.client_id
|
48
50
|
begin
|
49
51
|
get_request("/applications/#{arguments.client_id}/tokens/#{arguments.access_token}", params)
|
50
|
-
rescue Github::Error::NotFound
|
52
|
+
rescue Github::Error::NotFound
|
51
53
|
nil
|
52
54
|
end
|
53
55
|
else
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../../api'
|
4
4
|
|
5
|
+
module Github
|
5
6
|
# Since blobs can be any arbitrary binary data, the input and responses for
|
6
7
|
# the blob api takes an encoding parameter that can be either utf-8 or base64.
|
7
8
|
# If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it.
|