distributed-press-api-client 0.5.0rc6 → 0.5.0rc8

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: 6a07fc21fcba26bb8bcb854ec767be0030013b58341b93a17c4e4c084aeb7cf3
4
- data.tar.gz: b72a76ca86a62730c0e8299c1089b5dd43b52154322c96f235015c07c902c386
3
+ metadata.gz: 03507acb74efe4f9acac94ec797a4e9e2c763e0bea35a64442c2cc5be9a433bd
4
+ data.tar.gz: d291bf8e88761714b282fb54273dc220615f53ea0d2647a95447c13ff0d3b7c1
5
5
  SHA512:
6
- metadata.gz: bdb203374bb184030f0f6a1a3a5f6699e8f52579060a6f71e1bfea5420fbfc66519bbf3cb9ca62b3b2683034328ef0dcea016512b359ee340a3e53a4dd012fae
7
- data.tar.gz: 1a7253c626fab33aa0adc50007b19394dcdfc1cd55360a5dbb291842663ee85a2daedbdb9a2e6048a9697889b2dae5c350b76882160da66d1b1803fed09a9b0e
6
+ metadata.gz: 639668b2192c1e7c256de2d294582e96a1f9c3ddb701ca6102805e7a887265df6a7d73579b97fc5d4dcbe6564b5dbab852e798b22182824cefdf805312dcc17c
7
+ data.tar.gz: 9d54c9a9567c1af53340d9d412a67cf43513c80c2af3642dc843949af0120165cf5a6e7eef8fcef106880e077273157fa84953a25842a735e32e229a617e7c42
@@ -231,7 +231,7 @@ class DistributedPress
231
231
  # after the request is instantiated. No need to process
232
232
  # cookies for now. Uses the public key URL as a caching key so
233
233
  # we revalidate access on shared caches.
234
- options = { body: body, headers: headers, base_uri: url, parser: parser, stream_body: true }
234
+ options = { body: body, headers: headers, base_uri: url, parser: parser, stream_body: true, timeout: 5 }
235
235
  options = HTTParty::ModuleInheritableAttributes.hash_deep_dup(self.class.default_options).merge(options)
236
236
  response_body = ''.dup
237
237
 
@@ -29,14 +29,14 @@ class DistributedPress
29
29
  # @todo Replace with a class
30
30
  @parser =
31
31
  proc do |body, format|
32
- next HTTParty::Parser.call(body, :html) if body&.starts_with? '<'
33
- next HTTParty::Parser.call(body, format || :plain) unless body&.starts_with? '{'
32
+ next HTTParty::Parser.call(body, :html) if body&.start_with? '<'
33
+ next HTTParty::Parser.call(body, format || :plain) unless body&.start_with? '{'
34
34
 
35
35
  object = HTTParty::Parser.call(body, :json)
36
36
 
37
37
  # @todo Actually validate objects
38
38
  case object['type']
39
- when 'Collection', 'OrderedCollection', 'CollectionPage'
39
+ when 'Collection', 'OrderedCollection', 'CollectionPage', 'OrderedCollectionPage'
40
40
  Collection.new(object: object, dereferencer: self)
41
41
  else
42
42
  ReferencedObject.new(object: object, dereferencer: self)
@@ -43,7 +43,7 @@ class DistributedPress
43
43
 
44
44
  # XXX: format is nil but should be :json
45
45
  @parser = proc do |body, format|
46
- next HTTParty::Parser.call(body, format || :plain) unless body.starts_with? '{'
46
+ next HTTParty::Parser.call(body, format || :plain) unless body.start_with? '{'
47
47
 
48
48
  json = HTTParty::Parser.call(body, :json)
49
49
 
@@ -58,7 +58,7 @@ class DistributedPress
58
58
  "#{self.class.name}(#{uri})"
59
59
  end
60
60
 
61
- def_delegators :object, :[], :dig, :to_h, :to_json, :slice
61
+ def_delegators :object, :[], :dig, :to_h, :to_json, :slice, :key?, :keys
62
62
  end
63
63
  end
64
64
  end
@@ -44,7 +44,7 @@ class DistributedPress
44
44
  attr_reader :dereferencer
45
45
  attr_reader :referenced
46
46
 
47
- def_delegators :referenced, :[], :dig, :to_h, :to_json
47
+ def_delegators :referenced, :[], :dig, :to_h, :to_json, :keys, :key?
48
48
 
49
49
  def initialize(object:, dereferencer:)
50
50
  @object = object
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'uri'
3
+ require 'base64'
4
4
  require_relative 'client'
5
5
 
6
6
  class DistributedPress
@@ -38,7 +38,7 @@ class DistributedPress
38
38
  #
39
39
  # @return [String]
40
40
  def endpoint
41
- @endpoint ||= "/v1/#{actor}/inbox/replies/#{URI.encode_uri_component(activity)}"
41
+ @endpoint ||= "/v1/#{actor}/inbox/replies/#{Base64.encode64(activity).delete("\n")}"
42
42
  end
43
43
  end
44
44
  end
@@ -3,5 +3,5 @@
3
3
  # API client
4
4
  class DistributedPress
5
5
  # Version
6
- VERSION = '0.5.0rc6'
6
+ VERSION = '0.5.0rc8'
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.0rc6
4
+ version: 0.5.0rc8
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-19 00:00:00.000000000 Z
11
+ date: 2024-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable