og_pilot_ruby 0.4.1 → 0.4.3
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/README.md +448 -3
- data/lib/og_pilot_ruby/client.rb +20 -0
- data/lib/og_pilot_ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e2a983c2b0ced955a1d89e715316050384d6879ec31e328b391e1b7d6e788e9
|
|
4
|
+
data.tar.gz: a2e254954c6f260f493f10e86fd19b8a7d2a64781f9a970ad730bd51fc411962
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8fe9e289d37a64f41c9d578aba09477ce5e0fa9ea29a422ded261b9ab01b45c02cb7aff88581ed446bd2e5aafeb94c9f49b5762e374bfe6b63d6063985ec462b
|
|
7
|
+
data.tar.gz: 96d7f35d05dae228f048bae8e7ee55a046fc4480f2546b5153c3bf72763ccd7116efa41d59c6b9f71b9d651cd0d17aca71636dfaba6a62123d8a71a2c8257ef3
|
data/README.md
CHANGED
|
@@ -61,9 +61,19 @@ image_url = OgPilotRuby.create_image(
|
|
|
61
61
|
If you omit `iat`, OG Pilot will cache the image indefinitely. Provide an `iat` to
|
|
62
62
|
refresh the cache daily.
|
|
63
63
|
|
|
64
|
+
### Fail-safe behavior
|
|
65
|
+
|
|
66
|
+
`create_image` is non-blocking. If any error occurs (request, configuration,
|
|
67
|
+
validation, parsing, etc.), the gem does not raise to your app and logs an
|
|
68
|
+
error-level message instead.
|
|
69
|
+
|
|
70
|
+
- URL mode (`json: false`, default): returns `nil`
|
|
71
|
+
- JSON mode (`json: true`): returns `{ "image_url" => nil }`
|
|
72
|
+
|
|
64
73
|
### Template helpers
|
|
65
74
|
|
|
66
75
|
`create_image` defaults to the `page` template when `template` is omitted.
|
|
76
|
+
Supported templates: `page`, `blog_post`, `podcast`, `product`, `event`, `book`, `company`, `portfolio`, `github`.
|
|
67
77
|
|
|
68
78
|
Use these helpers to force a specific template:
|
|
69
79
|
|
|
@@ -74,6 +84,7 @@ Use these helpers to force a specific template:
|
|
|
74
84
|
- `OgPilotRuby.create_book_image(...)`
|
|
75
85
|
- `OgPilotRuby.create_company_image(...)`
|
|
76
86
|
- `OgPilotRuby.create_portfolio_image(...)`
|
|
87
|
+
- For `github`, use `OgPilotRuby.create_image(template: "github", ...)` (no dedicated helper yet).
|
|
77
88
|
|
|
78
89
|
Example:
|
|
79
90
|
|
|
@@ -85,6 +96,439 @@ image_url = OgPilotRuby.create_blog_post_image(
|
|
|
85
96
|
)
|
|
86
97
|
```
|
|
87
98
|
|
|
99
|
+
<!-- OG_SAMPLES_START -->
|
|
100
|
+
## OG Image Examples
|
|
101
|
+
|
|
102
|
+
All sample payloads set explicit `bg_color`, `text_color`, and logo/avatar URLs to avoid default branding fallbacks.
|
|
103
|
+
|
|
104
|
+
For templates that support custom images, this set includes both `with_custom_image` and `without_custom_image` variants. (`github` currently has no custom image slot.)
|
|
105
|
+
|
|
106
|
+
Avatar-style fields (for example `author_avatar_url`) use DiceBear Avataaars, e.g. `https://api.dicebear.com/7.x/avataaars/svg?seed=JaneSmith`.
|
|
107
|
+
|
|
108
|
+
### Sample Gallery
|
|
109
|
+
|
|
110
|
+
| Template | Variant | Preview |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| `page` | `with custom image` |  |
|
|
113
|
+
| `page` | `without custom image` |  |
|
|
114
|
+
| `blog_post` | `with custom image` |  |
|
|
115
|
+
| `blog_post` | `without custom image` |  |
|
|
116
|
+
| `podcast` | `with custom image` |  |
|
|
117
|
+
| `podcast` | `without custom image` |  |
|
|
118
|
+
| `product` | `with custom image` |  |
|
|
119
|
+
| `product` | `without custom image` |  |
|
|
120
|
+
| `event` | `with custom image` |  |
|
|
121
|
+
| `event` | `without custom image` |  |
|
|
122
|
+
| `book` | `with custom image` |  |
|
|
123
|
+
| `book` | `without custom image` |  |
|
|
124
|
+
| `portfolio` | `with custom image` |  |
|
|
125
|
+
| `portfolio` | `without custom image` |  |
|
|
126
|
+
| `company` | `with custom image` |  |
|
|
127
|
+
| `company` | `without custom image` |  |
|
|
128
|
+
| `github` | `default` |  |
|
|
129
|
+
|
|
130
|
+
### Parameters Used
|
|
131
|
+
|
|
132
|
+
<details>
|
|
133
|
+
<summary>Exact payloads for these samples</summary>
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
[
|
|
137
|
+
{
|
|
138
|
+
"id": "page_with_custom_image",
|
|
139
|
+
"template": "page",
|
|
140
|
+
"variant": "with_custom_image",
|
|
141
|
+
"params": {
|
|
142
|
+
"title": "Acme Robotics Product Updates",
|
|
143
|
+
"description": "See what shipped this week across the web app.",
|
|
144
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.notion.so",
|
|
145
|
+
"image_url": "https://images.unsplash.com/photo-1558655146-d09347e92766?w=1400&q=80",
|
|
146
|
+
"bg_color": "#0B1220",
|
|
147
|
+
"text_color": "#F8FAFC",
|
|
148
|
+
"template": "page"
|
|
149
|
+
},
|
|
150
|
+
"image_url": "https://img.ogpilot.com/1f6oY498I6SiNfqGDjwdHLNpwmeU264t2OL0k7tY8Mw/plain/s3://og-pilot-development/eoo5v45d766hf22j4r2al60ktali"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "page_without_custom_image",
|
|
154
|
+
"template": "page",
|
|
155
|
+
"variant": "without_custom_image",
|
|
156
|
+
"params": {
|
|
157
|
+
"title": "Notion AI Workspace for Product Teams",
|
|
158
|
+
"description": "Docs, specs, and roadmaps in one living workspace.",
|
|
159
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.notion.so",
|
|
160
|
+
"bg_color": "#111827",
|
|
161
|
+
"text_color": "#E5E7EB",
|
|
162
|
+
"template": "page"
|
|
163
|
+
},
|
|
164
|
+
"image_url": "https://img.ogpilot.com/9MZdTcTRyOoRqpTLll__EvDimmgojZESfZWokDqXeZM/plain/s3://og-pilot-development/wfa9es2wuvp6btjiriekk53swp6n"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "blog_post_with_custom_image",
|
|
168
|
+
"template": "blog_post",
|
|
169
|
+
"variant": "with_custom_image",
|
|
170
|
+
"params": {
|
|
171
|
+
"title": "How Stripe Reduced Checkout Abandonment by 18%",
|
|
172
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fstripe.com",
|
|
173
|
+
"image_url": "https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1400&q=80",
|
|
174
|
+
"author_name": "Maya Patel",
|
|
175
|
+
"author_avatar_url": "https://api.dicebear.com/7.x/avataaars/svg?seed=MayaPatel",
|
|
176
|
+
"publish_date": "2026-02-24",
|
|
177
|
+
"bg_color": "#0F172A",
|
|
178
|
+
"text_color": "#F8FAFC",
|
|
179
|
+
"template": "blog_post"
|
|
180
|
+
},
|
|
181
|
+
"image_url": "https://img.ogpilot.com/RBBQZnBrAKcVmFjJg6UtNqX8P6nRRQdGLrlJNWYif7I/plain/s3://og-pilot-development/je7pj816exul9umhyszqpnbxelmd"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "blog_post_without_custom_image",
|
|
185
|
+
"template": "blog_post",
|
|
186
|
+
"variant": "without_custom_image",
|
|
187
|
+
"params": {
|
|
188
|
+
"title": "Inside Vercel's Edge Rendering Playbook",
|
|
189
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fvercel.com",
|
|
190
|
+
"author_name": "Daniel Kim",
|
|
191
|
+
"author_avatar_url": "https://api.dicebear.com/7.x/avataaars/svg?seed=DanielKim",
|
|
192
|
+
"publish_date": "2026-02-18",
|
|
193
|
+
"bg_color": "#111827",
|
|
194
|
+
"text_color": "#E5E7EB",
|
|
195
|
+
"template": "blog_post"
|
|
196
|
+
},
|
|
197
|
+
"image_url": "https://img.ogpilot.com/yP1B7OrLOy9Iu9JDSNk9Veys3ESCuCSBM9il2wq13V4/plain/s3://og-pilot-development/6aei8frvun6kvqojoor1hqack31y"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"id": "podcast_with_custom_image",
|
|
201
|
+
"template": "podcast",
|
|
202
|
+
"variant": "with_custom_image",
|
|
203
|
+
"params": {
|
|
204
|
+
"title": "Indie Hackers Podcast: Pricing Experiments That Worked",
|
|
205
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.spotify.com",
|
|
206
|
+
"image_url": "https://images.unsplash.com/photo-1478737270239-2f02b77fc618?w=1400&q=80",
|
|
207
|
+
"episode_date": "2026-02-21",
|
|
208
|
+
"bg_color": "#18181B",
|
|
209
|
+
"text_color": "#FAFAFA",
|
|
210
|
+
"template": "podcast"
|
|
211
|
+
},
|
|
212
|
+
"image_url": "https://img.ogpilot.com/rzOOt7PWJ44OEwpKnntMLZaPvtl76DA3yRlj6B6N-Cc/plain/s3://og-pilot-development/fmkeblwertneuy4p82foeg5rfltl"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"id": "podcast_without_custom_image",
|
|
216
|
+
"template": "podcast",
|
|
217
|
+
"variant": "without_custom_image",
|
|
218
|
+
"params": {
|
|
219
|
+
"title": "Shopify Masters: Building a 7-Figure DTC Brand",
|
|
220
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.shopify.com",
|
|
221
|
+
"episode_date": "2026-02-19",
|
|
222
|
+
"bg_color": "#0B1120",
|
|
223
|
+
"text_color": "#E2E8F0",
|
|
224
|
+
"template": "podcast"
|
|
225
|
+
},
|
|
226
|
+
"image_url": "https://img.ogpilot.com/5UWWFG2J5bNRDOhDkN96ZG_g0XI9ULGDFgQkuVTjCYQ/plain/s3://og-pilot-development/yyhmo7lamj1n99i2n6dyttwungmq"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": "product_with_custom_image",
|
|
230
|
+
"template": "product",
|
|
231
|
+
"variant": "with_custom_image",
|
|
232
|
+
"params": {
|
|
233
|
+
"title": "Allbirds Tree Dasher 3",
|
|
234
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.allbirds.com",
|
|
235
|
+
"image_url": "https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=1400&q=80",
|
|
236
|
+
"unique_selling_point": "Free shipping + 30-day returns",
|
|
237
|
+
"bg_color": "#F8FAFC",
|
|
238
|
+
"text_color": "#0F172A",
|
|
239
|
+
"template": "product"
|
|
240
|
+
},
|
|
241
|
+
"image_url": "https://img.ogpilot.com/mzmHDMjyAX4VlpJanMT3zpmIJgSuClYI5eofhFpSJNQ/plain/s3://og-pilot-development/8ls2legb316l9vak40nu388uzy2t"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"id": "product_without_custom_image",
|
|
245
|
+
"template": "product",
|
|
246
|
+
"variant": "without_custom_image",
|
|
247
|
+
"params": {
|
|
248
|
+
"title": "Bose QuietComfort Ultra",
|
|
249
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.bose.com",
|
|
250
|
+
"unique_selling_point": "Save $70 this weekend",
|
|
251
|
+
"bg_color": "#111827",
|
|
252
|
+
"text_color": "#F9FAFB",
|
|
253
|
+
"template": "product"
|
|
254
|
+
},
|
|
255
|
+
"image_url": "https://img.ogpilot.com/kK6d7xU3EWT5WKC6jKCw1rhJDmv9bwvRn2S-nShV4NA/plain/s3://og-pilot-development/52ns2l1ll7hjhfg0p3wn5c9pqtr5"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"id": "event_with_custom_image",
|
|
259
|
+
"template": "event",
|
|
260
|
+
"variant": "with_custom_image",
|
|
261
|
+
"params": {
|
|
262
|
+
"title": "Launch Week Berlin 2026",
|
|
263
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.eventbrite.com",
|
|
264
|
+
"image_url": "https://images.unsplash.com/photo-1540575467063-178a50c2df87?w=1400&q=80",
|
|
265
|
+
"event_date": "2026-06-12/2026-06-14",
|
|
266
|
+
"event_location": "Station Berlin",
|
|
267
|
+
"bg_color": "#1E1B4B",
|
|
268
|
+
"text_color": "#F5F3FF",
|
|
269
|
+
"template": "event"
|
|
270
|
+
},
|
|
271
|
+
"image_url": "https://img.ogpilot.com/A7nxHkYs4xN4c1PhH2KQSWoB4ALwBdpP0HPiAss9_70/plain/s3://og-pilot-development/vjkdf6cx82dvdxmhiwtvrvkl976d"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"id": "event_without_custom_image",
|
|
275
|
+
"template": "event",
|
|
276
|
+
"variant": "without_custom_image",
|
|
277
|
+
"params": {
|
|
278
|
+
"title": "RubyConf Chicago 2026",
|
|
279
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Frubyconf.org",
|
|
280
|
+
"event_date": "2026-11-17",
|
|
281
|
+
"event_location": "Chicago, IL",
|
|
282
|
+
"bg_color": "#312E81",
|
|
283
|
+
"text_color": "#EEF2FF",
|
|
284
|
+
"template": "event"
|
|
285
|
+
},
|
|
286
|
+
"image_url": "https://img.ogpilot.com/elpfu28vJ57XCGx3npKhCwXqqJnPoqwCm8Aj5SLkWsM/plain/s3://og-pilot-development/vpte818nvtegc60ta98q7pmw91c8"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"id": "book_with_custom_image",
|
|
290
|
+
"template": "book",
|
|
291
|
+
"variant": "with_custom_image",
|
|
292
|
+
"params": {
|
|
293
|
+
"title": "Designing APIs for Humans",
|
|
294
|
+
"description": "A practical handbook for product-minded engineers.",
|
|
295
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.oreilly.com",
|
|
296
|
+
"image_url": "https://images.unsplash.com/photo-1512820790803-83ca734da794?w=1400&q=80",
|
|
297
|
+
"book_author": "Alex Turner",
|
|
298
|
+
"book_series_number": "2",
|
|
299
|
+
"book_genre": "Technology",
|
|
300
|
+
"bg_color": "#172554",
|
|
301
|
+
"text_color": "#EFF6FF",
|
|
302
|
+
"template": "book"
|
|
303
|
+
},
|
|
304
|
+
"image_url": "https://img.ogpilot.com/7pidSkvU_l0RzY9xBOLSa2x-jDWWvx14Gtv-KMDCGLw/plain/s3://og-pilot-development/cwnhb631ls2olk0yzkukmr5dnf7e"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"id": "book_without_custom_image",
|
|
308
|
+
"template": "book",
|
|
309
|
+
"variant": "without_custom_image",
|
|
310
|
+
"params": {
|
|
311
|
+
"title": "The Product Operating System",
|
|
312
|
+
"description": "How modern teams ship with confidence.",
|
|
313
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.penguinrandomhouse.com",
|
|
314
|
+
"book_author": "Sofia Ramirez",
|
|
315
|
+
"book_series_number": "1",
|
|
316
|
+
"book_genre": "Business",
|
|
317
|
+
"bg_color": "#1E293B",
|
|
318
|
+
"text_color": "#F8FAFC",
|
|
319
|
+
"template": "book"
|
|
320
|
+
},
|
|
321
|
+
"image_url": "https://img.ogpilot.com/FpMbBN15SLgaK9FEX07xXcT5dQIWyZkFdHaZ9i5wx3U/plain/s3://og-pilot-development/0rzisfn2qswdzsz641rl3s29ngu9"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"id": "portfolio_with_custom_image",
|
|
325
|
+
"template": "portfolio",
|
|
326
|
+
"variant": "with_custom_image",
|
|
327
|
+
"params": {
|
|
328
|
+
"title": "Maya Chen • Product Designer",
|
|
329
|
+
"description": "Fintech UX, design systems, and prototyping.",
|
|
330
|
+
"logo_url": "https://api.dicebear.com/7.x/avataaars/svg?seed=MayaChen&size=64",
|
|
331
|
+
"image_url": "https://images.unsplash.com/photo-1557672172-298e090bd0f1?w=1400&q=80",
|
|
332
|
+
"bg_color": "#1F2937",
|
|
333
|
+
"text_color": "#F9FAFB",
|
|
334
|
+
"template": "portfolio"
|
|
335
|
+
},
|
|
336
|
+
"image_url": "https://img.ogpilot.com/gauiw2MMcNLLSFnQ07Hq3flv4S0L-89lnnjUOO0VgYU/plain/s3://og-pilot-development/qok04llq0ff3d2lherudwlhqxslm"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"id": "portfolio_without_custom_image",
|
|
340
|
+
"template": "portfolio",
|
|
341
|
+
"variant": "without_custom_image",
|
|
342
|
+
"params": {
|
|
343
|
+
"title": "Arjun Rao • Frontend Engineer",
|
|
344
|
+
"description": "React performance, accessibility, and DX.",
|
|
345
|
+
"logo_url": "https://api.dicebear.com/7.x/avataaars/svg?seed=ArjunRao&size=64",
|
|
346
|
+
"bg_color": "#0F172A",
|
|
347
|
+
"text_color": "#E2E8F0",
|
|
348
|
+
"template": "portfolio"
|
|
349
|
+
},
|
|
350
|
+
"image_url": "https://img.ogpilot.com/jVck9SDPlei0gaHq44_itLoVzn2wINrCP3XCTQF3SYs/plain/s3://og-pilot-development/jxa1s7dtibaeqamh0fsymwz7uqrx"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"id": "company_with_custom_image",
|
|
354
|
+
"template": "company",
|
|
355
|
+
"variant": "with_custom_image",
|
|
356
|
+
"params": {
|
|
357
|
+
"title": "Notion",
|
|
358
|
+
"description": "4 job openings",
|
|
359
|
+
"logo_url": "https://www.google.com/s2/favicons?sz=128&domain_url=https%3A%2F%2Fwww.notion.so",
|
|
360
|
+
"bg_color": "#111827",
|
|
361
|
+
"text_color": "#F9FAFB",
|
|
362
|
+
"template": "company"
|
|
363
|
+
},
|
|
364
|
+
"image_url": "https://img.ogpilot.com/rji7hNgoxRM1KF2GofIO9gqXJQNg5CqlPWbhbGpR4FA/plain/s3://og-pilot-development/2xl6zi3zgjm74izr46efduzhmbrr"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"id": "company_without_custom_image",
|
|
368
|
+
"template": "company",
|
|
369
|
+
"variant": "without_custom_image",
|
|
370
|
+
"params": {
|
|
371
|
+
"title": "Linear",
|
|
372
|
+
"description": "12 job openings",
|
|
373
|
+
"company_logo_url": "https://www.google.com/s2/favicons?sz=256&domain_url=https%3A%2F%2Flinear.app",
|
|
374
|
+
"bg_color": "#0B1220",
|
|
375
|
+
"text_color": "#E5E7EB",
|
|
376
|
+
"template": "company",
|
|
377
|
+
"iss": "gitdigest.ai"
|
|
378
|
+
},
|
|
379
|
+
"image_url": "https://img.ogpilot.com/PgGl9a6xPmG0Tn7qKmZZUczrv43cNLxzyISsbHG8_oE/plain/s3://og-pilot-development/6gmm6jg5r8ya27r3tr215edfd972"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"id": "github_activity",
|
|
383
|
+
"template": "github",
|
|
384
|
+
"variant": "default",
|
|
385
|
+
"params": {
|
|
386
|
+
"title": "rails/rails",
|
|
387
|
+
"description": "Recent merged PRs, reviews, and commit activity.",
|
|
388
|
+
"accent_color": "#22C55E",
|
|
389
|
+
"bg_color": "#0B1220",
|
|
390
|
+
"text_color": "#E5E7EB",
|
|
391
|
+
"contributions": [
|
|
392
|
+
{
|
|
393
|
+
"date": "2025-10-28",
|
|
394
|
+
"count": 6
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"date": "2025-11-01",
|
|
398
|
+
"count": 3
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"date": "2025-11-05",
|
|
402
|
+
"count": 9
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"date": "2025-11-08",
|
|
406
|
+
"count": 12
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"date": "2025-11-12",
|
|
410
|
+
"count": 7
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"date": "2025-11-16",
|
|
414
|
+
"count": 11
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"date": "2025-11-20",
|
|
418
|
+
"count": 5
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"date": "2025-11-24",
|
|
422
|
+
"count": 14
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"date": "2025-11-28",
|
|
426
|
+
"count": 8
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"date": "2025-12-02",
|
|
430
|
+
"count": 4
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"date": "2025-12-06",
|
|
434
|
+
"count": 10
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"date": "2025-12-10",
|
|
438
|
+
"count": 15
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"date": "2025-12-14",
|
|
442
|
+
"count": 6
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"date": "2025-12-18",
|
|
446
|
+
"count": 9
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"date": "2025-12-22",
|
|
450
|
+
"count": 13
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"date": "2025-12-26",
|
|
454
|
+
"count": 4
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"date": "2025-12-30",
|
|
458
|
+
"count": 7
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"date": "2026-01-03",
|
|
462
|
+
"count": 11
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"date": "2026-01-07",
|
|
466
|
+
"count": 16
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"date": "2026-01-11",
|
|
470
|
+
"count": 12
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"date": "2026-01-15",
|
|
474
|
+
"count": 6
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"date": "2026-01-19",
|
|
478
|
+
"count": 8
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"date": "2026-01-23",
|
|
482
|
+
"count": 14
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"date": "2026-01-27",
|
|
486
|
+
"count": 9
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"date": "2026-01-31",
|
|
490
|
+
"count": 5
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"date": "2026-02-04",
|
|
494
|
+
"count": 13
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"date": "2026-02-08",
|
|
498
|
+
"count": 17
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"date": "2026-02-12",
|
|
502
|
+
"count": 10
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"date": "2026-02-16",
|
|
506
|
+
"count": 7
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"date": "2026-02-20",
|
|
510
|
+
"count": 12
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"date": "2026-02-24",
|
|
514
|
+
"count": 9
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
"template": "github"
|
|
518
|
+
},
|
|
519
|
+
"image_url": "https://img.ogpilot.com/0dxm83dTyNCg5Dq_GZFT4SqsRyTWUO31d0HQwjIq0-A/plain/s3://og-pilot-development/jlhwskjsx08x56attaljw3ce0p65"
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
</details>
|
|
525
|
+
|
|
526
|
+
<!-- OG_SAMPLES_END -->
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
88
532
|
## Parameters
|
|
89
533
|
|
|
90
534
|
The client sends `POST /api/v1/images` requests. All parameters are embedded in the signed JWT payload; the only query param is `token`.
|
|
@@ -119,7 +563,7 @@ The gem handles `iss` (domain) and `sub` (API key prefix) automatically.
|
|
|
119
563
|
|
|
120
564
|
| Option | Default | Description |
|
|
121
565
|
|-----------|---------|--------------------------------------------------------------------------|
|
|
122
|
-
| `json` | `false` | When `true`, sends `Accept: application/json` and parses the JSON response |
|
|
566
|
+
| `json` | `false` | When `true`, sends `Accept: application/json` and parses the JSON response. On failure, returns `{ "image_url" => nil }` |
|
|
123
567
|
| `headers` | — | Additional HTTP headers to include with the request |
|
|
124
568
|
| `default` | `false` | Forces `path` to `/` when `true`, unless a manual `path` is provided (see [Path handling](#path-handling)) |
|
|
125
569
|
|
|
@@ -135,6 +579,7 @@ The gem handles `iss` (domain) and `sub` (API key prefix) automatically.
|
|
|
135
579
|
| `book` | `title`, `description`, `book_author`, `book_series_number`, `book_description`, `book_genre` |
|
|
136
580
|
| `portfolio` | `title` |
|
|
137
581
|
| `company` | `title`, `company_logo_url`, `description` (note: `image_url` is ignored) |
|
|
582
|
+
| `github` | `title`, `description`, `contributions` (array of `{ date, count }`), `accent_color` |
|
|
138
583
|
|
|
139
584
|
### Path handling
|
|
140
585
|
|
|
@@ -173,7 +618,7 @@ Fetch JSON metadata instead:
|
|
|
173
618
|
```ruby
|
|
174
619
|
payload = {
|
|
175
620
|
template: "page",
|
|
176
|
-
title: "Hello OG Pilot"
|
|
621
|
+
title: "Hello OG Pilot"
|
|
177
622
|
}
|
|
178
623
|
|
|
179
624
|
data = OgPilotRuby.create_image(**payload, json: true)
|
|
@@ -190,7 +635,7 @@ Multiple extensions are also stripped (`/archive.tar.gz` becomes `/archive`).
|
|
|
190
635
|
Dotfiles like `/.hidden` are left unchanged. Query strings are preserved.
|
|
191
636
|
|
|
192
637
|
```ruby
|
|
193
|
-
OgPilotRuby.configure do |config
|
|
638
|
+
OgPilotRuby.configure do |config|
|
|
194
639
|
config.strip_extensions = true
|
|
195
640
|
end
|
|
196
641
|
|
data/lib/og_pilot_ruby/client.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
require "logger"
|
|
4
5
|
require "net/http"
|
|
5
6
|
require "uri"
|
|
6
7
|
|
|
@@ -32,12 +33,31 @@ module OgPilotRuby
|
|
|
32
33
|
else
|
|
33
34
|
response["Location"] || final_uri.to_s
|
|
34
35
|
end
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
log_create_image_failure(e, json:)
|
|
38
|
+
json ? { "image_url" => nil } : nil
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
private
|
|
38
42
|
|
|
39
43
|
attr_reader :config
|
|
40
44
|
|
|
45
|
+
def log_create_image_failure(error, json:)
|
|
46
|
+
mode = json ? "json" : "url"
|
|
47
|
+
message = "OgPilotRuby create_image failed (mode=#{mode}): #{error.class}: #{error.message}"
|
|
48
|
+
create_image_logger&.error(message)
|
|
49
|
+
rescue StandardError
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def create_image_logger
|
|
54
|
+
if defined?(::Rails) && ::Rails.respond_to?(:logger) && ::Rails.logger
|
|
55
|
+
::Rails.logger
|
|
56
|
+
else
|
|
57
|
+
@create_image_logger ||= Logger.new($stderr)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
41
61
|
def request(uri, json:, headers:, method: :post, redirects_left: MAX_REDIRECTS)
|
|
42
62
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
43
63
|
http.use_ssl = uri.scheme == "https"
|