nohead 0.6.0 → 0.8.0
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 +20 -0
- data/README.md +1 -1
- data/lib/nohead/operations.rb +0 -1
- data/lib/nohead/resources/assets.rb +16 -7
- data/lib/nohead/resources/records.rb +3 -3
- data/lib/nohead/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: aaf4c7fc6c9f1c9783210f08d5d42cd01aa7ae30e3b30f3398c5bc5eb252c960
|
|
4
|
+
data.tar.gz: afd201145f4734efbb695c717b8073c5f100fac11fdec822467dc4345ea7a1de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff59ead7b5f84026e63d42fd7751c272b7eff489fad447f0bd397f00d21ab57cb475fd989c0bca218efdcc5abcfdf44e681a91a2a0c0c61252b508d08a6e09c4
|
|
7
|
+
data.tar.gz: 21afb854940c2fdda4181b0c8a03e9accd46127e16fe2f7455f17f0fb0e6ab1b8f7033ac414cee25917c599d59d832ae6f7e185759f8571b15588ebc5d9a300c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ Changes to the `nohead` gem that you can notice. Versions follow
|
|
|
5
5
|
releases; a change that could break your code is a major one. Each release's
|
|
6
6
|
section is its GitHub release's notes.
|
|
7
7
|
|
|
8
|
+
## 0.8.0
|
|
9
|
+
|
|
10
|
+
- Assets have `file_url`, the file as uploaded, which downloads under its
|
|
11
|
+
filename, and for video and audio `media_url`, which plays it inline (in
|
|
12
|
+
`<video>` and `<audio>`, with range requests). Both are open, never expire
|
|
13
|
+
and are cached on a CDN, like `image_url`.
|
|
14
|
+
|
|
15
|
+
- `assets.download_url` is removed, with the API's
|
|
16
|
+
`GET /v1/assets/{asset_id}/download-url` and its 2-minute links: use the
|
|
17
|
+
asset's `file_url`.
|
|
18
|
+
|
|
19
|
+
- An upload larger than the plan allows (10 MB a file on Free, 100 MB on paid
|
|
20
|
+
plans) is refused with a `Nohead::PlanLimitExceededError` when it starts.
|
|
21
|
+
|
|
22
|
+
## 0.7.0
|
|
23
|
+
|
|
24
|
+
- `assets.list(q:, kind:)`: `q` finds assets whose filename or alt text has
|
|
25
|
+
every word, ignoring case; `kind` lists only `image`, `video`, `audio`,
|
|
26
|
+
`document` or `other` assets, or several kinds as an array.
|
|
27
|
+
|
|
8
28
|
## 0.6.0
|
|
9
29
|
|
|
10
30
|
- API keys now start `nohead_sk_`, or `nohead_pk_` for published-only keys;
|
data/README.md
CHANGED
|
@@ -299,7 +299,7 @@ The API's resources come back as `Nohead::NoheadObject`s.
|
|
|
299
299
|
| `collections.search_index` | `get`, `rebuild` |
|
|
300
300
|
| `fields` | `list`, `get`, `create`, `update`, `delete`, `restore`, `order`, `reorder`, `remove_alias` |
|
|
301
301
|
| `migrations` | `create`, `list`, `get`, `cancel` |
|
|
302
|
-
| `assets` | `upload`, `create_upload`, `complete`, `list`, `get`, `update`, `delete`, `restore`, `purge`, `usage
|
|
302
|
+
| `assets` | `upload`, `create_upload`, `complete`, `list`, `get`, `update`, `delete`, `restore`, `purge`, `usage` |
|
|
303
303
|
| `webhooks` | `list`, `get`, `create`, `update`, `delete`, `restore`, `rotate_secret`, `test`, `unwrap` |
|
|
304
304
|
| `webhooks.secrets` | `list`, `retire` |
|
|
305
305
|
| `webhooks.deliveries` | `list`, `get`, `retry` |
|
data/lib/nohead/operations.rb
CHANGED
|
@@ -6,7 +6,6 @@ module Nohead
|
|
|
6
6
|
OPERATIONS = {
|
|
7
7
|
"assets_complete" => ["POST", "/v1/assets/{asset_id}/complete"],
|
|
8
8
|
"assets_delete" => ["DELETE", "/v1/assets/{asset_id}"],
|
|
9
|
-
"assets_download_url" => ["GET", "/v1/assets/{asset_id}/download-url"],
|
|
10
9
|
"assets_get" => ["GET", "/v1/assets/{asset_id}"],
|
|
11
10
|
"assets_list" => ["GET", "/v1/projects/{project_id}/assets"],
|
|
12
11
|
"assets_purge" => ["POST", "/v1/assets/{asset_id}/purge"],
|
|
@@ -54,14 +54,18 @@ module Nohead
|
|
|
54
54
|
@client.request("assets_complete", path: { asset_id: asset }, idempotency_key: idempotency_key)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
# `q` finds assets whose filename or alt text has every word, ignoring
|
|
58
|
+
# case ("hero jpg" finds `Hero-banner.jpg`). `kind` lists only assets of
|
|
59
|
+
# a kind ("image", "video", "audio", "document" or "other"), or of
|
|
60
|
+
# several (%w[image video]).
|
|
61
|
+
#
|
|
57
62
|
# `content_type` lists only assets of a MIME type or `type/*` wildcard
|
|
58
63
|
# ("image/*"), or of several (["image/*", "application/pdf"]), for
|
|
59
64
|
# example the ones an asset field accepts (its `accepted_types`; an
|
|
60
65
|
# empty list, like a field's, means any type).
|
|
61
|
-
def list(content_type: nil, deleted: nil, limit: nil, cursor: nil)
|
|
62
|
-
|
|
63
|
-
@client.paginate("assets_list", query: { filter:
|
|
64
|
-
limit: limit, cursor: cursor })
|
|
66
|
+
def list(q: nil, kind: nil, content_type: nil, deleted: nil, limit: nil, cursor: nil)
|
|
67
|
+
filter = { kind: one_or_in(kind), content_type: one_or_in(content_type), deleted: deleted }
|
|
68
|
+
@client.paginate("assets_list", query: { q: q, filter: filter, limit: limit, cursor: cursor })
|
|
65
69
|
end
|
|
66
70
|
|
|
67
71
|
def get(asset)
|
|
@@ -102,9 +106,14 @@ module Nohead
|
|
|
102
106
|
@client.request("assets_usage", path: { asset_id: asset })
|
|
103
107
|
end
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
private
|
|
110
|
+
|
|
111
|
+
# One value as it is, several as `[in]`; an empty list (like an asset
|
|
112
|
+
# field's accepted_types) is no filter.
|
|
113
|
+
def one_or_in(value)
|
|
114
|
+
return value unless value.is_a?(Array)
|
|
115
|
+
|
|
116
|
+
value.empty? ? nil : { in: value }
|
|
108
117
|
end
|
|
109
118
|
end
|
|
110
119
|
end
|
|
@@ -126,9 +126,9 @@ module Nohead
|
|
|
126
126
|
@client.paginate("record_drafts_list", path: { record_id: record }, query: { limit: limit, cursor: cursor })
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
-
# A collection's pending scheduled
|
|
130
|
-
#
|
|
131
|
-
# appears twice.
|
|
129
|
+
# A collection's pending scheduled changes, soonest first: publishes,
|
|
130
|
+
# unpublishes and draft merges, one per change, so a record due to
|
|
131
|
+
# publish and later unpublish appears twice.
|
|
132
132
|
def scheduled_changes(collection, sort: nil, limit: nil, cursor: nil)
|
|
133
133
|
@client.paginate("scheduled_changes_list", path: { collection_id: collection },
|
|
134
134
|
query: { sort: sort, limit: limit, cursor: cursor })
|
data/lib/nohead/version.rb
CHANGED