Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit 090785a

Browse files
apersaudjorgeacaballero
authored andcommitted
Bump 1.10.1, removes dependency on faraday_middleware
[modernistik#62] Separate positional and keyword arguments for Ruby 3.0 Replaces deprecated Proc.new usage “warning: Capturing the given block using Proc.new is deprecated; use `&block` instead” Remove upper bound for dependencies versions Remove extra comma remove dependence on AMS ignore leading underscore Updated dependencies Updates version + dependencies ruby 3.0 compatibility fix block param more ruby 3 compatibility faraday 2 compatibility Remove models overrides templates Can't have two autoloaded files defining the same class. It results in inconsistent behavior. Built-in parse classes have to be properly reopened with class_eval. compatibility with Rails strong parameters update doc with reopening builtin classes Removing dependencies for faraday_middleware Bumping to 1.10.1 Bumping to 1.10.1
1 parent ecdb13e commit 090785a

38 files changed

Lines changed: 269 additions & 145 deletions

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/parse-stack.iml

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.solargraph.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ max_files: 5000
1515
require:
1616
- activemodel
1717
- faraday
18-
- faraday_middleware
1918
- moneta
2019
- activesupport
2120
- rack

Gemfile.lock

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
PATH
22
remote: .
33
specs:
4-
parse-stack (1.9.1)
5-
active_model_serializers (>= 0.9, < 1)
6-
activemodel (>= 5, < 7)
7-
activesupport (>= 5, < 7)
8-
faraday (< 1)
9-
faraday_middleware (>= 0.9, < 2)
10-
moneta (< 2)
11-
parallel (>= 1.6, < 2)
12-
rack (>= 2.0.6, < 3)
4+
parse-stack (1.10.1)
5+
active_model_serializers (>= 0.9)
6+
activemodel (>= 5)
7+
activesupport (>= 5)
8+
faraday
9+
moneta
10+
parallel (>= 1.6)
11+
rack (>= 2.0.6)
1312

1413
GEM
1514
remote: https://rubygems.org/
1615
specs:
17-
actionpack (6.1.7.1)
18-
actionview (= 6.1.7.1)
19-
activesupport (= 6.1.7.1)
20-
rack (~> 2.0, >= 2.0.9)
16+
actionpack (7.0.5)
17+
actionview (= 7.0.5)
18+
activesupport (= 7.0.5)
19+
rack (~> 2.0, >= 2.2.4)
2120
rack-test (>= 0.6.3)
2221
rails-dom-testing (~> 2.0)
2322
rails-html-sanitizer (~> 1.0, >= 1.2.0)
24-
actionview (6.1.7.1)
25-
activesupport (= 6.1.7.1)
23+
actionview (7.0.5)
24+
activesupport (= 7.0.5)
2625
builder (~> 3.1)
2726
erubi (~> 1.4)
2827
rails-dom-testing (~> 2.0)
@@ -32,14 +31,13 @@ GEM
3231
activemodel (>= 4.1, < 7.1)
3332
case_transform (>= 0.2)
3433
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
35-
activemodel (6.1.7.1)
36-
activesupport (= 6.1.7.1)
37-
activesupport (6.1.7.1)
34+
activemodel (7.0.5)
35+
activesupport (= 7.0.5)
36+
activesupport (7.0.5)
3837
concurrent-ruby (~> 1.0, >= 1.0.2)
3938
i18n (>= 1.6, < 2)
4039
minitest (>= 5.1)
4140
tzinfo (~> 2.0)
42-
zeitwerk (~> 2.3)
4341
ansi (1.5.0)
4442
binding_of_caller (1.0.0)
4543
debug_inspector (>= 0.0.1)
@@ -48,38 +46,39 @@ GEM
4846
case_transform (0.2)
4947
activesupport
5048
coderay (1.1.3)
51-
concurrent-ruby (1.1.10)
52-
connection_pool (2.3.0)
49+
concurrent-ruby (1.2.2)
50+
connection_pool (2.4.1)
5351
crass (1.0.6)
5452
daemons (1.4.1)
5553
debug_inspector (1.1.0)
5654
dotenv (2.8.1)
5755
erubi (1.12.0)
5856
eventmachine (1.2.7)
59-
faraday (0.17.6)
60-
multipart-post (>= 1.2, < 3)
61-
faraday_middleware (0.14.0)
62-
faraday (>= 0.7.4, < 1.0)
63-
i18n (1.12.0)
57+
faraday (2.7.5)
58+
faraday-net_http (>= 2.0, < 3.1)
59+
ruby2_keywords (>= 0.0.4)
60+
faraday-net_http (3.0.2)
61+
i18n (1.13.0)
6462
concurrent-ruby (~> 1.0)
6563
jsonapi-renderer (0.2.2)
66-
loofah (2.19.1)
64+
loofah (2.21.3)
6765
crass (~> 1.0.2)
68-
nokogiri (>= 1.5.9)
66+
nokogiri (>= 1.12.0)
6967
method_source (1.0.0)
70-
mini_portile2 (2.8.1)
71-
minitest (5.17.0)
72-
minitest-reporters (1.5.0)
68+
mini_portile2 (2.8.2)
69+
minitest (5.18.0)
70+
minitest-reporters (1.6.0)
7371
ansi
7472
builder
7573
minitest (>= 5.0)
7674
ruby-progressbar
77-
moneta (1.5.2)
78-
multipart-post (2.2.3)
79-
nokogiri (1.13.10)
80-
mini_portile2 (~> 2.8.0)
75+
moneta (1.6.0)
76+
nokogiri (1.15.2)
77+
mini_portile2 (~> 2.8.2)
8178
racc (~> 1.4)
82-
parallel (1.22.1)
79+
nokogiri (1.15.2-x86_64-darwin)
80+
racc (~> 1.4)
81+
parallel (1.23.0)
8382
pry (0.14.2)
8483
coderay (~> 1.1)
8584
method_source (~> 1.0)
@@ -89,35 +88,35 @@ GEM
8988
binding_of_caller (~> 1.0)
9089
pry (~> 0.13)
9190
racc (1.6.2)
92-
rack (2.2.6.2)
93-
rack-test (2.0.2)
91+
rack (2.2.7)
92+
rack-test (2.1.0)
9493
rack (>= 1.3)
9594
rails-dom-testing (2.0.3)
9695
activesupport (>= 4.2.0)
9796
nokogiri (>= 1.6)
9897
rails-html-sanitizer (1.5.0)
9998
loofah (~> 2.19, >= 2.19.1)
10099
rake (13.0.6)
101-
redcarpet (3.5.1)
100+
redcarpet (3.6.0)
102101
redis (5.0.6)
103102
redis-client (>= 0.9.0)
104-
redis-client (0.12.1)
103+
redis-client (0.14.1)
105104
connection_pool
106-
ruby-progressbar (1.11.0)
107-
rufo (0.13.0)
108-
thin (1.8.1)
105+
ruby-progressbar (1.13.0)
106+
ruby2_keywords (0.0.5)
107+
rufo (0.16.1)
108+
thin (1.8.2)
109109
daemons (~> 1.0, >= 1.0.9)
110110
eventmachine (~> 1.0, >= 1.0.4)
111111
rack (>= 1, < 3)
112-
tzinfo (2.0.5)
112+
tzinfo (2.0.6)
113113
concurrent-ruby (~> 1.0)
114-
webrick (1.7.0)
115-
yard (0.9.28)
116-
webrick (~> 1.7.0)
117-
zeitwerk (2.6.6)
114+
yard (0.9.34)
118115

119116
PLATFORMS
120117
ruby
118+
x86_64-darwin-20
119+
x86_64-darwin-22
121120

122121
DEPENDENCIES
123122
byebug

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,39 @@ data.acl # => ACL({"role:Admin"=>{"read"=>true, "write"=>true}})
647647

648648
For more information about Parse record ACLs, see the documentation at [Security](http://docs.parseplatform.org/rest/guide/#security)
649649

650+
## Builtin parse collections
651+
652+
These classes match parse builtin collections. Do not redeclare them as rails autoloader don't support multiple class declarations. To add properties and methods to these classes, properly reopen them with overrides, using this class_eval method.
653+
654+
First, append this to config/application.rb
655+
656+
```ruby
657+
##
658+
# Don't autoload overrides but preload them instead
659+
overrides = "#{Rails.root}/app/overrides"
660+
Rails.autoloaders.main.ignore(overrides)
661+
662+
config.to_prepare do
663+
Dir.glob("#{overrides}/**/*_override.rb").each do |override|
664+
load override
665+
end
666+
end
667+
```
668+
669+
Then, create the folder app/overrides/models. Create a file named [collection]_override.rb in this folder to reopen one of these classes. Example with the _User collection:
670+
671+
```ruby
672+
# app/overrides/models/user_override.rb
673+
Parse::User.class_eval do
674+
has_many :created_articles, as: :articles, field: :creator
675+
676+
property :first_name
677+
property :last_name
678+
property :picture
679+
end
680+
```
681+
682+
650683
### [Parse::Session](https://www.modernistik.com/gems/parse-stack/Parse/Session.html)
651684
This class represents the data and columns contained in the standard Parse `_Session` collection. You may add additional properties and methods to this class. See [Session API Reference](https://www.modernistik.com/gems/parse-stack/Parse/Session.html). You may call `Parse.use_shortnames!` to use `Session` in addition to `Parse::Session`.
652685

lib/parse/api/users.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def update_user(id, body = {}, headers: {}, **opts)
8484
# @return [Parse::Response]
8585
def set_service_auth_data(id, service_name, auth_data, headers: {}, **opts)
8686
body = { authData: { service_name => auth_data } }
87-
update_user(id, body, opts)
87+
update_user(id, body, **opts)
8888
end
8989

9090
# Delete a {Parse::User} record given an objectId.
@@ -143,7 +143,7 @@ def logout(session_token, headers: {}, **opts)
143143
def signup(username, password, email = nil, body: {}, **opts)
144144
body = body.merge({ username: username, password: password })
145145
body[:email] = email || body[:email]
146-
create_user(body, opts)
146+
create_user(body, **opts)
147147
end
148148
end # Users
149149
end #API

lib/parse/client.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
require "faraday"
2-
require "faraday_middleware"
32
require "active_support"
43
require "moneta"
5-
require "active_model_serializers"
4+
65
require "active_support/inflector"
76
require "active_support/core_ext/object"
87
require "active_support/core_ext/string"
@@ -202,8 +201,8 @@ def client(conn = :default)
202201
# @see Parse::Middleware::Caching
203202
# @see Parse::Middleware::Authentication
204203
# @see Parse::Protocol
205-
def setup(opts = {})
206-
@clients[:default] = self.new(opts, &Proc.new)
204+
def setup(opts = {}, &block)
205+
@clients[:default] = self.new(opts, &block)
207206
end
208207
end
209208

@@ -481,7 +480,7 @@ def request(method, uri = nil, body: nil, query: nil, headers: nil, opts: {})
481480
retry
482481
end
483482
raise
484-
rescue Faraday::Error::ClientError, Net::OpenTimeout => e
483+
rescue Faraday::ClientError, Net::OpenTimeout => e
485484
if _retry_count > 0
486485
warn "[Parse:Retry] Retries remaining #{_retry_count} : #{_request}"
487486
_retry_count -= 1
@@ -579,9 +578,9 @@ def client
579578
# @yield (see Parse::Client.setup)
580579
# @return (see Parse::Client.setup)
581580
# @see Parse::Client.setup
582-
def self.setup(opts = {})
581+
def self.setup(opts = {}, &block)
583582
if block_given?
584-
Parse::Client.new(opts, &Proc.new)
583+
Parse::Client.new(opts, &block)
585584
else
586585
Parse::Client.new(opts)
587586
end

0 commit comments

Comments
 (0)