distributed-press-api-client 0.3.0rc2 → 0.3.0rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c508b60370d912f4f45de6b3f4e58498cd67dbc4df3a762a4934b5f47ad3a08
4
- data.tar.gz: 6aad02b5eca7d6954f4dc0b9bb77848d70fb18235305634b8523ac5dda8b8b5a
3
+ metadata.gz: 38b096c332f629aa84304173aadd7683573c1d7f2d6fecbb35aa7c75e42185bd
4
+ data.tar.gz: f8248f49a1453ed82a1384e9847fe66cb5cf33c265f21f780c192d3b1527ec2b
5
5
  SHA512:
6
- metadata.gz: '09e9c0483f970d76f1ad068ca96eeb79bcf761ffbec0e4659481b36da1bbb3f0b5e252c386baef38af4fb98cbe18cf751ad7acb3062afe68df141878b3e93d0e'
7
- data.tar.gz: f0531bd786dd810bd3f4c54a0c75d63787153e367075c413b0c0573e7484ec2ccfcd0902bed5000b67f6437d78755e6625c5ae66867c1070d3f9f83b4976defc
6
+ metadata.gz: 5d5e98110c0e40c433e2a76690eda3e910116f7e9fdd51234038d93dd3e72abd56048b958c17552af3cbb9b14c077f079aca0549096eaf7e74bd360c4323e5fb
7
+ data.tar.gz: 0017a9f71b6bb9914e0d677ea0fa0ecc87f4253441e2826595e29dae0e6b5530cc7badd1cd64513f25873236f9c720fbabd3f82741057c79bb701da99d35811c
@@ -26,6 +26,8 @@ class DistributedPress
26
26
  REQUEST_TARGET = '(request-target)'
27
27
  # Headers included in the signature
28
28
  SIGNABLE_HEADERS = [REQUEST_TARGET, 'Host', 'Date', 'Digest']
29
+ # Content types
30
+ CONTENT_TYPES = %w[application/ld+json application/activity+json]
29
31
 
30
32
  # API URL
31
33
  # @return [String]
@@ -54,6 +56,23 @@ class DistributedPress
54
56
  @public_key_url = public_key_url
55
57
  @key_size = key_size
56
58
  @private_key_pem = private_key_pem
59
+
60
+ CONTENT_TYPES.each do |content_type|
61
+ HTTParty::Parser::SupportedFormats[content_type] = :json
62
+ end
63
+ end
64
+
65
+ # GET request
66
+ #
67
+ # @param endpoint [String]
68
+ # @return [Hash]
69
+ def get(endpoint:)
70
+ headers = default_headers
71
+
72
+ add_request_specific_headers! headers, 'get', endpoint
73
+ sign_headers! headers
74
+
75
+ self.class.get(endpoint, headers: headers)
57
76
  end
58
77
 
59
78
  # POST request
@@ -99,7 +118,7 @@ class DistributedPress
99
118
  def default_headers
100
119
  {
101
120
  'User-Agent' => "DistributedPress/#{DistributedPress::VERSION}",
102
- 'Content-Type' => 'application/json',
121
+ 'Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
103
122
  'Host' => host
104
123
  }
105
124
  end
@@ -3,5 +3,5 @@
3
3
  # API client
4
4
  class DistributedPress
5
5
  # Version
6
- VERSION = '0.3.0rc2'
6
+ VERSION = '0.3.0rc4'
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.3.0rc2
4
+ version: 0.3.0rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-31 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable