post-for-me 0.1.0.pre.alpha.7 → 0.1.0.pre.alpha.9
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/CHANGELOG.md +38 -0
- data/README.md +1 -1
- data/lib/post_for_me/errors.rb +25 -11
- data/lib/post_for_me/file_part.rb +10 -7
- data/lib/post_for_me/internal/transport/base_client.rb +11 -7
- data/lib/post_for_me/internal/transport/pooled_net_requester.rb +7 -10
- data/lib/post_for_me/internal/type/base_page.rb +1 -1
- data/lib/post_for_me/internal/type/file_input.rb +7 -4
- data/lib/post_for_me/internal/util.rb +3 -2
- data/lib/post_for_me/models/bluesky_configuration_dto.rb +118 -3
- data/lib/post_for_me/models/create_social_post.rb +221 -2
- data/lib/post_for_me/models/facebook_configuration_dto.rb +137 -4
- data/lib/post_for_me/models/instagram_configuration_dto.rb +135 -4
- data/lib/post_for_me/models/linkedin_configuration_dto.rb +118 -3
- data/lib/post_for_me/models/pinterest_configuration_dto.rb +118 -3
- data/lib/post_for_me/models/social_account_create_auth_url_params.rb +43 -1
- data/lib/post_for_me/models/social_post.rb +221 -2
- data/lib/post_for_me/models/threads_configuration_dto.rb +118 -3
- data/lib/post_for_me/models/tiktok_configuration.rb +127 -4
- data/lib/post_for_me/models/twitter_configuration_dto.rb +211 -4
- data/lib/post_for_me/models/youtube_configuration_dto.rb +118 -3
- data/lib/post_for_me/version.rb +1 -1
- data/rbi/post_for_me/errors.rbi +29 -2
- data/rbi/post_for_me/file_part.rbi +1 -1
- data/rbi/post_for_me/internal/transport/base_client.rbi +4 -5
- data/rbi/post_for_me/internal/type/base_page.rbi +1 -1
- data/rbi/post_for_me/internal/util.rbi +1 -1
- data/rbi/post_for_me/models/bluesky_configuration_dto.rbi +243 -3
- data/rbi/post_for_me/models/create_social_post.rbi +424 -0
- data/rbi/post_for_me/models/facebook_configuration_dto.rbi +258 -3
- data/rbi/post_for_me/models/instagram_configuration_dto.rbi +267 -6
- data/rbi/post_for_me/models/linkedin_configuration_dto.rbi +245 -3
- data/rbi/post_for_me/models/pinterest_configuration_dto.rbi +246 -3
- data/rbi/post_for_me/models/social_account_create_auth_url_params.rbi +104 -0
- data/rbi/post_for_me/models/social_post.rbi +414 -0
- data/rbi/post_for_me/models/threads_configuration_dto.rbi +240 -3
- data/rbi/post_for_me/models/tiktok_configuration.rbi +237 -3
- data/rbi/post_for_me/models/twitter_configuration_dto.rbi +452 -4
- data/rbi/post_for_me/models/youtube_configuration_dto.rbi +240 -3
- data/sig/post_for_me/errors.rbs +7 -0
- data/sig/post_for_me/file_part.rbs +1 -1
- data/sig/post_for_me/models/bluesky_configuration_dto.rbs +109 -4
- data/sig/post_for_me/models/create_social_post.rbs +180 -1
- data/sig/post_for_me/models/facebook_configuration_dto.rbs +109 -4
- data/sig/post_for_me/models/instagram_configuration_dto.rbs +112 -7
- data/sig/post_for_me/models/linkedin_configuration_dto.rbs +109 -4
- data/sig/post_for_me/models/pinterest_configuration_dto.rbs +99 -4
- data/sig/post_for_me/models/social_account_create_auth_url_params.rbs +37 -0
- data/sig/post_for_me/models/social_post.rbs +180 -1
- data/sig/post_for_me/models/threads_configuration_dto.rbs +99 -4
- data/sig/post_for_me/models/tiktok_configuration.rbs +104 -4
- data/sig/post_for_me/models/twitter_configuration_dto.rbs +196 -4
- data/sig/post_for_me/models/youtube_configuration_dto.rbs +107 -4
- 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: 01ccb7d44dae77373838e7b5fe9d286727f29d5b0cb28c147c4d5f2db24f8755
|
|
4
|
+
data.tar.gz: 80cf5a0f6c198eb315344dfeec272c8987552d5ec63ac8054b10b6c99787d577
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3040c94c71317b8e81ec5b45fd1b06ed7214b291b158d9ae292d229ce1ad7404b359c6424294702923d4d2edec71dbe5c14542e4c5ae101f189ef07f2dd730ef
|
|
7
|
+
data.tar.gz: a294fa51eff7716dd53392b2defcc295b559c5fddbc3d857f4274d6bcfd52189b105c8d0e247c25820e601670f76ef5c8ab319c423ce777eebf74e1dc69aa14a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.9 (2025-10-03)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/DayMoonDevelopment/post-for-me-ruby/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([29166f7](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/29166f7dd2eebd6f9a49e99c553f4212233879e9))
|
|
10
|
+
* **api:** api update ([c75db7a](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/c75db7ab2fcc16f9e831ed1722e837d4dc1fbd91))
|
|
11
|
+
* **api:** api update ([11635c1](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/11635c16438bf92c6aec3d4c524f09768bf8f2cc))
|
|
12
|
+
* expose response headers for both streams and errors ([c4a0864](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/c4a0864dab0421eca1ba510038376497ca4c3d1f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* coroutine leaks from connection pool ([5ca79a4](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/5ca79a4bbab523051dbecd1f48eb95ad5bf93af7))
|
|
18
|
+
* shorten multipart boundary sep to less than RFC specificed max length ([e467fe7](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/e467fe77aacf67eeff2f4abd38177476c925c411))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Performance Improvements
|
|
22
|
+
|
|
23
|
+
* faster code formatting ([58bee30](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/58bee30eb5b12ee89f3271e386d425d119641227))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Chores
|
|
27
|
+
|
|
28
|
+
* allow fast-format to use bsd sed as well ([b753209](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/b7532090e9056a27ce382fe54965a90a1bf65cce))
|
|
29
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([ba2ba3c](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/ba2ba3cc8fa0b6e756a840035bcd6f30054a1831))
|
|
30
|
+
* **internal:** codegen related update ([11c589f](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/11c589fc01e8a1c650e271dffb5c9bd9ef2f4da3))
|
|
31
|
+
* **internal:** codegen related update ([6e6de4f](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/6e6de4f6f1424334a37de60918ea43190593d522))
|
|
32
|
+
|
|
33
|
+
## 0.1.0-alpha.8 (2025-09-06)
|
|
34
|
+
|
|
35
|
+
Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/DayMoonDevelopment/post-for-me-ruby/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* **api:** api update ([b15e35d](https://github.com/DayMoonDevelopment/post-for-me-ruby/commit/b15e35d20fbac883c45ae3241b432b2fcbc8219e))
|
|
40
|
+
|
|
3
41
|
## 0.1.0-alpha.7 (2025-08-25)
|
|
4
42
|
|
|
5
43
|
Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/DayMoonDevelopment/post-for-me-ruby/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
17
17
|
<!-- x-release-please-start-version -->
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "post-for-me", "~> 0.1.0.pre.alpha.
|
|
20
|
+
gem "post-for-me", "~> 0.1.0.pre.alpha.9"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
data/lib/post_for_me/errors.rb
CHANGED
|
@@ -40,6 +40,9 @@ module PostForMe
|
|
|
40
40
|
# @return [Integer, nil]
|
|
41
41
|
attr_accessor :status
|
|
42
42
|
|
|
43
|
+
# @return [Hash{String=>String}, nil]
|
|
44
|
+
attr_accessor :headers
|
|
45
|
+
|
|
43
46
|
# @return [Object, nil]
|
|
44
47
|
attr_accessor :body
|
|
45
48
|
|
|
@@ -47,13 +50,15 @@ module PostForMe
|
|
|
47
50
|
#
|
|
48
51
|
# @param url [URI::Generic]
|
|
49
52
|
# @param status [Integer, nil]
|
|
53
|
+
# @param headers [Hash{String=>String}, nil]
|
|
50
54
|
# @param body [Object, nil]
|
|
51
55
|
# @param request [nil]
|
|
52
56
|
# @param response [nil]
|
|
53
57
|
# @param message [String, nil]
|
|
54
|
-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
|
|
58
|
+
def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
|
|
55
59
|
@url = url
|
|
56
60
|
@status = status
|
|
61
|
+
@headers = headers
|
|
57
62
|
@body = body
|
|
58
63
|
@request = request
|
|
59
64
|
@response = response
|
|
@@ -74,6 +79,7 @@ module PostForMe
|
|
|
74
79
|
#
|
|
75
80
|
# @param url [URI::Generic]
|
|
76
81
|
# @param status [nil]
|
|
82
|
+
# @param headers [Hash{String=>String}, nil]
|
|
77
83
|
# @param body [nil]
|
|
78
84
|
# @param request [nil]
|
|
79
85
|
# @param response [nil]
|
|
@@ -81,6 +87,7 @@ module PostForMe
|
|
|
81
87
|
def initialize(
|
|
82
88
|
url:,
|
|
83
89
|
status: nil,
|
|
90
|
+
headers: nil,
|
|
84
91
|
body: nil,
|
|
85
92
|
request: nil,
|
|
86
93
|
response: nil,
|
|
@@ -95,6 +102,7 @@ module PostForMe
|
|
|
95
102
|
#
|
|
96
103
|
# @param url [URI::Generic]
|
|
97
104
|
# @param status [nil]
|
|
105
|
+
# @param headers [Hash{String=>String}, nil]
|
|
98
106
|
# @param body [nil]
|
|
99
107
|
# @param request [nil]
|
|
100
108
|
# @param response [nil]
|
|
@@ -102,6 +110,7 @@ module PostForMe
|
|
|
102
110
|
def initialize(
|
|
103
111
|
url:,
|
|
104
112
|
status: nil,
|
|
113
|
+
headers: nil,
|
|
105
114
|
body: nil,
|
|
106
115
|
request: nil,
|
|
107
116
|
response: nil,
|
|
@@ -116,21 +125,24 @@ module PostForMe
|
|
|
116
125
|
#
|
|
117
126
|
# @param url [URI::Generic]
|
|
118
127
|
# @param status [Integer]
|
|
128
|
+
# @param headers [Hash{String=>String}, nil]
|
|
119
129
|
# @param body [Object, nil]
|
|
120
130
|
# @param request [nil]
|
|
121
131
|
# @param response [nil]
|
|
122
132
|
# @param message [String, nil]
|
|
123
133
|
#
|
|
124
134
|
# @return [self]
|
|
125
|
-
def self.for(url:, status:, body:, request:, response:, message: nil)
|
|
126
|
-
kwargs =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
|
|
136
|
+
kwargs =
|
|
137
|
+
{
|
|
138
|
+
url: url,
|
|
139
|
+
status: status,
|
|
140
|
+
headers: headers,
|
|
141
|
+
body: body,
|
|
142
|
+
request: request,
|
|
143
|
+
response: response,
|
|
144
|
+
message: message
|
|
145
|
+
}
|
|
134
146
|
|
|
135
147
|
case status
|
|
136
148
|
in 400
|
|
@@ -162,15 +174,17 @@ module PostForMe
|
|
|
162
174
|
#
|
|
163
175
|
# @param url [URI::Generic]
|
|
164
176
|
# @param status [Integer]
|
|
177
|
+
# @param headers [Hash{String=>String}, nil]
|
|
165
178
|
# @param body [Object, nil]
|
|
166
179
|
# @param request [nil]
|
|
167
180
|
# @param response [nil]
|
|
168
181
|
# @param message [String, nil]
|
|
169
|
-
def initialize(url:, status:, body:, request:, response:, message: nil)
|
|
182
|
+
def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
|
|
170
183
|
message ||= {url: url.to_s, status: status, body: body}
|
|
171
184
|
super(
|
|
172
185
|
url: url,
|
|
173
186
|
status: status,
|
|
187
|
+
headers: headers,
|
|
174
188
|
body: body,
|
|
175
189
|
request: request,
|
|
176
190
|
response: response,
|
|
@@ -38,18 +38,21 @@ module PostForMe
|
|
|
38
38
|
def to_yaml(*a) = read.to_yaml(*a)
|
|
39
39
|
|
|
40
40
|
# @param content [Pathname, StringIO, IO, String]
|
|
41
|
-
# @param filename [String, nil]
|
|
41
|
+
# @param filename [Pathname, String, nil]
|
|
42
42
|
# @param content_type [String, nil]
|
|
43
43
|
def initialize(content, filename: nil, content_type: nil)
|
|
44
|
-
@
|
|
44
|
+
@content_type = content_type
|
|
45
45
|
@filename =
|
|
46
|
-
case content
|
|
47
|
-
in Pathname
|
|
48
|
-
|
|
46
|
+
case [filename, (@content = content)]
|
|
47
|
+
in [String | Pathname, _]
|
|
48
|
+
::File.basename(filename)
|
|
49
|
+
in [nil, Pathname]
|
|
50
|
+
content.basename.to_path
|
|
51
|
+
in [nil, IO]
|
|
52
|
+
content.to_path
|
|
49
53
|
else
|
|
50
|
-
filename
|
|
54
|
+
filename
|
|
51
55
|
end
|
|
52
|
-
@content_type = content_type
|
|
53
56
|
end
|
|
54
57
|
end
|
|
55
58
|
end
|
|
@@ -47,7 +47,7 @@ module PostForMe
|
|
|
47
47
|
# @api private
|
|
48
48
|
#
|
|
49
49
|
# @param status [Integer]
|
|
50
|
-
# @param headers [Hash{String=>String}
|
|
50
|
+
# @param headers [Hash{String=>String}]
|
|
51
51
|
#
|
|
52
52
|
# @return [Boolean]
|
|
53
53
|
def should_retry?(status, headers:)
|
|
@@ -85,7 +85,7 @@ module PostForMe
|
|
|
85
85
|
#
|
|
86
86
|
# @param status [Integer]
|
|
87
87
|
#
|
|
88
|
-
# @param response_headers [Hash{String=>String}
|
|
88
|
+
# @param response_headers [Hash{String=>String}]
|
|
89
89
|
#
|
|
90
90
|
# @return [Hash{Symbol=>Object}]
|
|
91
91
|
def follow_redirect(request, status:, response_headers:)
|
|
@@ -378,6 +378,7 @@ module PostForMe
|
|
|
378
378
|
rescue PostForMe::Errors::APIConnectionError => e
|
|
379
379
|
status = e
|
|
380
380
|
end
|
|
381
|
+
headers = PostForMe::Internal::Util.normalized_headers(response&.each_header&.to_h)
|
|
381
382
|
|
|
382
383
|
case status
|
|
383
384
|
in ..299
|
|
@@ -390,7 +391,7 @@ module PostForMe
|
|
|
390
391
|
in 300..399
|
|
391
392
|
self.class.reap_connection!(status, stream: stream)
|
|
392
393
|
|
|
393
|
-
request = self.class.follow_redirect(request, status: status, response_headers:
|
|
394
|
+
request = self.class.follow_redirect(request, status: status, response_headers: headers)
|
|
394
395
|
send_request(
|
|
395
396
|
request,
|
|
396
397
|
redirect_count: redirect_count + 1,
|
|
@@ -399,9 +400,9 @@ module PostForMe
|
|
|
399
400
|
)
|
|
400
401
|
in PostForMe::Errors::APIConnectionError if retry_count >= max_retries
|
|
401
402
|
raise status
|
|
402
|
-
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers:
|
|
403
|
+
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
|
|
403
404
|
decoded = Kernel.then do
|
|
404
|
-
PostForMe::Internal::Util.decode_content(
|
|
405
|
+
PostForMe::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
|
|
405
406
|
ensure
|
|
406
407
|
self.class.reap_connection!(status, stream: stream)
|
|
407
408
|
end
|
|
@@ -409,6 +410,7 @@ module PostForMe
|
|
|
409
410
|
raise PostForMe::Errors::APIStatusError.for(
|
|
410
411
|
url: url,
|
|
411
412
|
status: status,
|
|
413
|
+
headers: headers,
|
|
412
414
|
body: decoded,
|
|
413
415
|
request: nil,
|
|
414
416
|
response: response
|
|
@@ -485,19 +487,21 @@ module PostForMe
|
|
|
485
487
|
send_retry_header: send_retry_header
|
|
486
488
|
)
|
|
487
489
|
|
|
488
|
-
|
|
490
|
+
headers = PostForMe::Internal::Util.normalized_headers(response.each_header.to_h)
|
|
491
|
+
decoded = PostForMe::Internal::Util.decode_content(headers, stream: stream)
|
|
489
492
|
case req
|
|
490
493
|
in {stream: Class => st}
|
|
491
494
|
st.new(
|
|
492
495
|
model: model,
|
|
493
496
|
url: url,
|
|
494
497
|
status: status,
|
|
498
|
+
headers: headers,
|
|
495
499
|
response: response,
|
|
496
500
|
unwrap: unwrap,
|
|
497
501
|
stream: decoded
|
|
498
502
|
)
|
|
499
503
|
in {page: Class => page}
|
|
500
|
-
page.new(client: self, req: req, headers:
|
|
504
|
+
page.new(client: self, req: req, headers: headers, page_data: decoded)
|
|
501
505
|
else
|
|
502
506
|
unwrapped = PostForMe::Internal::Util.dig(decoded, unwrap)
|
|
503
507
|
PostForMe::Internal::Type::Converter.coerce(model, unwrapped)
|
|
@@ -134,9 +134,9 @@ module PostForMe
|
|
|
134
134
|
|
|
135
135
|
# rubocop:disable Metrics/BlockLength
|
|
136
136
|
enum = Enumerator.new do |y|
|
|
137
|
-
|
|
138
|
-
next if finished
|
|
137
|
+
next if finished
|
|
139
138
|
|
|
139
|
+
with_pool(url, deadline: deadline) do |conn|
|
|
140
140
|
req, closing = self.class.build_request(request) do
|
|
141
141
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
142
142
|
end
|
|
@@ -149,7 +149,7 @@ module PostForMe
|
|
|
149
149
|
|
|
150
150
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
151
151
|
conn.request(req) do |rsp|
|
|
152
|
-
y << [
|
|
152
|
+
y << [req, rsp]
|
|
153
153
|
break if finished
|
|
154
154
|
|
|
155
155
|
rsp.read_body do |bytes|
|
|
@@ -160,6 +160,8 @@ module PostForMe
|
|
|
160
160
|
end
|
|
161
161
|
eof = true
|
|
162
162
|
end
|
|
163
|
+
ensure
|
|
164
|
+
conn.finish if !eof && conn&.started?
|
|
163
165
|
end
|
|
164
166
|
rescue Timeout::Error
|
|
165
167
|
raise PostForMe::Errors::APITimeoutError.new(url: url, request: req)
|
|
@@ -168,16 +170,11 @@ module PostForMe
|
|
|
168
170
|
end
|
|
169
171
|
# rubocop:enable Metrics/BlockLength
|
|
170
172
|
|
|
171
|
-
|
|
173
|
+
_, response = enum.next
|
|
172
174
|
body = PostForMe::Internal::Util.fused_enum(enum, external: true) do
|
|
173
175
|
finished = true
|
|
174
|
-
|
|
175
|
-
enum.next
|
|
176
|
-
rescue StopIteration
|
|
177
|
-
nil
|
|
178
|
-
end
|
|
176
|
+
loop { enum.next }
|
|
179
177
|
ensure
|
|
180
|
-
conn.finish if !eof && conn&.started?
|
|
181
178
|
closing&.call
|
|
182
179
|
end
|
|
183
180
|
[Integer(response.code), response, body]
|
|
@@ -39,7 +39,7 @@ module PostForMe
|
|
|
39
39
|
#
|
|
40
40
|
# @param client [PostForMe::Internal::Transport::BaseClient]
|
|
41
41
|
# @param req [Hash{Symbol=>Object}]
|
|
42
|
-
# @param headers [Hash{String=>String}
|
|
42
|
+
# @param headers [Hash{String=>String}]
|
|
43
43
|
# @param page_data [Object]
|
|
44
44
|
def initialize(client:, req:, headers:, page_data:)
|
|
45
45
|
@client = client
|
|
@@ -82,17 +82,20 @@ module PostForMe
|
|
|
82
82
|
#
|
|
83
83
|
# @return [Pathname, StringIO, IO, String, Object]
|
|
84
84
|
def dump(value, state:)
|
|
85
|
-
# rubocop:disable Lint/DuplicateBranch
|
|
86
85
|
case value
|
|
86
|
+
in StringIO | String
|
|
87
|
+
# https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
|
|
88
|
+
# while not required, a filename is recommended, and in practice many servers do expect this
|
|
89
|
+
PostForMe::FilePart.new(value, filename: "upload")
|
|
87
90
|
in IO
|
|
88
91
|
state[:can_retry] = false
|
|
92
|
+
value.to_path.nil? ? PostForMe::FilePart.new(value, filename: "upload") : value
|
|
89
93
|
in PostForMe::FilePart if value.content.is_a?(IO)
|
|
90
94
|
state[:can_retry] = false
|
|
95
|
+
value
|
|
91
96
|
else
|
|
97
|
+
value
|
|
92
98
|
end
|
|
93
|
-
# rubocop:enable Lint/DuplicateBranch
|
|
94
|
-
|
|
95
|
-
value
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
# @api private
|
|
@@ -566,7 +566,8 @@ module PostForMe
|
|
|
566
566
|
#
|
|
567
567
|
# @return [Array(String, Enumerable<String>)]
|
|
568
568
|
private def encode_multipart_streaming(body)
|
|
569
|
-
|
|
569
|
+
# RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
|
|
570
|
+
boundary = SecureRandom.urlsafe_base64(46)
|
|
570
571
|
|
|
571
572
|
closing = []
|
|
572
573
|
strio = writable_enum do |y|
|
|
@@ -647,7 +648,7 @@ module PostForMe
|
|
|
647
648
|
#
|
|
648
649
|
# Assumes each chunk in stream has `Encoding::BINARY`.
|
|
649
650
|
#
|
|
650
|
-
# @param headers [Hash{String=>String}
|
|
651
|
+
# @param headers [Hash{String=>String}]
|
|
651
652
|
# @param stream [Enumerable<String>]
|
|
652
653
|
# @param suppress_error [Boolean]
|
|
653
654
|
#
|
|
@@ -12,13 +12,128 @@ module PostForMe
|
|
|
12
12
|
# @!attribute media
|
|
13
13
|
# Overrides the `media` from the post
|
|
14
14
|
#
|
|
15
|
-
# @return [Array<
|
|
16
|
-
optional :media,
|
|
15
|
+
# @return [Array<PostForMe::Models::BlueskyConfigurationDto::Media>, nil]
|
|
16
|
+
optional :media,
|
|
17
|
+
-> { PostForMe::Internal::Type::ArrayOf[PostForMe::BlueskyConfigurationDto::Media] },
|
|
18
|
+
nil?: true
|
|
17
19
|
|
|
18
20
|
# @!method initialize(caption: nil, media: nil)
|
|
19
21
|
# @param caption [Object, nil] Overrides the `caption` from the post
|
|
20
22
|
#
|
|
21
|
-
# @param media [Array<
|
|
23
|
+
# @param media [Array<PostForMe::Models::BlueskyConfigurationDto::Media>, nil] Overrides the `media` from the post
|
|
24
|
+
|
|
25
|
+
class Media < PostForMe::Internal::Type::BaseModel
|
|
26
|
+
# @!attribute url
|
|
27
|
+
# Public URL of the media
|
|
28
|
+
#
|
|
29
|
+
# @return [String]
|
|
30
|
+
required :url, String
|
|
31
|
+
|
|
32
|
+
# @!attribute tags
|
|
33
|
+
# List of tags to attach to the media
|
|
34
|
+
#
|
|
35
|
+
# @return [Array<PostForMe::Models::BlueskyConfigurationDto::Media::Tag>, nil]
|
|
36
|
+
optional :tags,
|
|
37
|
+
-> { PostForMe::Internal::Type::ArrayOf[PostForMe::BlueskyConfigurationDto::Media::Tag] },
|
|
38
|
+
nil?: true
|
|
39
|
+
|
|
40
|
+
# @!attribute thumbnail_timestamp_ms
|
|
41
|
+
# Timestamp in milliseconds of frame to use as thumbnail for the media
|
|
42
|
+
#
|
|
43
|
+
# @return [Object, nil]
|
|
44
|
+
optional :thumbnail_timestamp_ms, PostForMe::Internal::Type::Unknown, nil?: true
|
|
45
|
+
|
|
46
|
+
# @!attribute thumbnail_url
|
|
47
|
+
# Public URL of the thumbnail for the media
|
|
48
|
+
#
|
|
49
|
+
# @return [Object, nil]
|
|
50
|
+
optional :thumbnail_url, PostForMe::Internal::Type::Unknown, nil?: true
|
|
51
|
+
|
|
52
|
+
# @!method initialize(url:, tags: nil, thumbnail_timestamp_ms: nil, thumbnail_url: nil)
|
|
53
|
+
# @param url [String] Public URL of the media
|
|
54
|
+
#
|
|
55
|
+
# @param tags [Array<PostForMe::Models::BlueskyConfigurationDto::Media::Tag>, nil] List of tags to attach to the media
|
|
56
|
+
#
|
|
57
|
+
# @param thumbnail_timestamp_ms [Object, nil] Timestamp in milliseconds of frame to use as thumbnail for the media
|
|
58
|
+
#
|
|
59
|
+
# @param thumbnail_url [Object, nil] Public URL of the thumbnail for the media
|
|
60
|
+
|
|
61
|
+
class Tag < PostForMe::Internal::Type::BaseModel
|
|
62
|
+
# @!attribute id
|
|
63
|
+
# Facebook User ID, Instagram Username or Instagram product id to tag
|
|
64
|
+
#
|
|
65
|
+
# @return [String]
|
|
66
|
+
required :id, String
|
|
67
|
+
|
|
68
|
+
# @!attribute platform
|
|
69
|
+
# The platform for the tags
|
|
70
|
+
#
|
|
71
|
+
# @return [Symbol, PostForMe::Models::BlueskyConfigurationDto::Media::Tag::Platform]
|
|
72
|
+
required :platform, enum: -> { PostForMe::BlueskyConfigurationDto::Media::Tag::Platform }
|
|
73
|
+
|
|
74
|
+
# @!attribute type
|
|
75
|
+
# The type of tag, user to tag accounts, product to tag products (only supported
|
|
76
|
+
# for instagram)
|
|
77
|
+
#
|
|
78
|
+
# @return [Symbol, PostForMe::Models::BlueskyConfigurationDto::Media::Tag::Type]
|
|
79
|
+
required :type, enum: -> { PostForMe::BlueskyConfigurationDto::Media::Tag::Type }
|
|
80
|
+
|
|
81
|
+
# @!attribute x
|
|
82
|
+
# Percentage distance from left edge of the image, Not required for videos or
|
|
83
|
+
# stories
|
|
84
|
+
#
|
|
85
|
+
# @return [Float, nil]
|
|
86
|
+
optional :x, Float
|
|
87
|
+
|
|
88
|
+
# @!attribute y_
|
|
89
|
+
# Percentage distance from top edge of the image, Not required for videos or
|
|
90
|
+
# stories
|
|
91
|
+
#
|
|
92
|
+
# @return [Float, nil]
|
|
93
|
+
optional :y_, Float, api_name: :y
|
|
94
|
+
|
|
95
|
+
# @!method initialize(id:, platform:, type:, x: nil, y_: nil)
|
|
96
|
+
# Some parameter documentations has been truncated, see
|
|
97
|
+
# {PostForMe::Models::BlueskyConfigurationDto::Media::Tag} for more details.
|
|
98
|
+
#
|
|
99
|
+
# @param id [String] Facebook User ID, Instagram Username or Instagram product id to tag
|
|
100
|
+
#
|
|
101
|
+
# @param platform [Symbol, PostForMe::Models::BlueskyConfigurationDto::Media::Tag::Platform] The platform for the tags
|
|
102
|
+
#
|
|
103
|
+
# @param type [Symbol, PostForMe::Models::BlueskyConfigurationDto::Media::Tag::Type] The type of tag, user to tag accounts, product to tag products (only supported f
|
|
104
|
+
#
|
|
105
|
+
# @param x [Float] Percentage distance from left edge of the image, Not required for videos or stor
|
|
106
|
+
#
|
|
107
|
+
# @param y_ [Float] Percentage distance from top edge of the image, Not required for videos or stori
|
|
108
|
+
|
|
109
|
+
# The platform for the tags
|
|
110
|
+
#
|
|
111
|
+
# @see PostForMe::Models::BlueskyConfigurationDto::Media::Tag#platform
|
|
112
|
+
module Platform
|
|
113
|
+
extend PostForMe::Internal::Type::Enum
|
|
114
|
+
|
|
115
|
+
FACEBOOK = :facebook
|
|
116
|
+
INSTAGRAM = :instagram
|
|
117
|
+
|
|
118
|
+
# @!method self.values
|
|
119
|
+
# @return [Array<Symbol>]
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# The type of tag, user to tag accounts, product to tag products (only supported
|
|
123
|
+
# for instagram)
|
|
124
|
+
#
|
|
125
|
+
# @see PostForMe::Models::BlueskyConfigurationDto::Media::Tag#type
|
|
126
|
+
module Type
|
|
127
|
+
extend PostForMe::Internal::Type::Enum
|
|
128
|
+
|
|
129
|
+
USER = :user
|
|
130
|
+
PRODUCT = :product
|
|
131
|
+
|
|
132
|
+
# @!method self.values
|
|
133
|
+
# @return [Array<Symbol>]
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
22
137
|
end
|
|
23
138
|
end
|
|
24
139
|
end
|