rest_framework 2.0.0.beta5 → 2.0.0.beta6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rest_framework/controller/actions.rb +3 -1
- data/lib/rest_framework/paginators/page_number_paginator.rb +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7be6812ae478ca58b5f352bf561a57384d309e2a91037d25cf1ad3dbe64ff09
|
|
4
|
+
data.tar.gz: a2295b59abd1f6e15fa0736b3e5255f00492a0cdc794583b87b85634533cb003
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a92158c48314c5fb62470cde91d5b21d264e60b8d3d367315b20014965cceaee9bef5ff019c32cc3ef75fb9a45a410cc63373d2dc9c00fa295f6626ec279a6b
|
|
7
|
+
data.tar.gz: a332502f06c34126962890d6e4b395d5788c8dd1c07d5bd0cfbbcb33d49ec209efad4986d99f1f69ec0f86569b175bb902a11aee76cb21f4942546e256e0239b
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.0.
|
|
1
|
+
2.0.0.beta6
|
|
@@ -22,7 +22,9 @@ module RESTFramework::Controller
|
|
|
22
22
|
options: { methods: [ :options ], condition: ->(_c) { true }, kwargs: { anchor: true } },
|
|
23
23
|
}.freeze
|
|
24
24
|
RRF_BUILTIN_MEMBER_ACTIONS = {
|
|
25
|
-
show
|
|
25
|
+
# `show` names the member route (`as: ""` -> the singular resource, e.g. `api_demo_user`);
|
|
26
|
+
# `update`/`destroy` share that path and reuse the helper.
|
|
27
|
+
show: { methods: [ :get ], condition: ->(c) { c.model }, kwargs: { as: "" } },
|
|
26
28
|
update: { methods: [ :put, :patch ], condition: ->(c) { c.model } },
|
|
27
29
|
destroy: { methods: [ :delete ], condition: ->(c) { c.model } },
|
|
28
30
|
}.freeze
|
|
@@ -75,13 +75,25 @@ class RESTFramework::Paginators::PageNumberPaginator < RESTFramework::Paginators
|
|
|
75
75
|
# Wrap the serialized page with appropriate metadata.
|
|
76
76
|
def get_paginated_response(serialized_page)
|
|
77
77
|
page_query_param = @controller.class.page_query_param
|
|
78
|
-
|
|
78
|
+
request = @controller.request
|
|
79
|
+
base_params = request.query_parameters.symbolize_keys
|
|
80
|
+
|
|
81
|
+
# Anchor next/previous to the request's own scheme/host/port so they point back at the same
|
|
82
|
+
# endpoint the client is using — even when the app's `default_url_options` host differs from the
|
|
83
|
+
# request host (e.g. an API served on a subdomain), which `url_for` would otherwise emit.
|
|
84
|
+
host_options = {
|
|
85
|
+
only_path: false,
|
|
86
|
+
protocol: request.protocol,
|
|
87
|
+
host: request.host,
|
|
88
|
+
port: request.optional_port,
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
has_next = @total_count ? @page_number < @total_pages : @has_next
|
|
80
92
|
next_url = if has_next
|
|
81
|
-
@controller.url_for({ **base_params, page_query_param => @page_number + 1 })
|
|
93
|
+
@controller.url_for({ **base_params, page_query_param => @page_number + 1, **host_options })
|
|
82
94
|
end
|
|
83
95
|
previous_url = if @page_number > 1
|
|
84
|
-
@controller.url_for({ **base_params, page_query_param => @page_number - 1 })
|
|
96
|
+
@controller.url_for({ **base_params, page_query_param => @page_number - 1, **host_options })
|
|
85
97
|
end
|
|
86
98
|
|
|
87
99
|
{
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rest_framework
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.
|
|
4
|
+
version: 2.0.0.beta6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gregory N. Schmit
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|