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 +4 -4
- data/lib/distributed_press/v1/social/client.rb +29 -10
- data/lib/distributed_press/version.rb +1 -1
- 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: b35e83468b6b94652509f9d139cb0e97325f90ed70e1bcc672efbd870017e241
|
4
|
+
data.tar.gz: fea8338b7a77d4548d51effa48a4b1a4b9b98739c343614ea354b72ac59330d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 ||=
|
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
|
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.
|
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-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|