decko 0.19.0 → 0.20.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: 495ff18be09fd0a855ba73e7f838c9cbc1d507b829b141f34f85dc857329abc6
4
- data.tar.gz: 251b5ebedf62755d618cbc86dba4b22679c73a2196e5a833e240459b9c89b136
3
+ metadata.gz: b56b11720b70b74485415b9e281118737e4badaa8a0a5bd96b85382f2cd5f08f
4
+ data.tar.gz: a45cd70c209878b062bf0e202b066eb6e51deddf88f529e058401c55dc7e682d
5
5
  SHA512:
6
- metadata.gz: 93147d66836e565aa102f0dd21d647e879d4df23977cb7e60339543519528a199a6436b5e540169d24848aab1a9e629584ef780e6367c376138f605e045ff9d8
7
- data.tar.gz: dad7ee2230dda1e05f2cc707872753212ce5ac787bf56233207155f62d475f03eb518cab32cc48a1cba342db8f3403ad5ff48ee8cc08771e467f5ed2a9559d4a
6
+ metadata.gz: ab76c77af818df10f4a00add8382f2dd631bc849146c86db004a3285b9aad4e557e518222b746b01e04160b49fe392c4945dfb7459848749b60e7d23906d7eab
7
+ data.tar.gz: cc14006108a5a0c5da298dd4dcae1b558aa57252d3247d3440e341df9254d3f401be28a1f1b740600d3eb338a3c5711e451a92d897daefc729343a79d003dbfa
@@ -16,7 +16,7 @@ Decko::Engine.routes.draw do
16
16
  end
17
17
 
18
18
  # Standard GET requests
19
- get "(/decko)/:mark(.:format)" => "card#read" # /decko is deprecated
19
+ get "/:mark(.:format)" => "card#read" # /decko is deprecated
20
20
 
21
21
  # Alternate GET requests
22
22
  get "new/:type" => "card#read", view: "new" # common case for card without mark
@@ -1,4 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  # Uncomment this if we can show that cookies are not secure in production
@@ -92,7 +92,7 @@ class CardController
92
92
 
93
93
  def load_format status
94
94
  request.format = :html if implicit_html?
95
- card.format(response_format).tap { |fmt| fmt.error_status = status }
95
+ @format = card.format(response_format).tap { |fmt| fmt.error_status = status }
96
96
  end
97
97
 
98
98
  def implicit_html?
@@ -100,13 +100,16 @@ class CardController
100
100
  end
101
101
 
102
102
  def format_name_from_params
103
- return :file if explicit_file_format?
103
+ rf = requested_format
104
+ explicit_file_format?(rf) ? :file : rf.to_sym
105
+ end
104
106
 
105
- (params[:format].present? ? params[:format] : request.format).to_sym
107
+ def explicit_file_format? rf
108
+ params[:explicit_file] || !Card::Format.registered.member?(rf)
106
109
  end
107
110
 
108
- def explicit_file_format?
109
- params[:explicit_file] || !Card::Format.registered.member?(request.format)
111
+ def requested_format
112
+ params[:format].present? ? params[:format].to_s : request.format
110
113
  end
111
114
  end
112
115
  end
@@ -90,10 +90,10 @@ class CardController
90
90
 
91
91
  def show view=nil, status=200
92
92
  card.action = :read
93
- format = load_format status
94
- result = render_page format, view
95
- status = format.error_status || status
96
- respond format, result, status
93
+ load_format status
94
+ result = render_page @format, view
95
+ status = @format.error_status || status
96
+ respond @format, result, status
97
97
  end
98
98
 
99
99
  def render_page format, view
@@ -15,7 +15,7 @@ class CardController < ActionController::Base
15
15
  include ::Card::Env::Location
16
16
 
17
17
  layout nil
18
- attr_reader :card
18
+ attr_reader :card, :format
19
19
 
20
20
  before_action :setup, except: [:asset]
21
21
  before_action :authenticate, except: [:asset]
@@ -10,7 +10,7 @@ module Decko
10
10
  def map
11
11
  @map ||= super.merge(
12
12
  server: { desc: "start a local web server", group: :shark, alias: :s },
13
- cucumber: { desc: "run cucumber tests", group: :monkey, alias: :cc, via: :call}
13
+ cucumber: { desc: "run cucumber tests", group: :monkey, alias: :cc, via: :call }
14
14
  )
15
15
  end
16
16
 
@@ -18,6 +18,7 @@ module Decko
18
18
  routes { Decko::Engine.routes }
19
19
  include Capybara::DSL
20
20
  include RestSpecMethods
21
+
21
22
  instance_eval(&block)
22
23
  end
23
24
  end
@@ -170,8 +170,8 @@ components:
170
170
  request will be redirected. Eg, `success[mark]=mycardname`
171
171
 
172
172
  schemas:
173
- "nucleus view":
174
- name: "nucleus view"
173
+ nucleus_view:
174
+ name: nucleus view
175
175
  type: object
176
176
  properties:
177
177
  id:
@@ -186,8 +186,8 @@ components:
186
186
  codename:
187
187
  type: string
188
188
 
189
- "atom view":
190
- name: "atom view"
189
+ atom_view:
190
+ name: atom view
191
191
  type: object
192
192
  properties:
193
193
  id:
@@ -204,7 +204,7 @@ components:
204
204
  content:
205
205
  type: string
206
206
 
207
- "molecule view":
207
+ molecule_view:
208
208
  type: object
209
209
  properties:
210
210
  id:
@@ -214,7 +214,7 @@ components:
214
214
  url:
215
215
  type: string
216
216
  type:
217
- $ref: '#/components/schemas/nucleus%20view'
217
+ $ref: '#/components/schemas/nucleus_view'
218
218
  codename:
219
219
  type: string
220
220
  content:
@@ -224,7 +224,7 @@ components:
224
224
  items:
225
225
  type: array
226
226
  items:
227
- $ref: '#/components/schemas/atom%20view'
227
+ $ref: '#/components/schemas/atom_view'
228
228
  links:
229
229
  type: array
230
230
  items:
@@ -232,9 +232,9 @@ components:
232
232
  ancestors:
233
233
  type: array
234
234
  items:
235
- $ref: "#/components/schemas/atom%20view"
235
+ $ref: "#/components/schemas/atom_view"
236
236
 
237
- "errors view":
237
+ errors_view:
238
238
  type: object
239
239
  properties:
240
240
  error_status:
@@ -245,20 +245,20 @@ components:
245
245
  type: string
246
246
 
247
247
  responses:
248
- 200:
248
+ "200":
249
249
  description: |-
250
250
  Card data. Defaults to molecule view.
251
251
  content:
252
252
  application/json:
253
253
  schema:
254
- $ref: '#/components/schemas/molecule%20view'
255
- 404:
254
+ $ref: '#/components/schemas/molecule_view'
255
+ "404":
256
256
  description: "Could not find the card requested."
257
257
  content:
258
258
  application/json:
259
259
  schema:
260
- $ref: '#/components/schemas/errors%20view'
261
- 302:
260
+ $ref: '#/components/schemas/errors_view'
261
+ "302":
262
262
  description: |-
263
263
  Successful non-idempotent requests redirect to idempotent GET
264
264
  requests.
@@ -1,105 +1,120 @@
1
- ---
2
1
  openapi: 3.0.0
3
2
  info:
4
- description: |-
3
+ description: >-
5
4
  Decko organizes data into "cards." Decko's API supports retrieval and alteration of card data.
5
+
6
6
  To get the JSON responses as described below, do _any_ of the following:
7
7
  1. Set the http Accept header to `application/json` in your request
8
8
  2. Add `.json` to the url, or
9
9
  3. Add `format=json` to the query params.
10
- version: 0.8.0
10
+
11
+ version: "0.8.0"
11
12
  title: Decko API
12
13
  contact:
13
14
  email: info@decko.org
14
15
  license:
15
16
  name: GPL-2.0
16
- url: https://opensource.org/licenses/GPL-2.0
17
+ url: 'https://opensource.org/licenses/GPL-2.0'
17
18
  tags:
18
- - name: create
19
- - name: read
20
- - name: update
21
- - name: delete
19
+ - name: create
20
+ - name: read
21
+ - name: update
22
+ - name: delete
23
+
22
24
  paths:
23
- "/{mark}":
25
+ /{mark}:
24
26
  get:
25
27
  tags:
26
- - read
27
- summary: get specified view of card
28
+ - Decko
29
+ summary: "get specified view of card"
28
30
  description: |-
29
31
  All read operations involve producing a _view_ of a card.
32
+
30
33
  The request can come in several variants, eg\:
31
34
  1. /{mark}?view={view} (standard)
32
35
  1. /{mark}/{view}
33
36
  1. /?mark={mark}&view={view}
37
+
34
38
  parameters:
35
- - "$ref": "#/components/parameters/cardmark"
36
- - "$ref": "#/components/parameters/view"
39
+ - $ref: '#/components/parameters/cardmark'
40
+ - $ref: '#/components/parameters/view'
37
41
  responses:
38
42
  200:
39
- "$ref": "#/components/responses/200"
43
+ $ref: '#/components/responses/200'
40
44
  404:
41
- "$ref": "#/components/responses/404"
45
+ $ref: '#/components/responses/404'
42
46
  put:
43
47
  tags:
44
- - update
45
- summary: update a card
48
+ - Decko
49
+ summary: "update a card"
50
+ description: |-
51
+ Update a card's name, type, and/or content. It's also possible to use
52
+ a GET request with /update/{mark}
46
53
  parameters:
47
- - "$ref": "#/components/parameters/cardmark"
48
- - "$ref": "#/components/parameters/card"
49
- - "$ref": "#/components/parameters/success"
54
+ - $ref: '#/components/parameters/cardmark'
55
+ - $ref: '#/components/parameters/card'
56
+ - $ref: '#/components/parameters/success'
50
57
  responses:
51
- 200:
52
- "$ref": "#/components/responses/200"
58
+ 302:
59
+ $ref: '#/components/responses/302'
53
60
  404:
54
- "$ref": "#/components/responses/404"
61
+ $ref: '#/components/responses/404'
62
+ # TODO: add patch
55
63
  delete:
56
64
  tags:
57
- - delete
58
- summary: delete a card
65
+ - Decko
66
+ summary: "delete a card"
59
67
  parameters:
60
- - "$ref": "#/components/parameters/cardmark"
61
- - "$ref": "#/components/parameters/success"
68
+ - $ref: '#/components/parameters/cardmark'
69
+ - $ref: '#/components/parameters/success'
62
70
  responses:
63
- 200:
64
- "$ref": "#/components/responses/200"
71
+ 302:
72
+ $ref: '#/components/responses/302'
65
73
  404:
66
- "$ref": "#/components/responses/404"
67
- "/":
74
+ $ref: '#/components/responses/404'
75
+ /:
68
76
  post:
69
77
  tags:
70
- - create
71
- summary: create a card
78
+ - Decko
79
+ summary: "create a card"
80
+ description: |-
81
+ Create a card, setting its name, type, and/or content. It's also possible to use
82
+ a GET request with /card/create
72
83
  parameters:
73
- - "$ref": "#/components/parameters/cardmark"
74
- - "$ref": "#/components/parameters/card"
75
- - "$ref": "#/components/parameters/success"
84
+ - $ref: '#/components/parameters/cardmark'
85
+ - $ref: '#/components/parameters/card'
86
+ - $ref: '#/components/parameters/success'
76
87
  responses:
77
- 200:
78
- "$ref": "#/components/responses/200"
79
- 404:
80
- "$ref": "#/components/responses/404"
88
+ 302:
89
+ $ref: '#/components/responses/302'
90
+
81
91
  externalDocs:
82
92
  description: Find out more about Decko
83
- url: http://decko.org
93
+ url: 'http://decko.org'
84
94
  servers:
85
- - url: http://decko.org
95
+ - url: 'http://decko.org'
96
+
86
97
  components:
87
98
  parameters:
88
99
  cardmark:
89
100
  name: mark
90
101
  in: path
91
102
  required: true
92
- description: |-
103
+ description: >-
93
104
  A card's "mark" can be a name, an id, or a codename. Prefix ids with a tilde (~) and codenames with a colon (\:).
105
+
94
106
  - **name:** Every card has a unique name. A name can have many variants. For example, `Berlin`, `berlin`, and `BERLIN!` all refer to the same card. The singularized, lower-cased, underscored variant of a name is called its "key."
107
+
95
108
  - **id:** Every card stored in the database has a unique numerical id. _Note: some cards, called 'virtual cards', are not stored in the database and therefore do not have a numerical id. For example, the name `Menu+*refer to` identifies a virtual Search card that finds all the cards that refer to the `Menu` card.Because it is based on patterns that apply to all cards with names ending in `+*refer to`, there is no need to store each instance of that pattern._
109
+
96
110
  - **codename:** Some cards also have special identifiers called "codenames". Card names can be edited by Decko users. If these names were used directly in code, then renaming would break that code. Codename identifiers solve this problem by providing persistent readable identifiers. Only cards referred to directly in code have codenames.
111
+
97
112
  schema:
98
113
  type: string
99
114
  enum:
100
- - "{name}"
101
- - "~{id}"
102
- - ":{codename}"
115
+ - '{name}'
116
+ - '~{id}'
117
+ - ':{codename}'
103
118
  view:
104
119
  name: view
105
120
  in: query
@@ -107,18 +122,17 @@ components:
107
122
  schema:
108
123
  type: string
109
124
  enum:
110
- - nucleus
111
- - atom
112
- - molecule
113
- - id
114
- - codename
115
- - name
116
- - key
117
- - content
118
- - type
125
+ - nucleus
126
+ - atom
127
+ - molecule
128
+ - id
129
+ - codename
130
+ - name
131
+ - key
132
+ - content
133
+ - type
119
134
  default: molecule
120
- description: The view determines the contents of the response JSON. See the
121
- corresponding schema for more details.
135
+ description: The view determines the contents of the response JSON. See the corresponding schema for more details.
122
136
  card:
123
137
  name: card
124
138
  in: header
@@ -131,24 +145,32 @@ components:
131
145
  type: string
132
146
  content:
133
147
  type: string
134
- description: |-
135
- The card parameter contains card field data, subcard field data. It follows RubyOnRails hash parameter pattern; for example, a card's name is represented as `card[name]=foobar`.
148
+ description: >-
149
+ The card parameter contains card field data, subcard field data.
150
+ It follows RubyOnRails hash parameter pattern; for example, a card's name is represented as `card[name]=foobar`.
151
+
136
152
  The most common fields are:
153
+
137
154
  - **name:** Every card has a unique name.
155
+
138
156
  - **type:** The card\'s type. Note that every card has a type, and the value of this field should be the type card\'s name. You can alternatively use **type_id** or **type_code** with the type card\s id
139
157
  or mark respectively.
140
158
 
141
159
  - **content:** The card\'s content (in string form)
160
+
142
161
  - **subcards** A hash that contains information about additional cards to be handled in the same transaction. Each key is a card name, and each value is a card hash. Eg `cards[subcards][+color][content]=red`
162
+
143
163
  success:
144
164
  name: success
145
165
  in: header
146
166
  schema:
147
167
  type: object
148
- description: parameters hash to pass on to the GET request to which a successful
168
+ description: >-
169
+ parameters hash to pass on to the GET request to which a successful
149
170
  request will be redirected. Eg, `success[mark]=mycardname`
171
+
150
172
  schemas:
151
- nucleus view:
173
+ nucleus_view:
152
174
  name: nucleus view
153
175
  type: object
154
176
  properties:
@@ -163,7 +185,8 @@ components:
163
185
  type: string
164
186
  codename:
165
187
  type: string
166
- atom view:
188
+
189
+ atom_view:
167
190
  name: atom view
168
191
  type: object
169
192
  properties:
@@ -180,7 +203,8 @@ components:
180
203
  type: string
181
204
  content:
182
205
  type: string
183
- molecule view:
206
+
207
+ molecule_view:
184
208
  type: object
185
209
  properties:
186
210
  id:
@@ -190,7 +214,7 @@ components:
190
214
  url:
191
215
  type: string
192
216
  type:
193
- "$ref": "#/components/schemas/nucleus%20view"
217
+ $ref: '#/components/schemas/nucleus_view'
194
218
  codename:
195
219
  type: string
196
220
  content:
@@ -200,7 +224,7 @@ components:
200
224
  items:
201
225
  type: array
202
226
  items:
203
- "$ref": "#/components/schemas/atom%20view"
227
+ $ref: '#/components/schemas/atom_view'
204
228
  links:
205
229
  type: array
206
230
  items:
@@ -208,8 +232,9 @@ components:
208
232
  ancestors:
209
233
  type: array
210
234
  items:
211
- "$ref": "#/components/schemas/atom%20view"
212
- errors view:
235
+ $ref: "#/components/schemas/atom_view"
236
+
237
+ errors_view:
213
238
  type: object
214
239
  properties:
215
240
  error_status:
@@ -218,16 +243,22 @@ components:
218
243
  type: array
219
244
  items:
220
245
  type: string
246
+
221
247
  responses:
222
- 200:
223
- description: card data
248
+ "200":
249
+ description: |-
250
+ Card data. Defaults to molecule view.
224
251
  content:
225
252
  application/json:
226
253
  schema:
227
- "$ref": "#/components/schemas/molecule%20view"
228
- 404:
229
- description: Could not find the card requested.
254
+ $ref: '#/components/schemas/molecule_view'
255
+ "404":
256
+ description: "Could not find the card requested."
230
257
  content:
231
258
  application/json:
232
259
  schema:
233
- "$ref": "#/components/schemas/errors%20view"
260
+ $ref: '#/components/schemas/errors_view'
261
+ "302":
262
+ description: |-
263
+ Successful non-idempotent requests redirect to idempotent GET
264
+ requests.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -31,28 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 1.109.0
34
+ version: 1.110.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.109.0
41
+ version: 1.110.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: card-mod-defaults
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 0.19.0
48
+ version: 0.20.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.19.0
55
+ version: 0.20.0
56
56
  description: a wiki approach to structured data, dynamic interaction, and web design
57
57
  email:
58
58
  - info@decko.org
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.6.8
140
+ rubygems_version: 3.7.2
141
141
  specification_version: 4
142
142
  summary: structured wiki web platform
143
143
  test_files: []