nohead 0.6.0 → 0.7.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 +6 -0
- data/lib/nohead/resources/assets.rb +18 -4
- 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: 9b3361c68d640e8b2774b8e797bbf4108e19be21f0019600788d9f45e04457fe
|
|
4
|
+
data.tar.gz: d3c200b25b6afd1db440dced441f142da3d38b1731e34780356c373c2bc4b67c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 409ee914aaf232ce8f7109b4628f260f47f6b83861dceb48aebeaee661873c03f5ebef3ccbbd6e269504febad9325505a3b97a2f42905bb279e81d76aef70f18
|
|
7
|
+
data.tar.gz: 87b158ed9116745555538a9ef4297c584050251e69d0bab6101b823e239b3586262f161901f519973b1b07c4f2f2b76dfcd78ac86c55eedb905b208867d96d60
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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.7.0
|
|
9
|
+
|
|
10
|
+
- `assets.list(q:, kind:)`: `q` finds assets whose filename or alt text has
|
|
11
|
+
every word, ignoring case; `kind` lists only `image`, `video`, `audio`,
|
|
12
|
+
`document` or `other` assets, or several kinds as an array.
|
|
13
|
+
|
|
8
14
|
## 0.6.0
|
|
9
15
|
|
|
10
16
|
- API keys now start `nohead_sk_`, or `nohead_pk_` for published-only keys;
|
|
@@ -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)
|
|
@@ -106,6 +110,16 @@ module Nohead
|
|
|
106
110
|
def download_url(asset)
|
|
107
111
|
@client.request("assets_download_url", path: { asset_id: asset })
|
|
108
112
|
end
|
|
113
|
+
|
|
114
|
+
private
|
|
115
|
+
|
|
116
|
+
# One value as it is, several as `[in]`; an empty list (like an asset
|
|
117
|
+
# field's accepted_types) is no filter.
|
|
118
|
+
def one_or_in(value)
|
|
119
|
+
return value unless value.is_a?(Array)
|
|
120
|
+
|
|
121
|
+
value.empty? ? nil : { in: value }
|
|
122
|
+
end
|
|
109
123
|
end
|
|
110
124
|
end
|
|
111
125
|
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