Skip to content

Commit 5883971

Browse files
committed
Change events syntax.
1 parent e27b096 commit 5883971

1 file changed

Lines changed: 43 additions & 28 deletions

File tree

lib/github_api/client/activity/events.rb

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
module Github
44
class Client::Activity::Events < API
5-
65
# List all public events
76
#
7+
# @see https://developer.github.com/v3/activity/events/#list-public-events
8+
#
89
# @example
910
# github = Github.new
1011
# github.activity.events.public
@@ -18,9 +19,9 @@ def public(*args)
1819
return response unless block_given?
1920
response.each { |el| yield el }
2021
end
21-
alias :public_events :public
22-
alias :list_public :public
23-
alias :list_public_events :public
22+
alias_method :public_events, :public
23+
alias_method :list_public, :public
24+
alias_method :list_public_events, :public
2425

2526
# List all repository events for a given user
2627
#
@@ -41,10 +42,10 @@ def repository(*args)
4142
return response unless block_given?
4243
response.each { |el| yield el }
4344
end
44-
alias :repos :repository
45-
alias :repo_events :repository
46-
alias :repository_events :repository
47-
alias :list_repository_events :repository
45+
alias_method :repos, :repository
46+
alias_method :repo_events, :repository
47+
alias_method :repository_events, :repository
48+
alias_method :list_repository_events, :repository
4849

4950
# List all issue events for a given repository
5051
#
@@ -65,12 +66,14 @@ def issue(*args)
6566
return response unless block_given?
6667
response.each { |el| yield el }
6768
end
68-
alias :issues :issue
69-
alias :issue_events :issue
70-
alias :list_issue_events :issue
69+
alias_method :issues, :issue
70+
alias_method :issue_events, :issue
71+
alias_method :list_issue_events, :issue
7172

7273
# List all public events for a network of repositories
7374
#
75+
# @see https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
76+
#
7477
# @example
7578
# github = Github.new
7679
# github.activity.events.network 'user-name', 'repo-name'
@@ -88,13 +91,15 @@ def network(*args)
8891
return response unless block_given?
8992
response.each { |el| yield el }
9093
end
91-
alias :repo_network :network
92-
alias :repository_network :network
93-
alias :list_repo_network_events :network
94-
alias :list_repository_network_events :network
94+
alias_method :repo_network, :network
95+
alias_method :repository_network, :network
96+
alias_method :list_repo_network_events, :network
97+
alias_method :list_repository_network_events, :network
9598

9699
# List all public events for an organization
97100
#
101+
# @see https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
102+
#
98103
# @example
99104
# github = Github.new
100105
# github.activity.events.org 'org-name'
@@ -112,13 +117,15 @@ def org(*args)
112117
return response unless block_given?
113118
response.each { |el| yield el }
114119
end
115-
alias :organization :org
116-
alias :list_orgs :org
117-
alias :list_org_events :org
118-
alias :list_organization_events :org
120+
alias_method :organization, :org
121+
alias_method :list_orgs, :org
122+
alias_method :list_org_events, :org
123+
alias_method :list_organization_events, :org
119124

120125
# List all events that a user has received
121126
#
127+
# @see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
128+
#
122129
# These are events that you’ve received by watching repos
123130
# and following users. If you are authenticated as the given user,
124131
# you will see private events. Otherwise, you’ll only see public events.
@@ -130,6 +137,8 @@ def org(*args)
130137
#
131138
# List all public events that a user has received
132139
#
140+
# @see https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
141+
#
133142
# @example
134143
# github = Github.new
135144
# github.activity.events.received 'user-name', public: true
@@ -149,11 +158,13 @@ def received(*args)
149158
return response unless block_given?
150159
response.each { |el| yield el }
151160
end
152-
alias :user_received :received
153-
alias :list_user_received :received
161+
alias_method :user_received, :received
162+
alias_method :list_user_received, :received
154163

155164
# List all events that a user has performed
156165
#
166+
# @see https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
167+
#
157168
# If you are authenticated as the given user, you will see your private
158169
# events. Otherwise, you’ll only see public events.
159170
#
@@ -164,6 +175,8 @@ def received(*args)
164175
#
165176
# List all public events that a user has performed
166177
#
178+
# @see https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
179+
#
167180
# @example
168181
# github = Github.new
169182
# github.activity.events.performed 'user-name', public: true
@@ -183,12 +196,14 @@ def performed(*args)
183196
return response unless block_given?
184197
response.each { |el| yield el }
185198
end
186-
alias :user_performed :performed
187-
alias :list_user_performed :performed
199+
alias_method :user_performed, :performed
200+
alias_method :list_user_performed, :performed
188201

189202
# List all events for an organization
190203
#
191-
# This is the user’s organization dashboard. You must be authenticated
204+
# @see https://developer.github.com/v3/activity/events/#list-events-for-an-organization
205+
#
206+
# This is the user's organization dashboard. You must be authenticated
192207
# as the user to view this.
193208
#
194209
# @example
@@ -208,9 +223,9 @@ def user_org(*args)
208223
return response unless block_given?
209224
response.each { |el| yield el }
210225
end
211-
alias :user_organization :user_org
212-
alias :list_user_org :user_org
213-
alias :list_user_org_events :user_org
214-
alias :list_user_organization_events :user_org
226+
alias_method :user_organization, :user_org
227+
alias_method :list_user_org, :user_org
228+
alias_method :list_user_org_events, :user_org
229+
alias_method :list_user_organization_events, :user_org
215230
end # Client::Activity::Events
216231
end # Github

0 commit comments

Comments
 (0)