Skip to content

Commit 2c61f83

Browse files
committed
Remove Resource duplication
1 parent 225b825 commit 2c61f83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/pusher/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def resource(path)
144144
# @raise [Pusher::HTTPError] Error raised inside http client. The original error is wrapped in error.original_error
145145
#
146146
def get(path, params = {})
147-
Resource.new(self, path).get(params)
147+
resource(path).get(params)
148148
end
149149

150150
# GET arbitrary REST API resource using an asynchronous http client.
@@ -160,20 +160,20 @@ def get(path, params = {})
160160
# @return Either an EM::DefaultDeferrable or a HTTPClient::Connection
161161
#
162162
def get_async(path, params = {})
163-
Resource.new(self, path).get_async(params)
163+
resource(path).get_async(params)
164164
end
165165

166166
# POST arbitrary REST API resource using a synchronous http client.
167167
# Works identially to get method, but posts params as JSON in post body.
168168
def post(path, params = {})
169-
Resource.new(self, path).post(params)
169+
resource(path).post(params)
170170
end
171171

172172
# POST arbitrary REST API resource using an asynchronous http client.
173173
# Works identially to get_async method, but posts params as JSON in post
174174
# body.
175175
def post_async(path, params = {})
176-
Resource.new(self, path).post_async(params)
176+
resource(path).post_async(params)
177177
end
178178

179179
## HELPER METHODS ##

0 commit comments

Comments
 (0)