parse-stack 1.7.3 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +36 -0
  3. data/.solargraph.yml +23 -0
  4. data/.travis.yml +6 -3
  5. data/Changes.md +84 -22
  6. data/Gemfile +14 -12
  7. data/Gemfile.lock +110 -60
  8. data/README.md +67 -24
  9. data/Rakefile +14 -14
  10. data/bin/parse-console +1 -0
  11. data/lib/parse/api/aggregate.rb +59 -0
  12. data/lib/parse/api/all.rb +2 -1
  13. data/lib/parse/api/analytics.rb +0 -3
  14. data/lib/parse/api/batch.rb +3 -5
  15. data/lib/parse/api/cloud_functions.rb +0 -3
  16. data/lib/parse/api/config.rb +0 -4
  17. data/lib/parse/api/files.rb +3 -7
  18. data/lib/parse/api/hooks.rb +4 -8
  19. data/lib/parse/api/objects.rb +9 -14
  20. data/lib/parse/api/push.rb +0 -4
  21. data/lib/parse/api/schema.rb +2 -6
  22. data/lib/parse/api/server.rb +4 -7
  23. data/lib/parse/api/sessions.rb +2 -5
  24. data/lib/parse/api/users.rb +9 -14
  25. data/lib/parse/client.rb +55 -50
  26. data/lib/parse/client/authentication.rb +29 -33
  27. data/lib/parse/client/batch.rb +8 -11
  28. data/lib/parse/client/body_builder.rb +19 -20
  29. data/lib/parse/client/caching.rb +23 -28
  30. data/lib/parse/client/protocol.rb +11 -12
  31. data/lib/parse/client/request.rb +4 -6
  32. data/lib/parse/client/response.rb +5 -7
  33. data/lib/parse/model/acl.rb +14 -12
  34. data/lib/parse/model/associations/belongs_to.rb +19 -24
  35. data/lib/parse/model/associations/collection_proxy.rb +328 -317
  36. data/lib/parse/model/associations/has_many.rb +22 -27
  37. data/lib/parse/model/associations/has_one.rb +7 -12
  38. data/lib/parse/model/associations/pointer_collection_proxy.rb +5 -13
  39. data/lib/parse/model/associations/relation_collection_proxy.rb +5 -9
  40. data/lib/parse/model/bytes.rb +8 -10
  41. data/lib/parse/model/classes/installation.rb +2 -4
  42. data/lib/parse/model/classes/product.rb +2 -5
  43. data/lib/parse/model/classes/role.rb +3 -5
  44. data/lib/parse/model/classes/session.rb +2 -5
  45. data/lib/parse/model/classes/user.rb +21 -17
  46. data/lib/parse/model/core/actions.rb +31 -46
  47. data/lib/parse/model/core/builder.rb +6 -6
  48. data/lib/parse/model/core/errors.rb +0 -1
  49. data/lib/parse/model/core/fetching.rb +45 -50
  50. data/lib/parse/model/core/properties.rb +53 -68
  51. data/lib/parse/model/core/querying.rb +292 -282
  52. data/lib/parse/model/core/schema.rb +89 -92
  53. data/lib/parse/model/date.rb +16 -23
  54. data/lib/parse/model/file.rb +171 -174
  55. data/lib/parse/model/geopoint.rb +12 -16
  56. data/lib/parse/model/model.rb +31 -37
  57. data/lib/parse/model/object.rb +58 -70
  58. data/lib/parse/model/pointer.rb +177 -176
  59. data/lib/parse/model/push.rb +8 -10
  60. data/lib/parse/model/shortnames.rb +1 -2
  61. data/lib/parse/model/time_zone.rb +3 -5
  62. data/lib/parse/query.rb +70 -37
  63. data/lib/parse/query/constraint.rb +4 -6
  64. data/lib/parse/query/constraints.rb +62 -20
  65. data/lib/parse/query/operation.rb +8 -11
  66. data/lib/parse/query/ordering.rb +45 -49
  67. data/lib/parse/stack.rb +15 -11
  68. data/lib/parse/stack/generators/rails.rb +28 -30
  69. data/lib/parse/stack/generators/templates/model.erb +5 -6
  70. data/lib/parse/stack/generators/templates/model_installation.rb +0 -1
  71. data/lib/parse/stack/generators/templates/model_role.rb +0 -1
  72. data/lib/parse/stack/generators/templates/model_session.rb +0 -1
  73. data/lib/parse/stack/generators/templates/model_user.rb +0 -1
  74. data/lib/parse/stack/generators/templates/parse.rb +9 -9
  75. data/lib/parse/stack/generators/templates/webhooks.rb +1 -2
  76. data/lib/parse/stack/railtie.rb +2 -4
  77. data/lib/parse/stack/tasks.rb +70 -86
  78. data/lib/parse/stack/version.rb +1 -1
  79. data/lib/parse/webhooks.rb +19 -26
  80. data/lib/parse/webhooks/payload.rb +26 -28
  81. data/lib/parse/webhooks/registration.rb +23 -31
  82. data/parse-stack.gemspec +28 -28
  83. data/parse-stack.png +0 -0
  84. metadata +27 -25
  85. data/.github/parse-ruby-sdk.png +0 -0
@@ -1,11 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'active_support'
5
- require 'active_support/core_ext'
4
+ require "active_support"
5
+ require "active_support/core_ext"
6
6
 
7
7
  module Parse
8
-
9
8
  module API
10
9
  # REST API methods for fetching CRUD operations on Parse objects.
11
10
  module Objects
@@ -15,10 +14,9 @@ module Parse
15
14
 
16
15
  # @!visibility private
17
16
  PREFIX_MAP = { installation: "installations", _installation: "installations",
18
- user: "users", _user: "users",
19
- role: "roles", _role: "roles",
20
- session: "sessions", _session: "sessions"
21
- }.freeze
17
+ user: "users", _user: "users",
18
+ role: "roles", _role: "roles",
19
+ session: "sessions", _session: "sessions" }.freeze
22
20
 
23
21
  # @!visibility private
24
22
  def self.included(base)
@@ -39,11 +37,10 @@ module Parse
39
37
  uri = "#{CLASS_PATH_PREFIX}#{className}"
40
38
  class_prefix = className.downcase.to_sym
41
39
  if PREFIX_MAP.has_key?(class_prefix)
42
- uri = "#{PREFIX_MAP[class_prefix]}/"
40
+ uri = PREFIX_MAP[class_prefix]
43
41
  end
44
- id.present? ? "#{uri}/#{id}" : uri
42
+ id.present? ? "#{uri}/#{id}" : "#{uri}/"
45
43
  end
46
-
47
44
  end
48
45
 
49
46
  # Get the API path for this class.
@@ -61,7 +58,7 @@ module Parse
61
58
  # @param headers [Hash] additional HTTP headers to send with the request.
62
59
  # @return [Parse::Response]
63
60
  def create_object(className, body = {}, headers: {}, **opts)
64
- response = request :post, uri_path(className) , body: body, headers: headers, opts: opts
61
+ response = request :post, uri_path(className), body: body, headers: headers, opts: opts
65
62
  response.parse_class = className if response.present?
66
63
  response
67
64
  end
@@ -111,12 +108,10 @@ module Parse
111
108
  # @param headers [Hash] additional HTTP headers to send with the request.
112
109
  # @return [Parse::Response]
113
110
  def update_object(className, id, body = {}, headers: {}, **opts)
114
- response = request :put, uri_path(className,id) , body: body, headers: headers, opts: opts
111
+ response = request :put, uri_path(className, id), body: body, headers: headers, opts: opts
115
112
  response.parse_class = className if response.present?
116
113
  response
117
114
  end
118
-
119
115
  end #Objects
120
116
  end #API
121
-
122
117
  end
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Parse
5
-
6
5
  module API
7
6
  # Defines the Parse Push notification service interface for the Parse REST API
8
7
  module Push
@@ -16,9 +15,6 @@ module Parse
16
15
  def push(payload = {})
17
16
  request :post, PUSH_PATH, body: payload.as_json
18
17
  end
19
-
20
18
  end
21
-
22
19
  end
23
-
24
20
  end
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Parse
5
-
6
5
  module API
7
6
  # Defines the Schema interface for the Parse REST API
8
7
  module Schema
@@ -12,7 +11,7 @@ module Parse
12
11
  # Get all the schemas for the application.
13
12
  # @return [Parse::Response]
14
13
  def schemas
15
- opts = {cache: false}
14
+ opts = { cache: false }
16
15
  request :get, SCHEMAS_PATH, opts: opts
17
16
  end
18
17
 
@@ -20,7 +19,7 @@ module Parse
20
19
  # @param className [String] the name of the remote Parse collection.
21
20
  # @return [Parse::Response]
22
21
  def schema(className)
23
- opts = {cache: false}
22
+ opts = { cache: false }
24
23
  request :get, "#{SCHEMAS_PATH}/#{className}", opts: opts
25
24
  end
26
25
 
@@ -41,9 +40,6 @@ module Parse
41
40
  def update_schema(className, schema)
42
41
  request :put, "#{SCHEMAS_PATH}/#{className}", body: schema
43
42
  end
44
-
45
43
  end #Schema
46
-
47
44
  end #API
48
-
49
45
  end
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Parse
5
-
6
5
  module API
7
6
  # APIs related to the open source Parse Server.
8
7
  module Server
@@ -12,9 +11,9 @@ module Parse
12
11
  attr_accessor :server_info
13
12
 
14
13
  # @!visibility private
15
- SERVER_INFO_PATH = 'serverInfo'
14
+ SERVER_INFO_PATH = "serverInfo"
16
15
  # @!visibility private
17
- SERVER_HEALTH_PATH = 'health'
16
+ SERVER_HEALTH_PATH = "health"
18
17
  # Fetch and cache information about the Parse server configuration. This
19
18
  # hash contains information specifically to the configuration of the running
20
19
  # parse server.
@@ -23,13 +22,13 @@ module Parse
23
22
  return @server_info if @server_info.present?
24
23
  response = request :get, SERVER_INFO_PATH
25
24
  @server_info = response.error? ? nil :
26
- response.result.with_indifferent_access
25
+ response.result.with_indifferent_access
27
26
  end
28
27
 
29
28
  # Fetches the status of the server based on the health check.
30
29
  # @return [Boolean] whether the server is 'OK'.
31
30
  def server_health
32
- opts = {cache: false}
31
+ opts = { cache: false }
33
32
  response = request :get, SERVER_HEALTH_PATH, opts: opts
34
33
  response.success?
35
34
  end
@@ -46,8 +45,6 @@ module Parse
46
45
  def server_version
47
46
  server_info.present? ? @server_info[:parseServerVersion] : nil
48
47
  end
49
-
50
48
  end
51
49
  end
52
-
53
50
  end
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Parse
5
-
6
5
  module API
7
6
  # Defines the Session class interface for the Parse REST API
8
7
  module Sessions
@@ -14,14 +13,12 @@ module Parse
14
13
  # @param opts [Hash] additional options to pass to the {Parse::Client} request.
15
14
  # @return [Parse::Response]
16
15
  def fetch_session(session_token, **opts)
17
- opts.merge!({use_master_key: false, cache: false})
18
- headers = {Parse::Protocol::SESSION_TOKEN => session_token}
16
+ opts.merge!({ use_master_key: false, cache: false })
17
+ headers = { Parse::Protocol::SESSION_TOKEN => session_token }
19
18
  response = request :get, "#{SESSION_PATH_PREFIX}/me", headers: headers, opts: opts
20
19
  response.parse_class = Parse::Model::CLASS_SESSION
21
20
  response
22
21
  end
23
-
24
22
  end
25
23
  end
26
-
27
24
  end
@@ -1,10 +1,9 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'open-uri'
4
+ require "open-uri"
5
5
 
6
6
  module Parse
7
-
8
7
  module API
9
8
  # Defines the User class interface for the Parse REST API
10
9
  module Users
@@ -42,7 +41,7 @@ module Parse
42
41
  # @param headers [Hash] additional HTTP headers to send with the request.
43
42
  # @return [Parse::Response]
44
43
  def current_user(session_token, headers: {}, **opts)
45
- headers.merge!({Parse::Protocol::SESSION_TOKEN => session_token})
44
+ headers.merge!({ Parse::Protocol::SESSION_TOKEN => session_token })
46
45
  response = request :get, "#{USER_PATH_PREFIX}/me", headers: headers, opts: opts
47
46
  response.parse_class = Parse::Model::CLASS_USER
48
47
  response
@@ -54,9 +53,9 @@ module Parse
54
53
  # @param headers [Hash] additional HTTP headers to send with the request.
55
54
  # @return [Parse::Response]
56
55
  def create_user(body, headers: {}, **opts)
57
- headers.merge!({ Parse::Protocol::REVOCABLE_SESSION => '1'})
56
+ headers.merge!({ Parse::Protocol::REVOCABLE_SESSION => "1" })
58
57
  if opts[:session_token].present?
59
- headers.merge!({ Parse::Protocol::SESSION_TOKEN => opts[:session_token]})
58
+ headers.merge!({ Parse::Protocol::SESSION_TOKEN => opts[:session_token] })
60
59
  end
61
60
  response = request :post, USER_PATH_PREFIX, body: body, headers: headers, opts: opts
62
61
  response.parse_class = Parse::Model::CLASS_USER
@@ -102,8 +101,8 @@ module Parse
102
101
  # @param opts [Hash] additional options to pass to the {Parse::Client} request.
103
102
  # @param headers [Hash] additional HTTP headers to send with the request.
104
103
  # @return [Parse::Response]
105
- def request_password_reset(email, headers: {}, **opts)
106
- body = {email: email}
104
+ def request_password_reset(email, headers: {}, **opts)
105
+ body = { email: email }
107
106
  request :post, REQUEST_PASSWORD_RESET, body: body, opts: opts, headers: headers
108
107
  end
109
108
 
@@ -116,7 +115,7 @@ module Parse
116
115
  def login(username, password, headers: {}, **opts)
117
116
  # Probably pass Installation-ID as header
118
117
  query = { username: username, password: password }
119
- headers.merge!({ Parse::Protocol::REVOCABLE_SESSION => '1'})
118
+ headers.merge!({ Parse::Protocol::REVOCABLE_SESSION => "1" })
120
119
  # headers.merge!( { Parse::Protocol::INSTALLATION_ID => ''} )
121
120
  response = request :get, LOGIN_PATH, query: query, headers: headers, opts: opts
122
121
  response.parse_class = Parse::Model::CLASS_USER
@@ -129,8 +128,8 @@ module Parse
129
128
  # @param opts [Hash] additional options to pass to the {Parse::Client} request.
130
129
  # @return [Parse::Response]
131
130
  def logout(session_token, headers: {}, **opts)
132
- headers.merge!({ Parse::Protocol::SESSION_TOKEN => session_token})
133
- opts.merge!({use_master_key: false, session_token: session_token})
131
+ headers.merge!({ Parse::Protocol::SESSION_TOKEN => session_token })
132
+ opts.merge!({ use_master_key: false, session_token: session_token })
134
133
  request :post, LOGOUT_PATH, headers: headers, opts: opts
135
134
  end
136
135
 
@@ -146,10 +145,6 @@ module Parse
146
145
  body[:email] = email || body[:email]
147
146
  create_user(body, opts)
148
147
  end
149
-
150
-
151
148
  end # Users
152
-
153
149
  end #API
154
-
155
150
  end #Parse
@@ -1,15 +1,15 @@
1
- require 'faraday'
2
- require 'faraday_middleware'
3
- require 'active_support'
4
- require 'moneta'
5
- require 'active_model_serializers'
6
- require 'active_support/inflector'
7
- require 'active_support/core_ext/object'
8
- require 'active_support/core_ext/string'
9
- require 'active_support/core_ext/date/calculations'
10
- require 'active_support/core_ext/date_time/calculations'
11
- require 'active_support/core_ext/time/calculations'
12
- require 'active_support/core_ext'
1
+ require "faraday"
2
+ require "faraday_middleware"
3
+ require "active_support"
4
+ require "moneta"
5
+ require "active_model_serializers"
6
+ require "active_support/inflector"
7
+ require "active_support/core_ext/object"
8
+ require "active_support/core_ext/string"
9
+ require "active_support/core_ext/date/calculations"
10
+ require "active_support/core_ext/date_time/calculations"
11
+ require "active_support/core_ext/time/calculations"
12
+ require "active_support/core_ext"
13
13
  require_relative "client/request"
14
14
  require_relative "client/response"
15
15
  require_relative "client/batch"
@@ -21,21 +21,28 @@ require_relative "api/all"
21
21
  module Parse
22
22
  class Error < StandardError
23
23
  # An error when a general connection occurs.
24
- class ConnectionError < Error; end;
24
+ class ConnectionError < Error; end
25
+
25
26
  # An error when a connection timeout occurs.
26
- class TimeoutError < Error; end;
27
+ class TimeoutError < Error; end
28
+
27
29
  # An error when there is an Parse REST API protocol error.
28
- class ProtocolError < Error; end;
30
+ class ProtocolError < Error; end
31
+
29
32
  # An error when the Parse server returned invalid code.
30
- class ServerError < Error; end;
33
+ class ServerError < Error; end
34
+
31
35
  # An error when a Parse server responds with HTTP 500.
32
- class ServiceUnavailableError < Error; end;
36
+ class ServiceUnavailableError < Error; end
37
+
33
38
  # An error when the authentication credentials in the request are invalid.
34
- class AuthenticationError < Error; end;
39
+ class AuthenticationError < Error; end
40
+
35
41
  # An error when the burst limit has been exceeded.
36
- class RequestLimitExceededError < Error; end;
42
+ class RequestLimitExceededError < Error; end
43
+
37
44
  # An error when the session token provided in the request is invalid.
38
- class InvalidSessionTokenError < Error; end;
45
+ class InvalidSessionTokenError < Error; end
39
46
  end
40
47
 
41
48
  # Retrieve the App specific Parse configuration parameters. The configuration
@@ -107,6 +114,7 @@ module Parse
107
114
  # features you'd like to implement.
108
115
  class Client
109
116
  include Parse::API::Analytics
117
+ include Parse::API::Aggregate
110
118
  include Parse::API::Batch
111
119
  include Parse::API::CloudFunctions
112
120
  include Parse::API::Config
@@ -128,7 +136,7 @@ module Parse
128
136
  RETRY_DELAY = 1.5
129
137
 
130
138
  # An error when a general response error occurs when communicating with Parse server.
131
- class ResponseError < Parse::Error; end;
139
+ class ResponseError < Parse::Error; end
132
140
 
133
141
  # @!attribute cache
134
142
  # The underlying cache store for caching API requests.
@@ -197,7 +205,6 @@ module Parse
197
205
  def setup(opts = {})
198
206
  @clients[:default] = self.new(opts, &Proc.new)
199
207
  end
200
-
201
208
  end
202
209
 
203
210
  # Create a new client connected to the Parse Server REST API endpoint.
@@ -241,16 +248,16 @@ module Parse
241
248
  # @see Parse::Middleware::Authentication
242
249
  # @see Parse::Protocol
243
250
  def initialize(opts = {})
244
- @server_url = opts[:server_url] || ENV["PARSE_SERVER_URL"] || Parse::Protocol::SERVER_URL
245
- @application_id = opts[:application_id] || opts[:app_id] || ENV["PARSE_SERVER_APPLICATION_ID"] || ENV['PARSE_APP_ID']
246
- @api_key = opts[:api_key] || opts[:rest_api_key] || ENV["PARSE_SERVER_REST_API_KEY"] || ENV["PARSE_API_KEY"]
247
- @master_key = opts[:master_key] || ENV['PARSE_SERVER_MASTER_KEY'] || ENV["PARSE_MASTER_KEY"]
251
+ @server_url = opts[:server_url] || ENV["PARSE_SERVER_URL"] || Parse::Protocol::SERVER_URL
252
+ @application_id = opts[:application_id] || opts[:app_id] || ENV["PARSE_SERVER_APPLICATION_ID"] || ENV["PARSE_APP_ID"]
253
+ @api_key = opts[:api_key] || opts[:rest_api_key] || ENV["PARSE_SERVER_REST_API_KEY"] || ENV["PARSE_API_KEY"]
254
+ @master_key = opts[:master_key] || ENV["PARSE_SERVER_MASTER_KEY"] || ENV["PARSE_MASTER_KEY"]
248
255
  opts[:adapter] ||= Faraday.default_adapter
249
256
  opts[:expires] ||= 3
250
- if @server_url.nil? || @application_id.nil? || ( @api_key.nil? && @master_key.nil? )
257
+ if @server_url.nil? || @application_id.nil? || (@api_key.nil? && @master_key.nil?)
251
258
  raise Parse::Error::ConnectionError, "Please call Parse.setup(server_url:, application_id:, api_key:) to setup a client"
252
259
  end
253
- @server_url += '/' unless @server_url.ends_with?('/')
260
+ @server_url += "/" unless @server_url.ends_with?("/")
254
261
  #Configure Faraday
255
262
  opts[:faraday] ||= {}
256
263
  opts[:faraday].merge!(:url => @server_url)
@@ -266,9 +273,9 @@ module Parse
266
273
  # so that other middlewares have access to the env that is being set by
267
274
  # this middleware. First added is first to brocess.
268
275
  conn.use Parse::Middleware::Authentication,
269
- application_id: @application_id,
270
- master_key: @master_key,
271
- api_key: @api_key
276
+ application_id: @application_id,
277
+ master_key: @master_key,
278
+ api_key: @api_key
272
279
  # This middleware turns the result from Parse into a Parse::Response object
273
280
  # and making sure request that are going out, follow the proper MIME format.
274
281
  # We place it after the Authentication middleware in case we need to use then
@@ -293,13 +300,12 @@ module Parse
293
300
  raise ArgumentError, "Parse::Client option :cache needs to be a type of Moneta store"
294
301
  end
295
302
  self.cache = opts[:cache]
296
- conn.use Parse::Middleware::Caching, self.cache, {expires: opts[:expires].to_i }
303
+ conn.use Parse::Middleware::Caching, self.cache, { expires: opts[:expires].to_i }
297
304
  end
298
305
 
299
306
  yield(conn) if block_given?
300
307
 
301
308
  conn.adapter opts[:adapter]
302
-
303
309
  end
304
310
  Parse::Client.clients[:default] ||= self
305
311
  end
@@ -382,11 +388,11 @@ module Parse
382
388
  # if the first argument is a Parse::Request object, then construct it
383
389
  _request = nil
384
390
  if method.is_a?(Request)
385
- _request = method
386
- method = _request.method
387
- uri ||= _request.path
388
- query ||= _request.query
389
- body ||= _request.body
391
+ _request = method
392
+ method = _request.method
393
+ uri ||= _request.path
394
+ query ||= _request.query
395
+ body ||= _request.body
390
396
  headers.merge! _request.headers
391
397
  else
392
398
  _request = Parse::Request.new(method, uri, body: body, headers: headers, opts: opts)
@@ -470,7 +476,7 @@ module Parse
470
476
  warn "[Parse:Retry] Retries remaining #{_retry_count} : #{response.request}"
471
477
  _retry_count -= 1
472
478
  backoff_delay = RETRY_DELAY * (self.retry_limit - _retry_count)
473
- _retry_delay = [0,RETRY_DELAY, backoff_delay].sample
479
+ _retry_delay = [0, RETRY_DELAY, backoff_delay].sample
474
480
  sleep _retry_delay if _retry_delay > 0
475
481
  retry
476
482
  end
@@ -480,7 +486,7 @@ module Parse
480
486
  warn "[Parse:Retry] Retries remaining #{_retry_count} : #{_request}"
481
487
  _retry_count -= 1
482
488
  backoff_delay = RETRY_DELAY * (self.retry_limit - _retry_count)
483
- _retry_delay = [0,RETRY_DELAY, backoff_delay].sample
489
+ _retry_delay = [0, RETRY_DELAY, backoff_delay].sample
484
490
  sleep _retry_delay if _retry_delay > 0
485
491
  retry
486
492
  end
@@ -501,7 +507,7 @@ module Parse
501
507
  # @param body [Hash] a hash that will be JSON encoded for the body of this request.
502
508
  # @param headers (see #get)
503
509
  # @return (see #request)
504
- def post(uri, body = nil, headers = {} )
510
+ def post(uri, body = nil, headers = {})
505
511
  request :post, uri, body: body, headers: headers
506
512
  end
507
513
 
@@ -546,18 +552,18 @@ module Parse
546
552
  # a the default {Parse::Client} instance.
547
553
  module ClassMethods
548
554
 
549
- # @return [Parse::Client] the current client for :default.
550
- attr_accessor :client
551
- def client
552
- @client ||= Parse::Client.client #defaults to :default tag
553
- end
555
+ # @return [Parse::Client] the current client for :default.
556
+ attr_accessor :client
557
+
558
+ def client
559
+ @client ||= Parse::Client.client #defaults to :default tag
560
+ end
554
561
  end
555
562
 
556
563
  # @return [Parse::Client] the current client defined for the class.
557
564
  def client
558
565
  self.class.client
559
566
  end
560
-
561
567
  end #Connectable
562
568
  end
563
569
 
@@ -587,7 +593,7 @@ module Parse
587
593
  # @param opts (see Parse.call_function)
588
594
  # @return (see Parse.call_function)
589
595
  def self.trigger_job(name, body = {}, **opts)
590
- conn = opts[:session] || opts[:client] || :default
596
+ conn = opts[:session] || opts[:client] || :default
591
597
  response = Parse::Client.client(conn).trigger_job(name, body)
592
598
  return response if opts[:raw].present?
593
599
  response.error? ? nil : response.result["result"]
@@ -599,10 +605,9 @@ module Parse
599
605
  # @param opts [Hash] additional options.
600
606
  # @return [Object] the result data of the response. nil if there was an error.
601
607
  def self.call_function(name, body = {}, **opts)
602
- conn = opts[:session] || opts[:client] || :default
608
+ conn = opts[:session] || opts[:client] || :default
603
609
  response = Parse::Client.client(conn).call_function(name, body)
604
610
  return response if opts[:raw].present?
605
611
  response.error? ? nil : response.result["result"]
606
612
  end
607
-
608
613
  end