github_api 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metadata +4 -140
- data/LICENSE.txt +0 -20
- data/README.rdoc +0 -228
- data/Rakefile +0 -52
- data/features/github_api.feature +0 -50
- data/features/step_definitions/github_api_steps.rb +0 -11
- data/features/support/env.rb +0 -13
- data/lib/github_api.rb +0 -73
- data/lib/github_api/api.rb +0 -175
- data/lib/github_api/api/utils.rb +0 -9
- data/lib/github_api/authorization.rb +0 -73
- data/lib/github_api/authorizations.rb +0 -119
- data/lib/github_api/cache_control.rb +0 -19
- data/lib/github_api/client.rb +0 -55
- data/lib/github_api/compatibility.rb +0 -23
- data/lib/github_api/configuration.rb +0 -96
- data/lib/github_api/connection.rb +0 -81
- data/lib/github_api/core_ext/array.rb +0 -14
- data/lib/github_api/core_ext/hash.rb +0 -42
- data/lib/github_api/error.rb +0 -35
- data/lib/github_api/events.rb +0 -202
- data/lib/github_api/gists.rb +0 -200
- data/lib/github_api/gists/comments.rb +0 -86
- data/lib/github_api/git_data.rb +0 -26
- data/lib/github_api/git_data/blobs.rb +0 -51
- data/lib/github_api/git_data/commits.rb +0 -78
- data/lib/github_api/git_data/references.rb +0 -113
- data/lib/github_api/git_data/tags.rb +0 -78
- data/lib/github_api/git_data/trees.rb +0 -89
- data/lib/github_api/issues.rb +0 -215
- data/lib/github_api/issues/comments.rb +0 -110
- data/lib/github_api/issues/events.rb +0 -50
- data/lib/github_api/issues/labels.rb +0 -191
- data/lib/github_api/issues/milestones.rb +0 -119
- data/lib/github_api/mime_type.rb +0 -55
- data/lib/github_api/orgs.rb +0 -95
- data/lib/github_api/orgs/members.rb +0 -120
- data/lib/github_api/orgs/teams.rb +0 -245
- data/lib/github_api/pull_requests.rb +0 -224
- data/lib/github_api/pull_requests/comments.rb +0 -144
- data/lib/github_api/repos.rb +0 -286
- data/lib/github_api/repos/collaborators.rb +0 -81
- data/lib/github_api/repos/commits.rb +0 -180
- data/lib/github_api/repos/downloads.rb +0 -155
- data/lib/github_api/repos/forks.rb +0 -48
- data/lib/github_api/repos/hooks.rb +0 -173
- data/lib/github_api/repos/keys.rb +0 -104
- data/lib/github_api/repos/pub_sub_hubbub.rb +0 -102
- data/lib/github_api/repos/watching.rb +0 -94
- data/lib/github_api/request.rb +0 -84
- data/lib/github_api/request/basic_auth.rb +0 -31
- data/lib/github_api/request/caching.rb +0 -33
- data/lib/github_api/request/oauth2.rb +0 -33
- data/lib/github_api/response.rb +0 -28
- data/lib/github_api/response/helpers.rb +0 -14
- data/lib/github_api/response/jsonize.rb +0 -26
- data/lib/github_api/response/mashify.rb +0 -24
- data/lib/github_api/response/raise_error.rb +0 -33
- data/lib/github_api/result.rb +0 -42
- data/lib/github_api/users.rb +0 -84
- data/lib/github_api/users/emails.rb +0 -49
- data/lib/github_api/users/followers.rb +0 -98
- data/lib/github_api/users/keys.rb +0 -84
- data/lib/github_api/version.rb +0 -12
- data/spec/README.rdoc +0 -22
- data/spec/coverage_adapter.rb +0 -14
- data/spec/fixtures/auths/authorization.json +0 -14
- data/spec/fixtures/auths/authorizations.json +0 -16
- data/spec/fixtures/events/events.json +0 -29
- data/spec/fixtures/issues/issue.json +0 -56
- data/spec/fixtures/issues/issues.json +0 -58
- data/spec/fixtures/orgs/members.json +0 -9
- data/spec/fixtures/orgs/org.json +0 -18
- data/spec/fixtures/orgs/orgs.json +0 -8
- data/spec/fixtures/orgs/team.json +0 -8
- data/spec/fixtures/orgs/team_repos.json +0 -29
- data/spec/fixtures/orgs/teams.json +0 -7
- data/spec/fixtures/repos/branches.json +0 -9
- data/spec/fixtures/repos/collaborators.json +0 -8
- data/spec/fixtures/repos/commit.json +0 -53
- data/spec/fixtures/repos/commit_comment.json +0 -16
- data/spec/fixtures/repos/commit_comments.json +0 -18
- data/spec/fixtures/repos/commits.json +0 -27
- data/spec/fixtures/repos/contributors.json +0 -8
- data/spec/fixtures/repos/download.json +0 -10
- data/spec/fixtures/repos/download_s3.json +0 -21
- data/spec/fixtures/repos/downloads.json +0 -12
- data/spec/fixtures/repos/fork.json +0 -27
- data/spec/fixtures/repos/forks.json +0 -29
- data/spec/fixtures/repos/hook.json +0 -15
- data/spec/fixtures/repos/hooks.json +0 -10
- data/spec/fixtures/repos/key.json +0 -6
- data/spec/fixtures/repos/keys.json +0 -8
- data/spec/fixtures/repos/languages.json +0 -4
- data/spec/fixtures/repos/repo.json +0 -90
- data/spec/fixtures/repos/repo_comments.json +0 -18
- data/spec/fixtures/repos/repos.json +0 -29
- data/spec/fixtures/repos/tags.json +0 -11
- data/spec/fixtures/repos/teams.json +0 -7
- data/spec/fixtures/repos/watched.json +0 -29
- data/spec/fixtures/repos/watchers.json +0 -8
- data/spec/fixtures/users/user.json +0 -32
- data/spec/github/api_spec.rb +0 -25
- data/spec/github/authorization_spec.rb +0 -176
- data/spec/github/authorizations_spec.rb +0 -242
- data/spec/github/client_spec.rb +0 -50
- data/spec/github/core_ext/hash_spec.rb +0 -44
- data/spec/github/events_spec.rb +0 -491
- data/spec/github/gists/comments_spec.rb +0 -5
- data/spec/github/gists_spec.rb +0 -5
- data/spec/github/git_data/blobs_spec.rb +0 -5
- data/spec/github/git_data/commits_spec.rb +0 -5
- data/spec/github/git_data/references_spec.rb +0 -5
- data/spec/github/git_data/tags_spec.rb +0 -5
- data/spec/github/git_data/trees_spec.rb +0 -5
- data/spec/github/git_data_spec.rb +0 -5
- data/spec/github/issues/comments_spec.rb +0 -5
- data/spec/github/issues/events_spec.rb +0 -5
- data/spec/github/issues/labels_spec.rb +0 -5
- data/spec/github/issues/milestones_spec.rb +0 -5
- data/spec/github/issues_spec.rb +0 -287
- data/spec/github/mime_type_spec.rb +0 -70
- data/spec/github/orgs/members_spec.rb +0 -275
- data/spec/github/orgs/teams_spec.rb +0 -563
- data/spec/github/orgs_spec.rb +0 -160
- data/spec/github/repos/collaborators_spec.rb +0 -169
- data/spec/github/repos/commits_spec.rb +0 -424
- data/spec/github/repos/downloads_spec.rb +0 -236
- data/spec/github/repos/forks_spec.rb +0 -103
- data/spec/github/repos/hooks_spec.rb +0 -307
- data/spec/github/repos/keys_spec.rb +0 -216
- data/spec/github/repos/pub_sub_hubbub_spec.rb +0 -83
- data/spec/github/repos/watching_spec.rb +0 -222
- data/spec/github/repos_spec.rb +0 -571
- data/spec/github/result_spec.rb +0 -43
- data/spec/github/users_spec.rb +0 -140
- data/spec/github_spec.rb +0 -109
- data/spec/spec_helper.rb +0 -86
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module Github
|
|
2
|
-
module CacheOptions
|
|
3
|
-
extend self
|
|
4
|
-
|
|
5
|
-
def self.option_accessor(key)
|
|
6
|
-
defined_method("#{key}=") { |value| }
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
def initialize_options(options={})
|
|
12
|
-
@default_options = {
|
|
13
|
-
'type' => :memoization,
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
end
|
data/lib/github_api/client.rb
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
module Github
|
|
4
|
-
class Client < API
|
|
5
|
-
|
|
6
|
-
def gists(options = {})
|
|
7
|
-
@gists ||= _create_instance Github::Gists, options
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# The Git Database API gives you access to read and write raw Git objects
|
|
11
|
-
# to your Git database on GitHub and to list and update your references
|
|
12
|
-
# (branch heads and tags).
|
|
13
|
-
def git_data(options = {})
|
|
14
|
-
@git_data ||= _create_instance Github::GitData, options
|
|
15
|
-
end
|
|
16
|
-
alias :git :git_data
|
|
17
|
-
|
|
18
|
-
def issues(options = {})
|
|
19
|
-
@issues ||= _create_instance Github::Issues, options
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def orgs(options = {})
|
|
23
|
-
@orgs ||= _create_instance Github::Orgs, options
|
|
24
|
-
end
|
|
25
|
-
alias :organizations :orgs
|
|
26
|
-
|
|
27
|
-
def pull_requests(options = {})
|
|
28
|
-
@pull_requests ||= _create_instance Github::PullRequests, options
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def repos(options = {})
|
|
32
|
-
@repos ||= _create_instance Github::Repos, options
|
|
33
|
-
end
|
|
34
|
-
alias :repositories :repos
|
|
35
|
-
|
|
36
|
-
# Many of the resources on the users API provide a shortcut for getting
|
|
37
|
-
# information about the currently authenticated user.
|
|
38
|
-
def users(options = {})
|
|
39
|
-
@users ||= _create_instance Github::Users, options
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# This is a read-only API to the GitHub events.
|
|
43
|
-
# These events power the various activity streams on the site.
|
|
44
|
-
def events(options = {})
|
|
45
|
-
@events ||= _create_instance Github::Events, options
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# An API for users to manage their own tokens. You can only access your own
|
|
49
|
-
# tokens, and only through Basic Authentication.
|
|
50
|
-
def oauth(options = {})
|
|
51
|
-
@oauth ||= _create_instance Github::Authorizations, options
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
end # Client
|
|
55
|
-
end # Github
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
module Github
|
|
4
|
-
module Configuration
|
|
5
|
-
|
|
6
|
-
VALID_OPTIONS_KEYS = [
|
|
7
|
-
:adapter,
|
|
8
|
-
:client_id,
|
|
9
|
-
:client_secret,
|
|
10
|
-
:oauth_token,
|
|
11
|
-
:endpoint,
|
|
12
|
-
:mime_type,
|
|
13
|
-
:user_agent,
|
|
14
|
-
:connection_options,
|
|
15
|
-
:repo,
|
|
16
|
-
:user,
|
|
17
|
-
:login,
|
|
18
|
-
:password,
|
|
19
|
-
:basic_auth
|
|
20
|
-
].freeze
|
|
21
|
-
|
|
22
|
-
# Other adapters are :typhoeus, :patron, :em_synchrony, :excon, :test
|
|
23
|
-
DEFAULT_ADAPTER = :net_http
|
|
24
|
-
|
|
25
|
-
# By default, don't set an application key
|
|
26
|
-
DEFAULT_CLIENT_ID = nil
|
|
27
|
-
|
|
28
|
-
# By default, don't set an application secret
|
|
29
|
-
DEFAULT_CLIENT_SECRET = nil
|
|
30
|
-
|
|
31
|
-
# By default, don't set a user oauth access token
|
|
32
|
-
DEFAULT_OAUTH_TOKEN = nil
|
|
33
|
-
|
|
34
|
-
# By default, don't set a user login name
|
|
35
|
-
DEFAULT_LOGIN = nil
|
|
36
|
-
|
|
37
|
-
# By default, don't set a user password
|
|
38
|
-
DEFAULT_PASSWORD = nil
|
|
39
|
-
|
|
40
|
-
# By default, don't set a user basic authentication
|
|
41
|
-
DEFAULT_BASIC_AUTH = nil
|
|
42
|
-
|
|
43
|
-
# The endpoint used to connect to GitHub if none is set
|
|
44
|
-
DEFAULT_ENDPOINT = 'https://api.github.com'.freeze
|
|
45
|
-
|
|
46
|
-
# The value sent in the http header for 'User-Agent' if none is set
|
|
47
|
-
DEFAULT_USER_AGENT = "Github Ruby Gem #{Github::VERSION::STRING}".freeze
|
|
48
|
-
|
|
49
|
-
# By default the <tt>Accept</tt> header will make a request for <tt>JSON</tt>
|
|
50
|
-
DEFAULT_MIME_TYPE = :json
|
|
51
|
-
|
|
52
|
-
# By default uses the Faraday connection options if none is set
|
|
53
|
-
DEFAULT_CONNECTION_OPTIONS = {}
|
|
54
|
-
|
|
55
|
-
# By default, don't set user name
|
|
56
|
-
DEFAULT_USER = nil
|
|
57
|
-
|
|
58
|
-
# By default, don't set repository name
|
|
59
|
-
DEFAULT_REPO = nil
|
|
60
|
-
|
|
61
|
-
attr_accessor *VALID_OPTIONS_KEYS
|
|
62
|
-
|
|
63
|
-
# Convenience method to allow for global setting of configuration options
|
|
64
|
-
def configure
|
|
65
|
-
yield self
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def self.extended(base)
|
|
69
|
-
base.set_defaults
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def options
|
|
73
|
-
options = {}
|
|
74
|
-
VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
|
|
75
|
-
options
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def set_defaults
|
|
79
|
-
self.adapter = DEFAULT_ADAPTER
|
|
80
|
-
self.client_id = DEFAULT_CLIENT_ID
|
|
81
|
-
self.client_secret = DEFAULT_CLIENT_SECRET
|
|
82
|
-
self.oauth_token = DEFAULT_OAUTH_TOKEN
|
|
83
|
-
self.endpoint = DEFAULT_ENDPOINT
|
|
84
|
-
self.user_agent = DEFAULT_USER_AGENT
|
|
85
|
-
self.connection_options = DEFAULT_CONNECTION_OPTIONS
|
|
86
|
-
self.mime_type = DEFAULT_MIME_TYPE
|
|
87
|
-
self.user = DEFAULT_USER
|
|
88
|
-
self.repo = DEFAULT_REPO
|
|
89
|
-
self.login = DEFAULT_LOGIN
|
|
90
|
-
self.password = DEFAULT_PASSWORD
|
|
91
|
-
self.basic_auth = DEFAULT_BASIC_AUTH
|
|
92
|
-
self
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
end # Configuration
|
|
96
|
-
end # Github
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
require 'faraday'
|
|
4
|
-
require 'github_api/response'
|
|
5
|
-
require 'github_api/response/mashify'
|
|
6
|
-
require 'github_api/response/jsonize'
|
|
7
|
-
require 'github_api/response/helpers'
|
|
8
|
-
require 'github_api/response/raise_error'
|
|
9
|
-
require 'github_api/request/oauth2'
|
|
10
|
-
require 'github_api/request/basic_auth'
|
|
11
|
-
|
|
12
|
-
module Github
|
|
13
|
-
module Connection
|
|
14
|
-
|
|
15
|
-
ALLOWED_OPTIONS = [
|
|
16
|
-
:headers,
|
|
17
|
-
:url,
|
|
18
|
-
:params,
|
|
19
|
-
:request,
|
|
20
|
-
:ssl
|
|
21
|
-
].freeze
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def header_options() # :nodoc:
|
|
26
|
-
{
|
|
27
|
-
:headers => {
|
|
28
|
-
'Accept' => '*/*', #accepts,
|
|
29
|
-
'User-Agent' => user_agent,
|
|
30
|
-
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
31
|
-
},
|
|
32
|
-
:ssl => { :verify => false },
|
|
33
|
-
:url => endpoint
|
|
34
|
-
}
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def clear_cache # :nodoc:
|
|
38
|
-
@connection = nil
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def caching? # :nodoc:
|
|
42
|
-
!@connection.nil?
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def connection(options = {}) # :nodoc:
|
|
46
|
-
|
|
47
|
-
# parse(options['resource'], options['mime_type'] || mime_type) if options['mime_type']
|
|
48
|
-
# merged_options = if connection_options.empty?
|
|
49
|
-
# header_options.merge(options)
|
|
50
|
-
# else
|
|
51
|
-
# connection_options.merge(header_options)
|
|
52
|
-
# end
|
|
53
|
-
merged_options = _filter_params_keys(ALLOWED_OPTIONS, header_options.merge(options))
|
|
54
|
-
clear_cache unless options.empty?
|
|
55
|
-
|
|
56
|
-
@connection ||= begin
|
|
57
|
-
Faraday.new(merged_options) do |builder|
|
|
58
|
-
puts options.inspect
|
|
59
|
-
|
|
60
|
-
builder.use Faraday::Request::JSON
|
|
61
|
-
builder.use Faraday::Request::Multipart
|
|
62
|
-
builder.use Faraday::Request::UrlEncoded
|
|
63
|
-
builder.use Faraday::Response::Logger
|
|
64
|
-
|
|
65
|
-
builder.use Github::Request::OAuth2, oauth_token if oauth_token?
|
|
66
|
-
builder.use Github::Request::BasicAuth, authentication if basic_authed?
|
|
67
|
-
|
|
68
|
-
builder.use Github::Response::Helpers
|
|
69
|
-
unless options[:raw]
|
|
70
|
-
builder.use Github::Response::Mashify
|
|
71
|
-
builder.use Github::Response::Jsonize
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
builder.use Github::Response::RaiseError
|
|
75
|
-
builder.adapter adapter
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
end # Connection
|
|
81
|
-
end # Github
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
class Array # :nodoc:
|
|
2
|
-
|
|
3
|
-
def except(*keys) # :nodoc:
|
|
4
|
-
puts "module except works!!!"
|
|
5
|
-
self.dup.except!(*keys)
|
|
6
|
-
end unless method_defined?(:except)
|
|
7
|
-
|
|
8
|
-
def except!(*items) # :nodoc:
|
|
9
|
-
copy = self.dup
|
|
10
|
-
copy.reject! { |item| items.include? item }
|
|
11
|
-
copy
|
|
12
|
-
end unless method_defined?(:except!)
|
|
13
|
-
|
|
14
|
-
end # Hash
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
class Hash # :nodoc:
|
|
2
|
-
|
|
3
|
-
def except(*items) # :nodoc:
|
|
4
|
-
puts "array except works!!!"
|
|
5
|
-
self.dup.except!(*items)
|
|
6
|
-
end unless method_defined?(:except)
|
|
7
|
-
|
|
8
|
-
def except!(*keys) # :nodoc:
|
|
9
|
-
copy = self.dup
|
|
10
|
-
keys.each { |key| copy.delete!(key) }
|
|
11
|
-
copy
|
|
12
|
-
end unless method_defined?(:except!)
|
|
13
|
-
|
|
14
|
-
def symbolize_keys # :nodoc:
|
|
15
|
-
inject({}) do |hash, (key, value)|
|
|
16
|
-
hash[(key.to_sym rescue key) || key] = value
|
|
17
|
-
hash
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def symbolize_keys! # :nodoc:
|
|
22
|
-
hash = symbolize_keys
|
|
23
|
-
hash.each do |key, val|
|
|
24
|
-
hash[key] = case val
|
|
25
|
-
when Hash
|
|
26
|
-
val.symbolize_keys!
|
|
27
|
-
when Array
|
|
28
|
-
val.map do |item|
|
|
29
|
-
item.is_a?(Hash) ? item.symbolize_keys! : item
|
|
30
|
-
end
|
|
31
|
-
else
|
|
32
|
-
val
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
return hash
|
|
36
|
-
end unless method_defined?(:symbolize_keys!)
|
|
37
|
-
|
|
38
|
-
def serialize # :nodoc:
|
|
39
|
-
self.map { |key, val| [key, val].join("=") }.join("&")
|
|
40
|
-
end unless method_defined?(:serialize)
|
|
41
|
-
|
|
42
|
-
end # Hash
|
data/lib/github_api/error.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
module Github
|
|
4
|
-
class Error < StandardError
|
|
5
|
-
attr_reader :response_message, :response_headers
|
|
6
|
-
|
|
7
|
-
def initialize(message, headers)
|
|
8
|
-
@response_message = message
|
|
9
|
-
super message
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def inspect
|
|
13
|
-
%(#<#{self.class}>)
|
|
14
|
-
end
|
|
15
|
-
end # Error
|
|
16
|
-
|
|
17
|
-
# Raised when Github returns the HTTP status code 400
|
|
18
|
-
class BadRequest < Error; end
|
|
19
|
-
|
|
20
|
-
# Raised when Github returns the HTTP status code 401
|
|
21
|
-
class Unauthorised < Error; end
|
|
22
|
-
|
|
23
|
-
# Raised when Github returns the HTTP status code 403
|
|
24
|
-
class Forbidden < Error; end
|
|
25
|
-
|
|
26
|
-
# Raised when Github returns the HTTP status code 404
|
|
27
|
-
class ResourceNotFound < Error; end
|
|
28
|
-
|
|
29
|
-
# Raised when Github returns the HTTP status code 500
|
|
30
|
-
class InternalServerError < Error; end
|
|
31
|
-
|
|
32
|
-
# Raised when Github returns the HTTP status code 503
|
|
33
|
-
class ServiceUnavailable < Error; end
|
|
34
|
-
|
|
35
|
-
end # Github
|
data/lib/github_api/events.rb
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
module Github
|
|
4
|
-
class Events < API
|
|
5
|
-
|
|
6
|
-
# Creates new Gists API
|
|
7
|
-
def initialize(options = {})
|
|
8
|
-
super(options)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# List all public events
|
|
12
|
-
#
|
|
13
|
-
# = Examples
|
|
14
|
-
# @github = Github.new
|
|
15
|
-
# @github.events.public
|
|
16
|
-
# @github.events.public { |event| ... }
|
|
17
|
-
#
|
|
18
|
-
def public(params={})
|
|
19
|
-
_normalize_params_keys(params)
|
|
20
|
-
|
|
21
|
-
response = get("/events", params)
|
|
22
|
-
return response unless block_given?
|
|
23
|
-
response.each { |el| yield el }
|
|
24
|
-
end
|
|
25
|
-
alias :public_events :public
|
|
26
|
-
alias :list_public :public
|
|
27
|
-
alias :list_public_events :public
|
|
28
|
-
|
|
29
|
-
# List all repository events for a given user
|
|
30
|
-
#
|
|
31
|
-
# = Examples
|
|
32
|
-
# @github = Github.new
|
|
33
|
-
# @github.events.repository_events 'user-name', 'repo-name'
|
|
34
|
-
# @github.events.repository_events 'user-name', 'repo-name' { |event| ... }
|
|
35
|
-
#
|
|
36
|
-
def repository(user_name=nil, repo_name=nil, params={})
|
|
37
|
-
_update_user_repo_params(user_name, repo_name)
|
|
38
|
-
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
39
|
-
_normalize_params_keys(params)
|
|
40
|
-
|
|
41
|
-
response = get("/repos/#{user}/#{repo}/events", params)
|
|
42
|
-
return response unless block_given?
|
|
43
|
-
response.each { |el| yield el }
|
|
44
|
-
end
|
|
45
|
-
alias :repos :repository
|
|
46
|
-
alias :repo_events :repository
|
|
47
|
-
alias :repository_events :repository
|
|
48
|
-
alias :list_repository_events :repository
|
|
49
|
-
|
|
50
|
-
# List all issue events for a given repository
|
|
51
|
-
#
|
|
52
|
-
# = Examples
|
|
53
|
-
# @github = Github.new
|
|
54
|
-
# @github.events.issue 'user-name', 'repo-name'
|
|
55
|
-
# @github.events.issue 'user-name', 'repo-name' { |event| ... }
|
|
56
|
-
#
|
|
57
|
-
def issue(user_name=nil, repo_name=nil, params={})
|
|
58
|
-
_update_user_repo_params(user_name, repo_name)
|
|
59
|
-
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
60
|
-
_normalize_params_keys(params)
|
|
61
|
-
|
|
62
|
-
response = get("/repos/#{user}/#{repo}/issues/events", params)
|
|
63
|
-
return response unless block_given?
|
|
64
|
-
response.each { |el| yield el }
|
|
65
|
-
end
|
|
66
|
-
alias :issues :issue
|
|
67
|
-
alias :issue_events :issue
|
|
68
|
-
alias :list_issue_events :issue
|
|
69
|
-
|
|
70
|
-
# List all public events for a network of repositories
|
|
71
|
-
#
|
|
72
|
-
# = Examples
|
|
73
|
-
# @github = Github.new
|
|
74
|
-
# @github.events.network 'user-name', 'repo-name'
|
|
75
|
-
# @github.events.network 'user-name', 'repo-name' { |event| ... }
|
|
76
|
-
#
|
|
77
|
-
def network(user_name=nil, repo_name=nil, params={})
|
|
78
|
-
_update_user_repo_params(user_name, repo_name)
|
|
79
|
-
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
80
|
-
_normalize_params_keys(params)
|
|
81
|
-
|
|
82
|
-
response = get("/networks/#{user}/#{repo}/events", params)
|
|
83
|
-
return response unless block_given?
|
|
84
|
-
response.each { |el| yield el }
|
|
85
|
-
end
|
|
86
|
-
alias :repo_network :network
|
|
87
|
-
alias :repository_network :network
|
|
88
|
-
alias :list_repo_network_events :network
|
|
89
|
-
alias :list_repository_network_events :network
|
|
90
|
-
|
|
91
|
-
# List all public events for an organization
|
|
92
|
-
#
|
|
93
|
-
# = Examples
|
|
94
|
-
# @github = Github.new
|
|
95
|
-
# @github.events.org 'org-name'
|
|
96
|
-
# @github.events.org 'org-name' { |event| ... }
|
|
97
|
-
#
|
|
98
|
-
def org(org_name, params={})
|
|
99
|
-
_validate_presence_of org_name
|
|
100
|
-
_normalize_params_keys(params)
|
|
101
|
-
|
|
102
|
-
response = get("/orgs/#{org_name}/events", params)
|
|
103
|
-
return response unless block_given?
|
|
104
|
-
response.each { |el| yield el }
|
|
105
|
-
end
|
|
106
|
-
alias :organization :org
|
|
107
|
-
alias :list_orgs :org
|
|
108
|
-
alias :list_org_events :org
|
|
109
|
-
alias :list_organization_events :org
|
|
110
|
-
|
|
111
|
-
# List all events that a user has received
|
|
112
|
-
#
|
|
113
|
-
# These are events that you’ve received by watching repos and following users.
|
|
114
|
-
# If you are authenticated as the given user, you will see private events.
|
|
115
|
-
# Otherwise, you’ll only see public events.
|
|
116
|
-
#
|
|
117
|
-
# = Examples
|
|
118
|
-
# @github = Github.new
|
|
119
|
-
# @github.events.received 'user-name'
|
|
120
|
-
# @github.events.received 'user-name' { |event| ... }
|
|
121
|
-
#
|
|
122
|
-
# List all public events that a user has received
|
|
123
|
-
#
|
|
124
|
-
# = Examples
|
|
125
|
-
# @github = Github.new
|
|
126
|
-
# @github.events.received 'user-name', :public => true
|
|
127
|
-
# @github.events.received 'user-name', :public => true { |event| ... }
|
|
128
|
-
#
|
|
129
|
-
def received(user_name, params={})
|
|
130
|
-
_validate_presence_of user_name
|
|
131
|
-
_normalize_params_keys(params)
|
|
132
|
-
|
|
133
|
-
public_events = if params['public']
|
|
134
|
-
params.delete('public')
|
|
135
|
-
'/public'
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
response = get("/users/#{user_name}/received_events#{public_events}", params)
|
|
139
|
-
return response unless block_given?
|
|
140
|
-
response.each { |el| yield el }
|
|
141
|
-
end
|
|
142
|
-
alias :user_received :received
|
|
143
|
-
alias :list_user_received :received
|
|
144
|
-
|
|
145
|
-
# List all events that a user has performed
|
|
146
|
-
#
|
|
147
|
-
# If you are authenticated as the given user, you will see your private
|
|
148
|
-
# events. Otherwise, you’ll only see public events.
|
|
149
|
-
#
|
|
150
|
-
# = Examples
|
|
151
|
-
# @github = Github.new
|
|
152
|
-
# @github.events.performed 'user-name'
|
|
153
|
-
# @github.events.performed 'user-name' { |event| ... }
|
|
154
|
-
#
|
|
155
|
-
# List all public events that a user has performed
|
|
156
|
-
#
|
|
157
|
-
# = Examples
|
|
158
|
-
# @github = Github.new
|
|
159
|
-
# @github.events.performed 'user-name', :public => true
|
|
160
|
-
# @github.events.performed 'user-name', :public => true { |event| ... }
|
|
161
|
-
#
|
|
162
|
-
def performed(user_name, params={})
|
|
163
|
-
_validate_presence_of user_name
|
|
164
|
-
_normalize_params_keys(params)
|
|
165
|
-
|
|
166
|
-
public_events = if params['public']
|
|
167
|
-
params.delete('public')
|
|
168
|
-
'/public'
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
response = get("/users/#{user_name}/events#{public_events}", params)
|
|
172
|
-
return response unless block_given?
|
|
173
|
-
response.each { |el| yield el }
|
|
174
|
-
end
|
|
175
|
-
alias :user_performed :performed
|
|
176
|
-
alias :list_user_performed :performed
|
|
177
|
-
|
|
178
|
-
# List all events for an organization
|
|
179
|
-
#
|
|
180
|
-
# This is the user’s organization dashboard. You must be authenticated
|
|
181
|
-
# as the user to view this.
|
|
182
|
-
#
|
|
183
|
-
# = Examples
|
|
184
|
-
# @github = Github.new
|
|
185
|
-
# @github.events.user_org 'user-name', 'org-name'
|
|
186
|
-
# @github.events.user_org 'user-name', 'org-name' { |event| ... }
|
|
187
|
-
#
|
|
188
|
-
def user_org(user_name, org_name, params={})
|
|
189
|
-
_validate_presence_of user_name, org_name
|
|
190
|
-
_normalize_params_keys(params)
|
|
191
|
-
|
|
192
|
-
response = get("/users/#{user_name}/events/orgs/#{org_name}", params)
|
|
193
|
-
return response unless block_given?
|
|
194
|
-
response.each { |el| yield el }
|
|
195
|
-
end
|
|
196
|
-
alias :user_organization :user_org
|
|
197
|
-
alias :list_user_org :user_org
|
|
198
|
-
alias :list_user_org_events :user_org
|
|
199
|
-
alias :list_user_organization_events :user_org
|
|
200
|
-
|
|
201
|
-
end # Events
|
|
202
|
-
end # Github
|