Skip to content

Commit

Permalink
[#62] Separate positional and keyword arguments for Ruby 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
apersaud committed May 4, 2021
1 parent 443b4d9 commit 54e2514
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/parse/api/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def update_user(id, body = {}, headers: {}, **opts)
# @return [Parse::Response]
def set_service_auth_data(id, service_name, auth_data, headers: {}, **opts)
body = { authData: { service_name => auth_data } }
update_user(id, body, opts)
update_user(id, body, **opts)
end

# Delete a {Parse::User} record given an objectId.
Expand Down Expand Up @@ -143,7 +143,7 @@ def logout(session_token, headers: {}, **opts)
def signup(username, password, email = nil, body: {}, **opts)
body = body.merge({ username: username, password: password })
body[:email] = email || body[:email]
create_user(body, opts)
create_user(body, **opts)
end
end # Users
end #API
Expand Down
2 changes: 1 addition & 1 deletion lib/parse/model/associations/has_many.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def has_many(key, scope = nil, **opts)
opts[:through] ||= :query

if opts[:through] == :query
return has_many_queried(key, scope, opts)
return has_many_queried(key, scope, **opts)
end

# below this is the same
Expand Down
2 changes: 1 addition & 1 deletion lib/parse/model/classes/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Session < Parse::Object
# @param token [String] the session token
# @return [Session] the session for this token, otherwise nil.
def self.session(token, **opts)
response = client.fetch_session(token, opts)
response = client.fetch_session(token, **opts)
if response.success?
return Parse::Session.build response.result
end
Expand Down
2 changes: 1 addition & 1 deletion lib/parse/model/classes/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def self.session(token, opts = {})
def self.session!(token, opts = {})
# support Parse::Session objects
token = token.session_token if token.respond_to?(:session_token)
response = client.current_user(token, opts)
response = client.current_user(token, **opts)
response.success? ? Parse::User.build(response.result) : nil
end

Expand Down
2 changes: 1 addition & 1 deletion lib/parse/model/core/fetching.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Fetching
# @param opts [Hash] a set of options to pass to the client request.
# @return [self] the current object, useful for chaining.
def fetch!(opts = {})
response = client.fetch_object(parse_class, id, opts)
response = client.fetch_object(parse_class, id, **opts)
if response.error?
puts "[Fetch Error] #{response.code}: #{response.error}"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/parse/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def distinct(field)
compile_query[:distinct] = Query.format_field(field).to_sym
@count = old_count_value
# perform aggregation
return client.aggregate_objects(@table, compile_query.as_json, _opts).result
return client.aggregate_objects(@table, compile_query.as_json, **_opts).result
else
raise ArgumentError, "Invalid field name passed to `distinct`."
end
Expand All @@ -654,7 +654,7 @@ def distinct(field)
def count
old_value = @count
@count = 1
res = client.find_objects(@table, compile.as_json, _opts).count
res = client.find_objects(@table, compile.as_json, **_opts).count
@count = old_value
res
end
Expand Down Expand Up @@ -766,7 +766,7 @@ def _opts
# @param compiled_query [Hash] the compiled query
# @return [Parse::Response] a response for a query request.
def fetch!(compiled_query)
response = client.find_objects(@table, compiled_query.as_json, _opts)
response = client.find_objects(@table, compiled_query.as_json, **_opts)
if response.error?
puts "[ParseQuery] #{response.error}"
end
Expand Down

0 comments on commit 54e2514

Please sign in to comment.