parse-stack 1.4.3 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +52 -39
- data/Gemfile.lock +2 -2
- data/README.md +609 -124
- data/bin/console +0 -9
- data/lib/parse/api/all.rb +3 -0
- data/lib/parse/api/analytics.rb +2 -2
- data/lib/parse/api/apps.rb +15 -17
- data/lib/parse/api/batch.rb +4 -1
- data/lib/parse/api/cloud_functions.rb +2 -0
- data/lib/parse/api/config.rb +14 -2
- data/lib/parse/api/files.rb +6 -3
- data/lib/parse/api/hooks.rb +4 -4
- data/lib/parse/api/objects.rb +14 -11
- data/lib/parse/api/push.rb +4 -2
- data/lib/parse/api/schemas.rb +6 -5
- data/lib/parse/api/sessions.rb +11 -1
- data/lib/parse/api/users.rb +65 -15
- data/lib/parse/client/authentication.rb +4 -2
- data/lib/parse/client/body_builder.rb +11 -3
- data/lib/parse/client/caching.rb +17 -6
- data/lib/parse/client/protocol.rb +14 -8
- data/lib/parse/client/request.rb +4 -1
- data/lib/parse/client/response.rb +59 -6
- data/lib/parse/client.rb +72 -42
- data/lib/parse/model/acl.rb +22 -4
- data/lib/parse/model/associations/belongs_to.rb +22 -10
- data/lib/parse/model/associations/collection_proxy.rb +14 -1
- data/lib/parse/model/associations/has_many.rb +76 -15
- data/lib/parse/model/associations/has_one.rb +69 -0
- data/lib/parse/model/associations/pointer_collection_proxy.rb +13 -6
- data/lib/parse/model/associations/relation_collection_proxy.rb +5 -2
- data/lib/parse/model/bytes.rb +6 -2
- data/lib/parse/model/classes/installation.rb +27 -0
- data/lib/parse/model/classes/role.rb +20 -0
- data/lib/parse/model/classes/session.rb +26 -0
- data/lib/parse/model/classes/user.rb +185 -0
- data/lib/parse/model/core/actions.rb +40 -26
- data/lib/parse/model/core/properties.rb +126 -20
- data/lib/parse/model/core/querying.rb +63 -3
- data/lib/parse/model/core/schema.rb +9 -6
- data/lib/parse/model/date.rb +5 -1
- data/lib/parse/model/file.rb +12 -9
- data/lib/parse/model/geopoint.rb +6 -4
- data/lib/parse/model/model.rb +29 -21
- data/lib/parse/model/object.rb +29 -76
- data/lib/parse/model/pointer.rb +8 -6
- data/lib/parse/model/push.rb +4 -1
- data/lib/parse/query/constraint.rb +3 -0
- data/lib/parse/query/constraints.rb +6 -3
- data/lib/parse/query/operation.rb +3 -0
- data/lib/parse/query/ordering.rb +3 -0
- data/lib/parse/query.rb +85 -38
- data/lib/parse/stack/generators/rails.rb +3 -0
- data/lib/parse/stack/railtie.rb +2 -0
- data/lib/parse/stack/tasks.rb +4 -1
- data/lib/parse/stack/version.rb +4 -1
- data/lib/parse/stack.rb +3 -0
- data/lib/parse/webhooks/payload.rb +14 -8
- data/lib/parse/webhooks/registration.rb +11 -8
- data/lib/parse/webhooks.rb +11 -8
- data/lib/parse-stack.rb +3 -0
- data/parse-stack.gemspec +10 -8
- metadata +16 -4
@@ -1,3 +1,6 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
1
4
|
require 'active_support'
|
2
5
|
require 'active_support/inflector'
|
3
6
|
require 'active_support/core_ext/object'
|
@@ -27,9 +30,9 @@ module Parse
|
|
27
30
|
client.triggers.results.sort_by { |f| [f['triggerName'],f['className']] }.each do |f|
|
28
31
|
next unless f["url"].present?
|
29
32
|
triggerName = f["triggerName"]
|
30
|
-
className = f[
|
33
|
+
className = f[Parse::Model::KEY_CLASS_NAME]
|
31
34
|
client.delete_trigger triggerName, className
|
32
|
-
yield(f['triggerName'], f[
|
35
|
+
yield(f['triggerName'], f[Parse::Model::KEY_CLASS_NAME]) if block_given?
|
33
36
|
end
|
34
37
|
|
35
38
|
end
|
@@ -37,7 +40,7 @@ module Parse
|
|
37
40
|
def register_functions!(endpoint)
|
38
41
|
|
39
42
|
unless endpoint.present? && endpoint.starts_with?('https://')
|
40
|
-
raise "The HOOKS_URL must be https: '#{endpoint}''"
|
43
|
+
raise ArgumentError, "The HOOKS_URL must be https: '#{endpoint}''"
|
41
44
|
end
|
42
45
|
endpoint += '/' unless endpoint.ends_with?('/')
|
43
46
|
functionsMap = {}
|
@@ -62,7 +65,7 @@ module Parse
|
|
62
65
|
def register_triggers!(endpoint, include_wildcard: false)
|
63
66
|
|
64
67
|
unless endpoint.present? && endpoint.starts_with?('https://')
|
65
|
-
raise "The HOOKS_URL must be https: '#{endpoint}''"
|
68
|
+
raise ArgumentError, "The HOOKS_URL must be https: '#{endpoint}''"
|
66
69
|
end
|
67
70
|
endpoint += '/' unless endpoint.ends_with?('/')
|
68
71
|
|
@@ -89,7 +92,7 @@ module Parse
|
|
89
92
|
end
|
90
93
|
|
91
94
|
classNames.sort.each do |className|
|
92
|
-
next if className == '*'
|
95
|
+
next if className == '*'
|
93
96
|
url = endpoint + "#{trigger}/#{className}"
|
94
97
|
if current_triggers[trigger][className].present? #then you may need to update
|
95
98
|
next if current_triggers[trigger][className] == url
|
@@ -105,13 +108,13 @@ module Parse
|
|
105
108
|
|
106
109
|
def register_webhook!(trigger, name, url)
|
107
110
|
trigger = trigger.to_s.camelize(:lower).to_sym
|
108
|
-
raise "Invalid hook trigger #{trigger}" unless ALLOWED_HOOKS.include?(trigger)
|
111
|
+
raise ArgumentError, "Invalid hook trigger #{trigger}" unless ALLOWED_HOOKS.include?(trigger)
|
109
112
|
if trigger == :function
|
110
113
|
response = client.fetch_function(name)
|
111
114
|
# if it is either an error (which has no results) or there is a result but
|
112
115
|
# no registered item with a URL (which implies either none registered or only cloud code registered)
|
113
116
|
# then create it.
|
114
|
-
if response.results.none? { |d| d.has_key?("url"
|
117
|
+
if response.results.none? { |d| d.has_key?("url") }
|
115
118
|
response = client.create_function(name, url)
|
116
119
|
else
|
117
120
|
# update it
|
@@ -126,7 +129,7 @@ module Parse
|
|
126
129
|
# if it is either an error (which has no results) or there is a result but
|
127
130
|
# no registered item with a URL (which implies either none registered or only cloud code registered)
|
128
131
|
# then create it.
|
129
|
-
if response.results.none? { |d| d.has_key?("url"
|
132
|
+
if response.results.none? { |d| d.has_key?("url") }
|
130
133
|
# create it
|
131
134
|
response = client.create_trigger(trigger, name, url)
|
132
135
|
else
|
data/lib/parse/webhooks.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
1
4
|
require 'active_model'
|
2
5
|
require 'active_support'
|
3
6
|
require 'active_support/inflector'
|
@@ -53,7 +56,7 @@ module Parse
|
|
53
56
|
|
54
57
|
if type == :function
|
55
58
|
unless block.is_a?(String) || block.is_a?(Symbol)
|
56
|
-
raise "Invalid Cloud Code function name: #{block}"
|
59
|
+
raise ArgumentError, "Invalid Cloud Code function name: #{block}"
|
57
60
|
end
|
58
61
|
Parse::Webhooks.route(:function, block, &Proc.new)
|
59
62
|
# then block must be a symbol or a string
|
@@ -76,7 +79,7 @@ module Parse
|
|
76
79
|
end
|
77
80
|
end
|
78
81
|
|
79
|
-
class WebhookErrorResponse <
|
82
|
+
class WebhookErrorResponse < StandardError; end;
|
80
83
|
class Webhooks
|
81
84
|
|
82
85
|
def self.reload!(args = {})
|
@@ -86,9 +89,9 @@ module Parse
|
|
86
89
|
include Client::Connectable
|
87
90
|
extend Webhook::Registration
|
88
91
|
|
89
|
-
HTTP_PARSE_WEBHOOK = "HTTP_X_PARSE_WEBHOOK_KEY"
|
90
|
-
HTTP_PARSE_APPLICATION_ID = "HTTP_X_PARSE_APPLICATION_ID"
|
91
|
-
CONTENT_TYPE = "application/json"
|
92
|
+
HTTP_PARSE_WEBHOOK = "HTTP_X_PARSE_WEBHOOK_KEY"
|
93
|
+
HTTP_PARSE_APPLICATION_ID = "HTTP_X_PARSE_APPLICATION_ID"
|
94
|
+
CONTENT_TYPE = "application/json"
|
92
95
|
attr_accessor :key
|
93
96
|
class << self
|
94
97
|
attr_accessor :logging
|
@@ -108,7 +111,7 @@ module Parse
|
|
108
111
|
className = className.to_s
|
109
112
|
block = Proc.new if block_given?
|
110
113
|
if routes[type].nil? || block.respond_to?(:call) == false
|
111
|
-
raise "Invalid Webhook registration trigger #{type} #{className}"
|
114
|
+
raise ArgumentError, "Invalid Webhook registration trigger #{type} #{className}"
|
112
115
|
end
|
113
116
|
|
114
117
|
# AfterSave/AfterDelete hooks support more than one
|
@@ -189,7 +192,7 @@ module Parse
|
|
189
192
|
request.body.rewind
|
190
193
|
begin
|
191
194
|
payload = Parse::Payload.new request.body.read
|
192
|
-
rescue
|
195
|
+
rescue => e
|
193
196
|
warn "Invalid webhook payload format: #{e}"
|
194
197
|
response.write error("Invalid payload format. Should be valid JSON.")
|
195
198
|
return response.finish
|
@@ -231,7 +234,7 @@ module Parse
|
|
231
234
|
end
|
232
235
|
response.write success(result)
|
233
236
|
return response.finish
|
234
|
-
rescue Parse::WebhookErrorResponse => e
|
237
|
+
rescue Parse::WebhookErrorResponse, ActiveModel::ValidationError => e
|
235
238
|
if payload.trigger?
|
236
239
|
puts "[Webhook ResponseError] >> #{payload.trigger_name} #{payload.parse_class}:#{payload.parse_id}: #{e}"
|
237
240
|
elsif payload.function?
|
data/lib/parse-stack.rb
CHANGED
data/parse-stack.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Anthony Persaud"]
|
10
10
|
spec.email = ["persaud@modernistik.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Parse-Server Ruby Client and
|
12
|
+
spec.summary = %q{Parse-Server Ruby Client and Relational Mapper}
|
13
13
|
spec.description = %q{Parse-Server Ruby Client, Active Model based Data Mapper, and Query engine to manage larger scale Parse server applications}
|
14
14
|
spec.homepage = "https://github.com/modernistik/parse-stack"
|
15
15
|
spec.license = "MIT"
|
@@ -36,11 +36,13 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_runtime_dependency "moneta", [">= 0.7", "< 1"]
|
37
37
|
spec.add_runtime_dependency "rack", "< 3"
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
spec.post_install_message = <<UPGRADE
|
40
|
+
|
41
|
+
** BREAKING CHANGES **
|
42
|
+
The default `has_many` association form has changed from :array to :query.
|
43
|
+
To use arrays, you must now pass `through: :array` option to `has_many`.
|
44
|
+
|
45
|
+
Visit: https://github.com/modernistik/parse-stack/wiki/Changes-to-has_many-in-1.5.0
|
46
|
+
|
47
|
+
UPGRADE
|
46
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parse-stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Persaud
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -208,9 +208,14 @@ files:
|
|
208
208
|
- lib/parse/model/associations/belongs_to.rb
|
209
209
|
- lib/parse/model/associations/collection_proxy.rb
|
210
210
|
- lib/parse/model/associations/has_many.rb
|
211
|
+
- lib/parse/model/associations/has_one.rb
|
211
212
|
- lib/parse/model/associations/pointer_collection_proxy.rb
|
212
213
|
- lib/parse/model/associations/relation_collection_proxy.rb
|
213
214
|
- lib/parse/model/bytes.rb
|
215
|
+
- lib/parse/model/classes/installation.rb
|
216
|
+
- lib/parse/model/classes/role.rb
|
217
|
+
- lib/parse/model/classes/session.rb
|
218
|
+
- lib/parse/model/classes/user.rb
|
214
219
|
- lib/parse/model/core/actions.rb
|
215
220
|
- lib/parse/model/core/properties.rb
|
216
221
|
- lib/parse/model/core/querying.rb
|
@@ -247,7 +252,14 @@ homepage: https://github.com/modernistik/parse-stack
|
|
247
252
|
licenses:
|
248
253
|
- MIT
|
249
254
|
metadata: {}
|
250
|
-
post_install_message:
|
255
|
+
post_install_message: |2+
|
256
|
+
|
257
|
+
** BREAKING CHANGES **
|
258
|
+
The default `has_many` association form has changed from :array to :query.
|
259
|
+
To use arrays, you must now pass `through: :array` option to `has_many`.
|
260
|
+
|
261
|
+
Visit: https://github.com/modernistik/parse-stack/wiki/Changes-to-has_many-in-1.5.0
|
262
|
+
|
251
263
|
rdoc_options: []
|
252
264
|
require_paths:
|
253
265
|
- lib
|
@@ -266,5 +278,5 @@ rubyforge_project:
|
|
266
278
|
rubygems_version: 2.6.6
|
267
279
|
signing_key:
|
268
280
|
specification_version: 4
|
269
|
-
summary: Parse-Server Ruby Client and
|
281
|
+
summary: Parse-Server Ruby Client and Relational Mapper
|
270
282
|
test_files: []
|