Skip to content

Commit

Permalink
Use client.path in batch requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawrence Oluyede committed Mar 9, 2016
1 parent 63c3d8d commit 822738f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/parse/batch.rb
Expand Up @@ -17,25 +17,25 @@ def add_request(request)

def create_object(object)
method = 'POST'
path = Parse::Protocol.class_uri(object.class_name)
path = class_uri(object.class_name)
body = object.safe_hash
add_request('method' => method,
'path' => path,
'body' => body)
add_request('method' => method, 'path' => path, 'body' => body)
end

def update_object(object)
method = 'PUT'
path = Parse::Protocol.class_uri(object.class_name, object.id)
path = class_uri(object.class_name, object.id)
body = object.safe_hash
add_request('method' => method,
'path' => path,
'body' => body)
add_request('method' => method, 'path' => path, 'body' => body)
end

def delete_object(object)
add_request('method' => 'DELETE',
'path' => Parse::Protocol.class_uri(object.class_name, object.id))
add_request(
'method' => 'DELETE', 'path' => class_uri(object.class_name, object.id))
end

def class_uri(*args)
::File.join(client.path, Parse::Protocol.class_uri(*args))
end

def run!
Expand Down

0 comments on commit 822738f

Please sign in to comment.