bullet_train-api 1.6.25 → 1.6.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b74d7978ed040fb1ff9fb993a9ef20681be77615016c9e206b0d553ccfd3328f
4
- data.tar.gz: e69b03ab081484af08ff01de050836a048255118404500bf7bbc60fe81a43215
3
+ metadata.gz: e8773d252b03c1ebb3342c9ee21e302f2b7bd2e6732da748c407f7e0796002c1
4
+ data.tar.gz: f7581ce2bc65fd5cd1f49324ddddb8b5936e1ee88bd431063cc82c253acc1c1f
5
5
  SHA512:
6
- metadata.gz: 71c42eac7d429cc9092d29fec72c778d790dcc8e66aa8b83af68fa4e601ced8b0ffd22a2265d376a5cde37fb200c0a0178ec29ecb31f59c5b54884cb7afd1a55
7
- data.tar.gz: f5163efb4b5e5652882c3f92d26a565703b6cfabfd638bb47a2d50e31abd645264b60e1714780ece604f9d0a912777817272fbf7c9827442c42d8c69017a7637
6
+ metadata.gz: b64ba34512b1443e2a4d314c63aa691d700d20f398f6eb3fafbe397dba225f8c4415564d5a57f990ed9146183ff7c1814104b78b14fdb862da8469216d4e2322
7
+ data.tar.gz: 037ed5525018b8f23bc94cc737f1142991dbf3697c1501100e4361113a0db619b73550a5415db2845fb01b884af58ae4a688fbcc8d4c4e91008edda69237d1e7
@@ -24,7 +24,7 @@ module Api
24
24
  end
25
25
 
26
26
  def automatic_paths_for(model, parent, except: [])
27
- output = render("api/#{@version}/open_api/shared/paths", except: except)
27
+ output = render("api/#{@version}/open_api/shared/paths", model_name: model.model_name.collection, except: except)
28
28
  output = Scaffolding::Transformer.new(model.name, [parent&.name]).transform_string(output).html_safe
29
29
 
30
30
  custom_actions_file_path = "api/#{@version}/open_api/#{model.model_name.collection}/paths"
@@ -47,7 +47,9 @@ module Api
47
47
  indent(output, 1)
48
48
  end
49
49
 
50
- def automatic_components_for(model, locals: {})
50
+ def automatic_components_for(model, **options)
51
+ locals = options.delete(:locals) || {}
52
+
51
53
  path = "app/views/api/#{@version}"
52
54
  paths = [path, "app/views"] + gem_paths.product(%W[/#{path} /app/views]).map(&:join)
53
55
 
@@ -76,6 +78,9 @@ module Api
76
78
 
77
79
  attributes_output = JSON.parse(schema_json)
78
80
 
81
+ # Allow customization of Attributes
82
+ customize_component!(attributes_output, options[:attributes]) if options[:attributes]
83
+
79
84
  # Add "Attributes" part to $ref's
80
85
  update_ref_values!(attributes_output)
81
86
 
@@ -106,6 +111,9 @@ module Api
106
111
  parameters_output["properties"].select! { |key| strong_parameter_keys.include?(key.to_sym) }
107
112
  parameters_output["example"]&.select! { |key, value| strong_parameter_keys.include?(key.to_sym) && value.present? }
108
113
 
114
+ # Allow customization of Parameters
115
+ customize_component!(parameters_output, options[:parameters]) if options[:parameters]
116
+
109
117
  (
110
118
  indent(attributes_output.to_yaml.gsub("---", "#{model.name.gsub("::", "")}Attributes:"), 3) +
111
119
  indent(" " + parameters_output.to_yaml.gsub("---", "#{model.name.gsub("::", "")}Parameters:"), 3)
@@ -164,5 +172,41 @@ module Api
164
172
  end
165
173
  end
166
174
  end
175
+
176
+ def customize_component!(original, custom)
177
+ custom = custom.deep_stringify_keys.deep_transform_values { |v| v.is_a?(Symbol) ? v.to_s : v }
178
+
179
+ if custom.key?("add")
180
+ custom["add"].each do |property, details|
181
+ if details["required"]
182
+ original["required"] << property
183
+ details.delete("required")
184
+ end
185
+ original["properties"][property] = details
186
+ if details["example"]
187
+ original["example"][property] = details["example"]
188
+ details.delete("example")
189
+ end
190
+ end
191
+ end
192
+
193
+ if custom.key?("remove")
194
+ Array(custom["remove"]).each do |property|
195
+ original["required"].delete(property)
196
+ original["properties"].delete(property)
197
+ original["example"].delete(property)
198
+ end
199
+ end
200
+
201
+ if custom.key?("only")
202
+ original["properties"].keys.each do |property|
203
+ unless Array(custom["only"]).include?(property)
204
+ original["properties"].delete(property)
205
+ original["required"].delete(property)
206
+ original["example"].delete(property)
207
+ end
208
+ end
209
+ end
210
+ end
167
211
  end
168
212
  end
@@ -3,6 +3,7 @@
3
3
  tags:
4
4
  - Invitation
5
5
  summary: "Resend Invitation"
6
+ description: "Resend an Invitation"
6
7
  operationId: resendInvitation
7
8
  parameters:
8
9
  - $ref: "#/components/parameters/id"
@@ -5,7 +5,8 @@
5
5
  get:
6
6
  tags:
7
7
  - Scaffolding::CompletelyConcrete::TangibleThing
8
- summary: "List Tangible Things"
8
+ summary: <%= I18n.t("#{model_name}.api.paths.index.summary", default: "List Tangible Things") %>
9
+ description: <%= I18n.t("#{model_name}.api.paths.index.description", default: "List Tangible Things") %>
9
10
  operationId: listScaffoldingCompletelyConcreteTangibleThings
10
11
  parameters:
11
12
  - name: absolutely_abstract_creative_concept_id
@@ -37,7 +38,8 @@
37
38
  post:
38
39
  tags:
39
40
  - Scaffolding::CompletelyConcrete::TangibleThing
40
- summary: "Create Tangible Thing"
41
+ summary: <%= I18n.t("#{model_name}.api.paths.create.summary", default: "Create Tangible Thing") %>
42
+ description: <%= I18n.t("#{model_name}.api.paths.create.description", default: "Create Tangible Thing") %>
41
43
  operationId: createScaffoldingCompletelyConcreteTangibleThings
42
44
  parameters:
43
45
  - name: absolutely_abstract_creative_concept_id
@@ -77,7 +79,8 @@
77
79
  get:
78
80
  tags:
79
81
  - Scaffolding::CompletelyConcrete::TangibleThing
80
- summary: "Fetch Tangible Thing"
82
+ summary: <%= I18n.t("#{model_name}.api.paths.show.summary", default: "Fetch Tangible Thing") %>
83
+ description: <%= I18n.t("#{model_name}.api.paths.show.description", default: "Fetch Tangible Thing") %>
81
84
  operationId: getScaffoldingCompletelyConcreteTangibleThings
82
85
  parameters:
83
86
  - $ref: "#/components/parameters/id"
@@ -97,7 +100,8 @@
97
100
  put:
98
101
  tags:
99
102
  - Scaffolding::CompletelyConcrete::TangibleThing
100
- summary: "Update Tangible Thing"
103
+ summary: <%= I18n.t("#{model_name}.api.paths.update.summary", default: "Update Tangible Thing") %>
104
+ description: <%= I18n.t("#{model_name}.api.paths.update.description", default: "Update Tangible Thing") %>
101
105
  operationId: updateScaffoldingCompletelyConcreteTangibleThings
102
106
  parameters:
103
107
  - $ref: "#/components/parameters/id"
@@ -130,7 +134,8 @@
130
134
  delete:
131
135
  tags:
132
136
  - Scaffolding::CompletelyConcrete::TangibleThing
133
- summary: "Remove Tangible Thing"
137
+ summary: <%= I18n.t("#{model_name}.api.paths.index.summary", default: "List Tangible Things") %>
138
+ description: <%= I18n.t("#{model_name}.api.paths.index.description", default: "List Tangible Things") %>
134
139
  operationId: removeScaffoldingCompletelyConcreteTangibleThings
135
140
  parameters:
136
141
  - $ref: "#/components/parameters/id"
@@ -3,6 +3,7 @@
3
3
  tags:
4
4
  - Team
5
5
  summary: "List Teams"
6
+ description: "List all Teams"
6
7
  operationId: listTeams
7
8
  parameters:
8
9
  - $ref: "#/components/parameters/after"
@@ -30,6 +31,7 @@
30
31
  tags:
31
32
  - Team
32
33
  summary: "Fetch Team"
34
+ description: "Fetch a single Team"
33
35
  operationId: fetchTeam
34
36
  parameters:
35
37
  - $ref: "#/components/parameters/id"
@@ -48,6 +50,7 @@
48
50
  tags:
49
51
  - Team
50
52
  summary: "Update Team"
53
+ description: "Update a single Team"
51
54
  operationId: updateTeam
52
55
  parameters:
53
56
  - $ref: "#/components/parameters/id"
@@ -3,6 +3,7 @@
3
3
  tags:
4
4
  - User
5
5
  summary: "List Users"
6
+ description: "List all Users"
6
7
  operationId: listUsers
7
8
  parameters:
8
9
  - $ref: "#/components/parameters/after"
@@ -29,6 +30,7 @@
29
30
  tags:
30
31
  - User
31
32
  summary: "Fetch User"
33
+ description: "Fetch a single User"
32
34
  operationId: fetchUser
33
35
  parameters:
34
36
  - $ref: "#/components/parameters/id"
@@ -47,6 +49,7 @@
47
49
  tags:
48
50
  - User
49
51
  summary: "Update User"
52
+ description: "Update a single User"
50
53
  operationId: updateUser
51
54
  parameters:
52
55
  - $ref: "#/components/parameters/id"
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.6.25"
3
+ VERSION = "1.6.27"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.25
4
+ version: 1.6.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-18 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  - !ruby/object:Gem::Version
262
262
  version: '0'
263
263
  requirements: []
264
- rubygems_version: 3.4.10
264
+ rubygems_version: 3.5.3
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Bullet Train API