Skip to content

Commit ec03e8c

Browse files
committed
Change notification to remove permit.
1 parent 0753ef2 commit ec03e8c

3 files changed

Lines changed: 20 additions & 30 deletions

File tree

lib/github_api/client/activity/notifications.rb

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,19 @@ class Client::Activity::Notifications < API
3535
#
3636
# @api public
3737
def list(*args)
38-
arguments(args) do
39-
permit %w[ all participating since user repo]
40-
end
38+
arguments(args)
4139
params = arguments.params
4240

43-
response = if ( (user_name = params.delete("user")) &&
44-
(repo_name = params.delete("repo")) )
41+
response = if ( (user_name = params.delete('user')) &&
42+
(repo_name = params.delete('repo')) )
4543
get_request("/repos/#{user_name}/#{repo_name}/notifications", params)
4644
else
47-
get_request("/notifications", params)
45+
get_request('/notifications', params)
4846
end
4947
return response unless block_given?
5048
response.each { |el| yield el }
5149
end
52-
alias :all :list
50+
alias_method :all, :list
5351

5452
# View a single thread
5553
#
@@ -62,13 +60,13 @@ def list(*args)
6260
#
6361
# @api public
6462
def get(*args)
65-
arguments(args, required: [:id])
63+
arguments(args, required: [:thread_id])
6664

67-
response = get_request("/notifications/threads/#{arguments.id}", arguments.params)
65+
response = get_request("/notifications/threads/#{arguments.thread_id}", arguments.params)
6866
return response unless block_given?
6967
response.each { |el| yield el }
7068
end
71-
alias :find :get
69+
alias_method :find, :get
7270

7371
# Mark as read
7472
#
@@ -103,19 +101,17 @@ def get(*args)
103101
#
104102
# @api public
105103
def mark(*args)
106-
arguments(args) do
107-
permit %w[ unread read last_read_at user repo id]
108-
end
104+
arguments(args)
109105
params = arguments.params
110106

111-
if ( (user_name = params.delete("user")) &&
112-
(repo_name = params.delete("repo")) )
107+
if ( (user_name = params.delete('user')) &&
108+
(repo_name = params.delete('repo')) )
113109

114110
put_request("/repos/#{user_name}/#{repo_name}/notifications", params)
115111
elsif (thread_id = params.delete("id"))
116112
patch_request("/notifications/threads/#{thread_id}", params)
117113
else
118-
put_request("/notifications", params)
114+
put_request('/notifications', params)
119115
end
120116
end
121117

@@ -132,9 +128,9 @@ def mark(*args)
132128
#
133129
# @api public
134130
def subscribed?(*args)
135-
arguments(args, required: [:id])
131+
arguments(args, required: [:thread_id])
136132

137-
get_request("/notifications/threads/#{arguments.id}/subscription", arguments.params)
133+
get_request("/notifications/threads/#{arguments.thread_id}/subscription", arguments.params)
138134
end
139135

140136
# Create a thread subscription
@@ -160,9 +156,9 @@ def subscribed?(*args)
160156
#
161157
# @api public
162158
def create(*args)
163-
arguments(args, required: [:id])
159+
arguments(args, required: [:thread_id])
164160

165-
put_request("/notifications/threads/#{arguments.id}/subscription", arguments.params)
161+
put_request("/notifications/threads/#{arguments.thread_id}/subscription", arguments.params)
166162
end
167163

168164
# Delete a thread subscription
@@ -175,10 +171,10 @@ def create(*args)
175171
#
176172
# @api public
177173
def delete(*args)
178-
arguments(args, required: [:id])
174+
arguments(args, required: [:thread_id])
179175

180-
delete_request("/notifications/threads/#{arguments.id}/subscription", arguments.params)
176+
delete_request("/notifications/threads/#{arguments.thread_id}/subscription", arguments.params)
181177
end
182-
alias :remove :delete
178+
alias_method :remove, :delete
183179
end # Client::Activity::Notifications
184180
end # Github

spec/github/client/activity/notifications/list_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323

2424
it { should respond_to :all }
2525

26-
it 'filters unknown parameters' do
27-
subject.list :unknown => true
28-
a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
29-
should have_been_made
30-
end
31-
3226
it 'should get the resource' do
3327
subject.list
3428
a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN}).

spec/github/client/activity/notifications/mark_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727

2828
it 'should get the resource' do
29-
subject.mark inputs.merge(:unknown => true)
29+
subject.mark(inputs)
3030
a_put(request_path).
3131
with(:body => inputs, :query => {:access_token => OAUTH_TOKEN}).
3232
should have_been_made

0 commit comments

Comments
 (0)