distributed-press-api-client 0.5.0rc0 → 0.5.0rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e19e26b40b8e66a49cd2ac91d688ffc0757fc83c7d19d6d3e7c59917d7cab652
4
- data.tar.gz: bea92fa0f42403e3c6eeffa5484f8224bbfc08236089be41aed7dd6900124f77
3
+ metadata.gz: b35e83468b6b94652509f9d139cb0e97325f90ed70e1bcc672efbd870017e241
4
+ data.tar.gz: fea8338b7a77d4548d51effa48a4b1a4b9b98739c343614ea354b72ac59330d8
5
5
  SHA512:
6
- metadata.gz: 6df7cae6980256471a341c25d9ec34f60d38df59eded802959e210167157960376ef19e00d09be9b943cbf9f165046b7949de7824ea1dffbb7dd8824718c8f7b
7
- data.tar.gz: 846042442ce3c6720b5af695332d6140edacbe523e4fc7ad3f930938179672faffbd4a587e66ff45a44b1c8e796133188cc1e867770f4b9e4859d8f07e0c2fca
6
+ metadata.gz: a90bc42da7610f645c2a1306b3bab87e8eb05a0cc9b562e1702f6d6fb4e1b7d969b5384dc82b03551ae61ee7afa512e38b6a307f77a559a3c5867f569b1be458
7
+ data.tar.gz: 54f289f1098da816ef4304e4e3012c5f3a468faf478b5343d4c22b7f7c0a50d0467e96c346bf5d3ac37ac193922ec27fed94cf72106ab1fb0c19704accf0f7c1
@@ -9,6 +9,15 @@ require 'uri'
9
9
  require_relative '../../version'
10
10
  require_relative 'signed_headers'
11
11
 
12
+ # Retro-compatibility for URI < 0.12
13
+ unless URI.respond_to?(:encode_uri_component)
14
+ URI.class_eval do
15
+ def encode_uri_component(str, enc = nil)
16
+ encode_www_form_component(str, enc || Encoding::UTF_8).gsub('+', '%20')
17
+ end
18
+ end
19
+ end
20
+
12
21
  class DistributedPress
13
22
  module V1
14
23
  module Social
@@ -174,7 +183,26 @@ class DistributedPress
174
183
  #
175
184
  # @return [String]
176
185
  def host
177
- @host ||= URI.parse(url).host
186
+ @host ||= uri.host
187
+ end
188
+
189
+ # If the endpoint is on a subdirectory, we need the absolute
190
+ # path for signing
191
+ #
192
+ # @param :endpoint [String]
193
+ # @return [String]
194
+ def absolute_endpoint(endpoint)
195
+ "#{uri.path}/#{endpoint}".squeeze('/')
196
+ end
197
+
198
+ # Absolute URL for an endpoint
199
+ #
200
+ # @param :endpoint [String]
201
+ # @return [String]
202
+ def absolute_url(endpoint)
203
+ uri.dup.tap do |u|
204
+ u.path = absolute_endpoint(endpoint)
205
+ end.to_s
178
206
  end
179
207
 
180
208
  private
@@ -254,15 +282,6 @@ class DistributedPress
254
282
  nil
255
283
  end
256
284
 
257
- # If the endpoint is on a subdirectory, we need the absolute
258
- # path for signing
259
- #
260
- # @param :endpoint [String]
261
- # @return [String]
262
- def absolute_endpoint(endpoint)
263
- "#{uri.path}/#{endpoint}".squeeze('/')
264
- end
265
-
266
285
  # Brotli available
267
286
  def brotli?
268
287
  begin
@@ -3,5 +3,5 @@
3
3
  # API client
4
4
  class DistributedPress
5
5
  # Version
6
- VERSION = '0.5.0rc0'
6
+ VERSION = '0.5.0rc2'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed-press-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0rc0
4
+ version: 0.5.0rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable