lingfennan-github_api 0.18.2

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.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +741 -0
  4. data/lib/github_api.rb +93 -0
  5. data/lib/github_api/api.rb +398 -0
  6. data/lib/github_api/api/actions.rb +60 -0
  7. data/lib/github_api/api/arguments.rb +253 -0
  8. data/lib/github_api/api/config.rb +105 -0
  9. data/lib/github_api/api/config/property.rb +30 -0
  10. data/lib/github_api/api/config/property_set.rb +120 -0
  11. data/lib/github_api/api/factory.rb +33 -0
  12. data/lib/github_api/authorization.rb +75 -0
  13. data/lib/github_api/client.rb +77 -0
  14. data/lib/github_api/client/activity.rb +31 -0
  15. data/lib/github_api/client/activity/events.rb +233 -0
  16. data/lib/github_api/client/activity/feeds.rb +50 -0
  17. data/lib/github_api/client/activity/notifications.rb +181 -0
  18. data/lib/github_api/client/activity/starring.rb +130 -0
  19. data/lib/github_api/client/activity/watching.rb +176 -0
  20. data/lib/github_api/client/authorizations.rb +142 -0
  21. data/lib/github_api/client/authorizations/app.rb +98 -0
  22. data/lib/github_api/client/emojis.rb +19 -0
  23. data/lib/github_api/client/gists.rb +289 -0
  24. data/lib/github_api/client/gists/comments.rb +100 -0
  25. data/lib/github_api/client/git_data.rb +31 -0
  26. data/lib/github_api/client/git_data/blobs.rb +51 -0
  27. data/lib/github_api/client/git_data/commits.rb +101 -0
  28. data/lib/github_api/client/git_data/references.rb +150 -0
  29. data/lib/github_api/client/git_data/tags.rb +95 -0
  30. data/lib/github_api/client/git_data/trees.rb +113 -0
  31. data/lib/github_api/client/gitignore.rb +57 -0
  32. data/lib/github_api/client/issues.rb +248 -0
  33. data/lib/github_api/client/issues/assignees.rb +77 -0
  34. data/lib/github_api/client/issues/comments.rb +146 -0
  35. data/lib/github_api/client/issues/events.rb +50 -0
  36. data/lib/github_api/client/issues/labels.rb +189 -0
  37. data/lib/github_api/client/issues/milestones.rb +146 -0
  38. data/lib/github_api/client/markdown.rb +62 -0
  39. data/lib/github_api/client/meta.rb +19 -0
  40. data/lib/github_api/client/orgs.rb +127 -0
  41. data/lib/github_api/client/orgs/hooks.rb +182 -0
  42. data/lib/github_api/client/orgs/members.rb +142 -0
  43. data/lib/github_api/client/orgs/memberships.rb +131 -0
  44. data/lib/github_api/client/orgs/projects.rb +57 -0
  45. data/lib/github_api/client/orgs/teams.rb +407 -0
  46. data/lib/github_api/client/projects.rb +83 -0
  47. data/lib/github_api/client/projects/cards.rb +158 -0
  48. data/lib/github_api/client/projects/columns.rb +146 -0
  49. data/lib/github_api/client/pull_requests.rb +195 -0
  50. data/lib/github_api/client/pull_requests/comments.rb +140 -0
  51. data/lib/github_api/client/pull_requests/reviews.rb +158 -0
  52. data/lib/github_api/client/repos.rb +468 -0
  53. data/lib/github_api/client/repos/branches.rb +48 -0
  54. data/lib/github_api/client/repos/branches/protections.rb +75 -0
  55. data/lib/github_api/client/repos/collaborators.rb +84 -0
  56. data/lib/github_api/client/repos/comments.rb +125 -0
  57. data/lib/github_api/client/repos/commits.rb +80 -0
  58. data/lib/github_api/client/repos/contents.rb +246 -0
  59. data/lib/github_api/client/repos/deployments.rb +138 -0
  60. data/lib/github_api/client/repos/downloads.rb +62 -0
  61. data/lib/github_api/client/repos/forks.rb +48 -0
  62. data/lib/github_api/client/repos/hooks.rb +214 -0
  63. data/lib/github_api/client/repos/keys.rb +104 -0
  64. data/lib/github_api/client/repos/merging.rb +47 -0
  65. data/lib/github_api/client/repos/pages.rb +48 -0
  66. data/lib/github_api/client/repos/projects.rb +62 -0
  67. data/lib/github_api/client/repos/pub_sub_hubbub.rb +133 -0
  68. data/lib/github_api/client/repos/releases.rb +189 -0
  69. data/lib/github_api/client/repos/releases/assets.rb +136 -0
  70. data/lib/github_api/client/repos/releases/tags.rb +24 -0
  71. data/lib/github_api/client/repos/statistics.rb +89 -0
  72. data/lib/github_api/client/repos/statuses.rb +91 -0
  73. data/lib/github_api/client/say.rb +25 -0
  74. data/lib/github_api/client/scopes.rb +46 -0
  75. data/lib/github_api/client/search.rb +133 -0
  76. data/lib/github_api/client/search/legacy.rb +111 -0
  77. data/lib/github_api/client/users.rb +117 -0
  78. data/lib/github_api/client/users/emails.rb +65 -0
  79. data/lib/github_api/client/users/followers.rb +115 -0
  80. data/lib/github_api/client/users/keys.rb +104 -0
  81. data/lib/github_api/configuration.rb +70 -0
  82. data/lib/github_api/connection.rb +82 -0
  83. data/lib/github_api/constants.rb +61 -0
  84. data/lib/github_api/core_ext/array.rb +25 -0
  85. data/lib/github_api/core_ext/hash.rb +91 -0
  86. data/lib/github_api/core_ext/ordered_hash.rb +107 -0
  87. data/lib/github_api/deprecation.rb +39 -0
  88. data/lib/github_api/error.rb +32 -0
  89. data/lib/github_api/error/client_error.rb +89 -0
  90. data/lib/github_api/error/service_error.rb +223 -0
  91. data/lib/github_api/ext/faraday.rb +38 -0
  92. data/lib/github_api/mash.rb +7 -0
  93. data/lib/github_api/middleware.rb +37 -0
  94. data/lib/github_api/mime_type.rb +33 -0
  95. data/lib/github_api/normalizer.rb +23 -0
  96. data/lib/github_api/null_encoder.rb +25 -0
  97. data/lib/github_api/page_iterator.rb +138 -0
  98. data/lib/github_api/page_links.rb +63 -0
  99. data/lib/github_api/paged_request.rb +42 -0
  100. data/lib/github_api/pagination.rb +115 -0
  101. data/lib/github_api/parameter_filter.rb +35 -0
  102. data/lib/github_api/params_hash.rb +115 -0
  103. data/lib/github_api/rate_limit.rb +25 -0
  104. data/lib/github_api/request.rb +85 -0
  105. data/lib/github_api/request/basic_auth.rb +36 -0
  106. data/lib/github_api/request/jsonize.rb +54 -0
  107. data/lib/github_api/request/oauth2.rb +44 -0
  108. data/lib/github_api/request/verbs.rb +63 -0
  109. data/lib/github_api/response.rb +48 -0
  110. data/lib/github_api/response/atom_parser.rb +22 -0
  111. data/lib/github_api/response/follow_redirects.rb +140 -0
  112. data/lib/github_api/response/header.rb +87 -0
  113. data/lib/github_api/response/jsonize.rb +28 -0
  114. data/lib/github_api/response/mashify.rb +24 -0
  115. data/lib/github_api/response/raise_error.rb +22 -0
  116. data/lib/github_api/response/xmlize.rb +27 -0
  117. data/lib/github_api/response_wrapper.rb +161 -0
  118. data/lib/github_api/ssl_certs/cacerts.pem +2183 -0
  119. data/lib/github_api/utils/url.rb +63 -0
  120. data/lib/github_api/validations.rb +22 -0
  121. data/lib/github_api/validations/format.rb +26 -0
  122. data/lib/github_api/validations/presence.rb +32 -0
  123. data/lib/github_api/validations/required.rb +21 -0
  124. data/lib/github_api/validations/token.rb +41 -0
  125. data/lib/github_api/version.rb +5 -0
  126. metadata +338 -0
@@ -0,0 +1,120 @@
1
+ # encoding: utf-8
2
+
3
+ require 'set'
4
+
5
+ module Github
6
+ class API
7
+ class Config
8
+ # Class responsible for storing configuration properties
9
+ class PropertySet
10
+ include Enumerable
11
+
12
+ attr_reader :parent
13
+
14
+ attr_reader :properties
15
+
16
+ # Initialize an PropertySet
17
+ #
18
+ # @param [Object] parent
19
+ # @param [Set] properties
20
+ #
21
+ # @return [undefined]
22
+ #
23
+ # @api private
24
+ def initialize(parent = nil, properties = Set.new)
25
+ @parent = parent
26
+ @properties = properties
27
+ @map = {}
28
+ end
29
+
30
+ # Iterate over properties
31
+ #
32
+ # @yield [property]
33
+ #
34
+ # @yieldparam [Property] property
35
+ #
36
+ # @return [self]
37
+ #
38
+ # @api public
39
+ def each
40
+ return to_enum unless block_given?
41
+ @map.each { |name, property| yield property if name.is_a?(Symbol) }
42
+ self
43
+ end
44
+
45
+ # Adds property to the set
46
+ #
47
+ # @example
48
+ # properties_set << property
49
+ #
50
+ # @param [Property] property
51
+ #
52
+ # @return [self]
53
+ #
54
+ # @api public
55
+ def <<(property)
56
+ properties << property
57
+ update_map(property.name, property.default)
58
+ property.define_accessor_methods(self)
59
+ self
60
+ end
61
+
62
+ # Access property by name
63
+ #
64
+ # @api public
65
+ def [](name)
66
+ @map[name]
67
+ end
68
+ alias_method :fetch, :[]
69
+
70
+ # Set property value by name
71
+ #
72
+ # @api public
73
+ def []=(name, property)
74
+ update_map(name, property)
75
+ end
76
+
77
+ # Update map with index
78
+ #
79
+ # @api private
80
+ def update_map(name, property)
81
+ @map[name.to_sym] = @map[name.to_s.freeze] = property
82
+ end
83
+
84
+ # Convert properties to a hash of property names and
85
+ # corresponding values
86
+ #
87
+ # @api public
88
+ def to_hash
89
+ properties.each_with_object({}) do |property, props|
90
+ name = property.name
91
+ props[name] = self[name]
92
+ end
93
+ end
94
+
95
+ # Check if properties exist
96
+ #
97
+ # @api public
98
+ def empty?
99
+ @map.empty?
100
+ end
101
+
102
+ # @api private
103
+ def define_reader_method(property, method_name, visibility)
104
+ property_set = self
105
+ parent.send(:define_method, method_name) { property_set[property.name] }
106
+ parent.send(visibility, method_name)
107
+ end
108
+
109
+ # @api private
110
+ def define_writer_method(property, method_name, visibility)
111
+ property_set = self
112
+ parent.send(:define_method, method_name) do |value|
113
+ property_set[property.name]= value
114
+ end
115
+ parent.send(visibility, method_name)
116
+ end
117
+ end # PropertySet
118
+ end # Config
119
+ end # Api
120
+ end # Github
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'github_api/core_ext/hash'
4
+
5
+ module Github
6
+ class API
7
+ class Factory
8
+
9
+ # Instantiates a new github api object
10
+ #
11
+ def self.new(klass, options={}, &block)
12
+ return create_instance(klass, options, &block) if klass
13
+ raise ArgumentError, 'must provide API class to be instantiated'
14
+ end
15
+
16
+ # Passes configuration options to instantiated class
17
+ #
18
+ def self.create_instance(klass, options, &block)
19
+ options.symbolize_keys!
20
+ convert_to_constant(klass.to_s).new options, &block
21
+ end
22
+
23
+ # Convert name to constant
24
+ #
25
+ def self.convert_to_constant(classes)
26
+ classes.split('::').inject(Github) do |constant, klass|
27
+ constant.const_get klass
28
+ end
29
+ end
30
+
31
+ end # Factory
32
+ end # Api
33
+ end # Github
@@ -0,0 +1,75 @@
1
+ # encoding: utf-8
2
+
3
+ require 'oauth2'
4
+
5
+ module Github
6
+ module Authorization
7
+
8
+ # Setup OAuth2 instance
9
+ def client
10
+ @client ||= ::OAuth2::Client.new(client_id, client_secret,
11
+ {
12
+ :site => current_options.fetch(:site) { Github.site },
13
+ :authorize_url => 'login/oauth/authorize',
14
+ :token_url => 'login/oauth/access_token',
15
+ :ssl => { :verify => false }
16
+ }
17
+ )
18
+ end
19
+
20
+ # Strategy token
21
+ def auth_code
22
+ _verify_client
23
+ client.auth_code
24
+ end
25
+
26
+ # Sends authorization request to GitHub.
27
+ # = Parameters
28
+ # * <tt>:redirect_uri</tt> - Optional string.
29
+ # * <tt>:scope</tt> - Optional string. Comma separated list of scopes.
30
+ # Available scopes:
31
+ # * (no scope) - public read-only access (includes public user profile info, public repo info, and gists).
32
+ # * <tt>user</tt> - DB read/write access to profile info only.
33
+ # * <tt>public_repo</tt> - DB read/write access, and Git read access to public repos.
34
+ # * <tt>repo</tt> - DB read/write access, and Git read access to public and private repos.
35
+ # * <tt>gist</tt> - write access to gists.
36
+ #
37
+ def authorize_url(params = {})
38
+ _verify_client
39
+ client.auth_code.authorize_url(params)
40
+ end
41
+
42
+ # Makes request to token endpoint and retrieves access token value
43
+ def get_token(authorization_code, params = {})
44
+ _verify_client
45
+ client.auth_code.get_token(authorization_code, params)
46
+ end
47
+
48
+ # Check whether authentication credentials are present
49
+ def authenticated?
50
+ basic_authed? || oauth_token?
51
+ end
52
+
53
+ # Check whether basic authentication credentials are present
54
+ def basic_authed?
55
+ basic_auth? || (login? && password?)
56
+ end
57
+
58
+ # Select authentication parameters
59
+ #
60
+ # @api public
61
+ def authentication
62
+ if basic_authed?
63
+ { login: login, password: password }
64
+ else
65
+ {}
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ def _verify_client # :nodoc:
72
+ raise ArgumentError, 'Need to provide client_id and client_secret' unless client_id? && client_secret?
73
+ end
74
+ end # Authorization
75
+ end # Github
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative 'api'
4
+
5
+ module Github
6
+ class Client < API
7
+ require_all 'github_api/client',
8
+ 'activity',
9
+ 'authorizations',
10
+ 'emojis',
11
+ 'gists',
12
+ 'gitignore',
13
+ 'git_data',
14
+ 'issues',
15
+ 'markdown',
16
+ 'meta',
17
+ 'orgs',
18
+ 'projects',
19
+ 'pull_requests',
20
+ 'repos',
21
+ 'say',
22
+ 'scopes',
23
+ 'search',
24
+ 'users'
25
+
26
+ # Serving up the 'social' in Social Coding, the Activity APIs
27
+ # provide access to notifications, subscriptions, and timelines.
28
+ namespace :activity
29
+
30
+ namespace :emojis
31
+
32
+ namespace :gists
33
+
34
+ namespace :gitignore
35
+ alias :git_ignore :gitignore
36
+
37
+ # The Git Database API gives you access to read and write raw Git objects
38
+ # to your Git database on GitHub and to list and update your references
39
+ # (branch heads and tags).
40
+ namespace :git_data
41
+ alias :git :git_data
42
+
43
+ namespace :issues
44
+
45
+ namespace :markdown
46
+
47
+ namespace :meta
48
+
49
+ # An API for users to manage their own tokens. You can only access your own
50
+ # tokens, and only through Basic Authentication.
51
+ namespace :authorizations
52
+ alias :oauth :authorizations
53
+ alias :auth :authorizations
54
+
55
+ namespace :orgs
56
+ alias :organizations :orgs
57
+
58
+ namespace :projects
59
+
60
+ namespace :pull_requests
61
+ alias :pulls :pull_requests
62
+
63
+ namespace :repos
64
+ alias :repositories :repos
65
+
66
+ namespace :say
67
+ alias :octocat :say
68
+
69
+ namespace :scopes
70
+
71
+ namespace :search
72
+
73
+ # Many of the resources on the users API provide a shortcut for getting
74
+ # information about the currently authenticated user.
75
+ namespace :users
76
+ end # Client
77
+ end # Github
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../api'
4
+
5
+ module Github
6
+ class Client::Activity < API
7
+
8
+ require_all 'github_api/client/activity',
9
+ 'events',
10
+ 'notifications',
11
+ 'feeds',
12
+ 'starring',
13
+ 'watching'
14
+
15
+ # Access to Activity::Events API
16
+ namespace :events
17
+
18
+ # Access to Activity::Notifications API
19
+ namespace :notifications
20
+
21
+ # Access to Activity::Feeds API
22
+ namespace :feeds
23
+
24
+ # Access to Activity::Starring API
25
+ namespace :starring
26
+
27
+ # Access to Activity::Watching API
28
+ namespace :watching
29
+
30
+ end # Activity
31
+ end # Github
@@ -0,0 +1,233 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative '../../api'
4
+
5
+ module Github
6
+ class Client::Activity::Events < API
7
+ # List all public events
8
+ #
9
+ # @see https://developer.github.com/v3/activity/events/#list-public-events
10
+ #
11
+ # @example
12
+ # github = Github.new
13
+ # github.activity.events.public
14
+ # github.activity.events.public { |event| ... }
15
+ #
16
+ # @api public
17
+ def public(*args)
18
+ arguments(args)
19
+
20
+ response = get_request("/events", arguments.params)
21
+ return response unless block_given?
22
+ response.each { |el| yield el }
23
+ end
24
+ alias_method :public_events, :public
25
+ alias_method :list_public, :public
26
+ alias_method :list_public_events, :public
27
+
28
+ # List all repository events for a given user
29
+ #
30
+ # @example
31
+ # github = Github.new
32
+ # github.activity.events.repository 'user-name', 'repo-name'
33
+ # github.activity.events.repository 'user-name', 'repo-name' { |event| ... }
34
+ #
35
+ # @example
36
+ # github.activity.events.repository user: 'user-name', repo: 'repo-name'
37
+ # github.activity.events.repository user: 'user-name', repo: 'repo-name' {|event| ... }
38
+ #
39
+ # @api public
40
+ def repository(*args)
41
+ arguments(args, required: [:user, :repo])
42
+
43
+ response = get_request("/repos/#{arguments.user}/#{arguments.repo}/events", arguments.params)
44
+ return response unless block_given?
45
+ response.each { |el| yield el }
46
+ end
47
+ alias_method :repos, :repository
48
+ alias_method :repo_events, :repository
49
+ alias_method :repository_events, :repository
50
+ alias_method :list_repository_events, :repository
51
+
52
+ # List all issue events for a given repository
53
+ #
54
+ # @example
55
+ # github = Github.new
56
+ # github.activity.events.issue 'user-name', 'repo-name'
57
+ # github.activity.events.issue 'user-name', 'repo-name' { |event| ... }
58
+ #
59
+ # @example
60
+ # github.activity.events.issue user: 'user-name', repo: 'repo-name'
61
+ # github.activity.events.issue user: 'user-name', repo: 'repo-name' { |event| ... }
62
+ #
63
+ # @api public
64
+ def issue(*args)
65
+ arguments(args, required: [:user, :repo])
66
+
67
+ response = get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/events", arguments.params)
68
+ return response unless block_given?
69
+ response.each { |el| yield el }
70
+ end
71
+ alias_method :issues, :issue
72
+ alias_method :issue_events, :issue
73
+ alias_method :list_issue_events, :issue
74
+
75
+ # List all public events for a network of repositories
76
+ #
77
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
78
+ #
79
+ # @example
80
+ # github = Github.new
81
+ # github.activity.events.network 'user-name', 'repo-name'
82
+ # github.activity.events.network 'user-name', 'repo-name' { |event| ... }
83
+ #
84
+ # @example
85
+ # github.activity.events.network user: 'user-name', repo: 'repo-name'
86
+ # github.activity.events.network user: 'user-name', repo: 'repo-name' { |event| ... }
87
+ #
88
+ # @api public
89
+ def network(*args)
90
+ arguments(args, required: [:user, :repo])
91
+
92
+ response = get_request("/networks/#{arguments.user}/#{arguments.repo}/events", arguments.params)
93
+ return response unless block_given?
94
+ response.each { |el| yield el }
95
+ end
96
+ alias_method :repo_network, :network
97
+ alias_method :repository_network, :network
98
+ alias_method :list_repo_network_events, :network
99
+ alias_method :list_repository_network_events, :network
100
+
101
+ # List all public events for an organization
102
+ #
103
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
104
+ #
105
+ # @example
106
+ # github = Github.new
107
+ # github.activity.events.org 'org-name'
108
+ # github.activity.events.org 'org-name' { |event| ... }
109
+ #
110
+ # @example
111
+ # github.activity.events.org name: 'org-name'
112
+ # github.activity.events.org name: 'org-name' { |event| ... }
113
+ #
114
+ # @api public
115
+ def org(*args)
116
+ arguments(args, required: [:name])
117
+
118
+ response = get_request("/orgs/#{arguments.name}/events", arguments.params)
119
+ return response unless block_given?
120
+ response.each { |el| yield el }
121
+ end
122
+ alias_method :organization, :org
123
+ alias_method :list_orgs, :org
124
+ alias_method :list_org_events, :org
125
+ alias_method :list_organization_events, :org
126
+
127
+ # List all events that a user has received
128
+ #
129
+ # @see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
130
+ #
131
+ # These are events that you’ve received by watching repos
132
+ # and following users. If you are authenticated as the given user,
133
+ # you will see private events. Otherwise, you’ll only see public events.
134
+ #
135
+ # @example
136
+ # github = Github.new
137
+ # github.activity.events.received 'user-name'
138
+ # github.activity.events.received 'user-name' { |event| ... }
139
+ #
140
+ # List all public events that a user has received
141
+ #
142
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
143
+ #
144
+ # @example
145
+ # github = Github.new
146
+ # github.activity.events.received 'user-name', public: true
147
+ # github.activity.events.received 'user-name', public: true { |event| ... }
148
+ #
149
+ # @api public
150
+ def received(*args)
151
+ arguments(args, required: [:user])
152
+ params = arguments.params
153
+
154
+ public_events = if params['public']
155
+ params.delete('public')
156
+ '/public'
157
+ end
158
+
159
+ response = get_request("/users/#{arguments.user}/received_events#{public_events}", params)
160
+ return response unless block_given?
161
+ response.each { |el| yield el }
162
+ end
163
+ alias_method :user_received, :received
164
+ alias_method :list_user_received, :received
165
+
166
+ # List all events that a user has performed
167
+ #
168
+ # @see https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
169
+ #
170
+ # If you are authenticated as the given user, you will see your private
171
+ # events. Otherwise, you’ll only see public events.
172
+ #
173
+ # @example
174
+ # github = Github.new
175
+ # github.activity.events.performed 'user-name'
176
+ # github.activity.events.performed 'user-name' { |event| ... }
177
+ #
178
+ # List all public events that a user has performed
179
+ #
180
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
181
+ #
182
+ # @example
183
+ # github = Github.new
184
+ # github.activity.events.performed 'user-name', public: true
185
+ # github.activity.events.performed 'user-name', public: true { |event| ... }
186
+ #
187
+ # @api public
188
+ def performed(*args)
189
+ arguments(args, required: [:user])
190
+ params = arguments.params
191
+
192
+ public_events = if params['public']
193
+ params.delete('public')
194
+ '/public'
195
+ end
196
+
197
+ response = get_request("/users/#{arguments.user}/events#{public_events}", params)
198
+ return response unless block_given?
199
+ response.each { |el| yield el }
200
+ end
201
+ alias_method :user_performed, :performed
202
+ alias_method :list_user_performed, :performed
203
+
204
+ # List all events for an organization
205
+ #
206
+ # @see https://developer.github.com/v3/activity/events/#list-events-for-an-organization
207
+ #
208
+ # This is the user's organization dashboard. You must be authenticated
209
+ # as the user to view this.
210
+ #
211
+ # @example
212
+ # github = Github.new
213
+ # github.activity.events.user_org 'user-name', 'org-name'
214
+ # github.activity.events.user_org 'user-name', 'org-name' { |event| ... }
215
+ #
216
+ # @example
217
+ # github.activity.events.user_org user: 'user-name', name: 'org-name'
218
+ # github.activity.events.user_org user: 'user-name', name: 'org-name' {|event| ...}
219
+ #
220
+ # @api public
221
+ def user_org(*args)
222
+ arguments(args, required: [:user, :name])
223
+
224
+ response = get_request("/users/#{arguments.user}/events/orgs/#{arguments.name}", arguments.params)
225
+ return response unless block_given?
226
+ response.each { |el| yield el }
227
+ end
228
+ alias_method :user_organization, :user_org
229
+ alias_method :list_user_org, :user_org
230
+ alias_method :list_user_org_events, :user_org
231
+ alias_method :list_user_organization_events, :user_org
232
+ end # Client::Activity::Events
233
+ end # Github