nohead 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4381c6ca769b33734069a6b117b59f03d1ebfa3b283698f2f20047b527bf376f
4
- data.tar.gz: 9b6dbcf5e1cc441cc10356a2d4b18ae0ae7485faeb4bba79a474ce045aa0150e
3
+ metadata.gz: 747275a28bad0e0410f52109f1bac03d8d703fedccafe3110f21ae904421d511
4
+ data.tar.gz: 696d827a38b169e1a047b38a40d9263417cff3f111cec74d825a77236072a62c
5
5
  SHA512:
6
- metadata.gz: c3491a32b9f27da5dc3ca67b2dbed3952508130cc04ee129954c8ecc4684e4e7fa36806e5914f34bba73ac2da4c43162ffd025891f03f77ad3d6151faa55d1fe
7
- data.tar.gz: 5da0e9d7a4869ae460a70737dd34a4e4b9a20fa61d3524a2f5bd0a1e8fa67de2f61886e0e1f003a0b575b0e20006f5529933dc49433e2d2d3d68189ce4913947
6
+ metadata.gz: e82adbab22c4ea949feccc1c347926b5c2a6795f087b02a8915255f4c7a49f56b53e088ae4b8579374c3db27a59c8bf12c428970d28f83124f047f120c08c7bb
7
+ data.tar.gz: 6c0c8b4dfc63a7eb8d89cc76030e7cf9797ba28541bd677b1da117b7975039d5b3742677230057ff29c4826ac7abf47acd1e3cfba3b38bb84809c4fa4cf233da
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ 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.4.0
9
+
10
+ - **Breaking:** a field's `api_key` is its `key` (in fields, their aliases,
11
+ `fields.create(..., key:)` and `fields.update(..., key:)`), as the
12
+ editor's "Field key" says. API keys keep their name.
13
+ - **Breaking:** `collections.schema_changes.get(schema_change)` takes the
14
+ schema change's ID alone (`GET /v1/schema-changes/{id}`).
15
+ - **Breaking:** `fields.update` no longer takes `type` or `multiple`; they
16
+ rewrite record values, so they are `fields.migrate`. The API refuses a
17
+ body key an operation doesn't take with `400` (`unknown_parameter`,
18
+ naming it), so a misspelt keyword no longer passes unnoticed.
19
+ - The contract types each field's `configuration` by field type; the API
20
+ reference lists each type's options.
21
+
8
22
  ## 0.3.0
9
23
 
10
24
  - **Upgrade required:** 0.1 and 0.2 no longer work with the current API,
data/README.md CHANGED
@@ -229,8 +229,8 @@ Search needs `search_enabled` collections and the `search:read` scope. It pages
229
229
 
230
230
  ```ruby
231
231
  nohead.collections.create(name: "Posts", slug: "posts",
232
- fields: [{ name: "Title", api_key: "title", type: "text", required: true }])
233
- nohead.fields.create("posts", name: "Summary", api_key: "summary", type: "long_text")
232
+ fields: [{ name: "Title", key: "title", type: "text", required: true }])
233
+ nohead.fields.create("posts", name: "Summary", key: "summary", type: "long_text")
234
234
 
235
235
  # Changes that rewrite records go through a migration; preview first
236
236
  preview = nohead.fields.migrate("fld_...", type: "long_text", dry_run: true)
data/lib/nohead/client.rb CHANGED
@@ -148,6 +148,10 @@ module Nohead
148
148
 
149
149
  def build_url(template, values)
150
150
  values = values.transform_keys(&:to_s)
151
+ # A value the template doesn't take is a method out of step with its operation.
152
+ unknown = values.keys - template.scan(/\{(\w+)\}/).flatten
153
+ raise ArgumentError, "#{unknown.join(', ')} is not a path parameter of #{template}" if unknown.any?
154
+
151
155
  values["project_id"] ||= project_id if template.include?("{project_id}")
152
156
  path = template.gsub(/\{(\w+)\}/) do
153
157
  value = values[Regexp.last_match(1)]
@@ -68,7 +68,7 @@ module Nohead
68
68
  "records_unschedule" => ["DELETE", "/v1/records/{record_id}/schedule"],
69
69
  "records_update" => ["PATCH", "/v1/records/{record_id}"],
70
70
  "scheduled_changes_list" => ["GET", "/v1/collections/{collection_id}/scheduled-changes"],
71
- "schema_changes_get" => ["GET", "/v1/collections/{collection_id}/schema-changes/{schema_change_id}"],
71
+ "schema_changes_get" => ["GET", "/v1/schema-changes/{schema_change_id}"],
72
72
  "schema_changes_list" => ["GET", "/v1/collections/{collection_id}/schema-changes"],
73
73
  "search_index_get" => ["GET", "/v1/collections/{collection_id}/search-index"],
74
74
  "search_index_rebuild" => ["POST", "/v1/collections/{collection_id}/search-index/rebuild"],
@@ -60,9 +60,8 @@ module Nohead
60
60
  query: { limit: limit, cursor: cursor })
61
61
  end
62
62
 
63
- def get(collection, schema_change)
64
- @client.request("schema_changes_get",
65
- path: { collection_id: collection, schema_change_id: schema_change })
63
+ def get(schema_change)
64
+ @client.request("schema_changes_get", path: { schema_change_id: schema_change })
66
65
  end
67
66
  end
68
67
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nohead
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nohead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nohead