bullet_train-api 1.2.23 → 1.2.25
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0913e7a57814728a9a174b6609bfde79d1dcc44540c642c9751681ffbccdd1
|
4
|
+
data.tar.gz: f95f4e83992c2979e799b5f0bb939bde4026c12d6f6baaa3b04edfe6e9eaa9fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fa9edab54c4035999271b18548429249ef0241293be3596434dd30f752221bd0f192ac0e3536fa09bd96793d6fc4d6e632e46f047c2321c4ce4f7fd6ee9ad14
|
7
|
+
data.tar.gz: 9e129e2b89700a35ffe921f5d9f24ad64e65a03fc8822b94260efa2d4b098b370c1d707b57b821f17387e84934ec736ee1fff75cc3225b76cc353800b36997a1
|
@@ -33,6 +33,33 @@ module Api
|
|
33
33
|
def automatic_paths_for(model, parent, except: [])
|
34
34
|
output = render("api/#{@version}/open_api/shared/paths", except: except)
|
35
35
|
output = Scaffolding::Transformer.new(model.name, [parent&.name]).transform_string(output).html_safe
|
36
|
+
|
37
|
+
custom_actions_file_path = "api/#{@version}/open_api/#{model.name.underscore.pluralize}/paths"
|
38
|
+
output += render(custom_actions_file_path) if lookup_context.exists?(custom_actions_file_path, [], true)
|
39
|
+
|
40
|
+
# There are some placeholders specific to this method that we still need to transform.
|
41
|
+
model_symbol = model.name.underscore.tr("/", "_")
|
42
|
+
|
43
|
+
if (get_example = FactoryBot.get_example(model_symbol, version: @version))
|
44
|
+
output.gsub!("🚅 get_example", get_example)
|
45
|
+
end
|
46
|
+
|
47
|
+
if (post_parameters = FactoryBot.post_parameters(model_symbol, version: @version))
|
48
|
+
output.gsub!("🚅 post_parameters", post_parameters)
|
49
|
+
end
|
50
|
+
|
51
|
+
if (post_examples = FactoryBot.post_examples(model_symbol, version: @version))
|
52
|
+
output.gsub!("🚅 post_examples", post_examples)
|
53
|
+
end
|
54
|
+
|
55
|
+
if (put_parameters = FactoryBot.put_parameters(model_symbol, version: @version))
|
56
|
+
output.gsub!("🚅 put_parameters", put_parameters)
|
57
|
+
end
|
58
|
+
|
59
|
+
if (put_example = FactoryBot.put_example(model_symbol, version: @version))
|
60
|
+
output.gsub!("🚅 put_example", put_example)
|
61
|
+
end
|
62
|
+
|
36
63
|
indent(output, 1)
|
37
64
|
end
|
38
65
|
|
@@ -31,7 +31,7 @@
|
|
31
31
|
items:
|
32
32
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingAttributes"
|
33
33
|
example:
|
34
|
-
|
34
|
+
🚅 get_example
|
35
35
|
<% end %>
|
36
36
|
<% unless except.include?(:create) %>
|
37
37
|
post:
|
@@ -57,7 +57,7 @@
|
|
57
57
|
type: object
|
58
58
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingParameters"
|
59
59
|
example:
|
60
|
-
|
60
|
+
🚅 post_parameters
|
61
61
|
responses:
|
62
62
|
"404":
|
63
63
|
description: "Not Found"
|
@@ -68,7 +68,7 @@
|
|
68
68
|
schema:
|
69
69
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingAttributes"
|
70
70
|
example:
|
71
|
-
|
71
|
+
🚅 post_examples
|
72
72
|
<% end %>
|
73
73
|
<% end %>
|
74
74
|
<% unless except.include?(:show) && except.include?(:update) && except.include?(:destroy) %>
|
@@ -91,7 +91,7 @@
|
|
91
91
|
schema:
|
92
92
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingAttributes"
|
93
93
|
example:
|
94
|
-
|
94
|
+
🚅 get_example
|
95
95
|
<% end %>
|
96
96
|
<% unless except.include?(:update) %>
|
97
97
|
put:
|
@@ -113,7 +113,7 @@
|
|
113
113
|
type: object
|
114
114
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingParameters"
|
115
115
|
example:
|
116
|
-
|
116
|
+
🚅 put_parameters
|
117
117
|
responses:
|
118
118
|
"404":
|
119
119
|
description: "Not Found"
|
@@ -124,7 +124,7 @@
|
|
124
124
|
schema:
|
125
125
|
$ref: "#/components/schemas/ScaffoldingCompletelyConcreteTangibleThingAttributes"
|
126
126
|
example:
|
127
|
-
|
127
|
+
🚅 put_example
|
128
128
|
<% end %>
|
129
129
|
<% unless except.include?(:destroy) %>
|
130
130
|
delete:
|
@@ -48,8 +48,13 @@ module FactoryBot
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def factory(model)
|
51
|
+
# TODO Why do we sometimes get a real object here and sometimes just a model name as a symbol?
|
52
|
+
unless model.is_a?(String)
|
53
|
+
model = model.name.underscore.tr("/", "_").to_sym
|
54
|
+
end
|
55
|
+
|
51
56
|
factories = FactoryBot.factories.instance_variable_get(:@items).keys
|
52
|
-
factories.include?("#{model}_example") ? "#{model}_example" : model
|
57
|
+
factories.include?("#{model}_example") ? "#{model}_example".to_sym : model
|
53
58
|
end
|
54
59
|
|
55
60
|
def reset_tables!
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require "scaffolding"
|
2
2
|
require "scaffolding/file_manipulator"
|
3
3
|
|
4
|
+
require "faraday"
|
5
|
+
require "tempfile"
|
6
|
+
|
4
7
|
namespace :bullet_train do
|
5
8
|
namespace :api do
|
6
9
|
desc "Bump the current version of application's API"
|
@@ -88,5 +91,42 @@ namespace :bullet_train do
|
|
88
91
|
|
89
92
|
puts "Finished bumping to #{new_version}"
|
90
93
|
end
|
94
|
+
|
95
|
+
desc "Bump the current version of application's API"
|
96
|
+
task push_to_redocly: :environment do
|
97
|
+
include Rails.application.routes.url_helpers
|
98
|
+
|
99
|
+
raise "You need to set REDOCLY_ORGANIZATION_ID in your environment. You can fetch it from the URL when you're on your Redocly dashboard." unless ENV["REDOCLY_ORGANIZATION_ID"].present?
|
100
|
+
raise "You need to set REDOCLY_API_KEY in your environment. You can create one at https://app.redocly.com/org/#{ENV["REDOCLY_ORGANIZATION_ID"]}/settings/api-keys ." unless ENV["REDOCLY_API_KEY"].present?
|
101
|
+
|
102
|
+
# Create a new Faraday connection
|
103
|
+
conn = Faraday.new(api_url(version: BulletTrain::Api.current_version))
|
104
|
+
|
105
|
+
# Fetch the file
|
106
|
+
response = conn.get
|
107
|
+
|
108
|
+
# Check if the request was successful
|
109
|
+
if response.status == 200
|
110
|
+
# Create a temp file
|
111
|
+
temp_file = Tempfile.new(["openapi-", ".yaml"])
|
112
|
+
|
113
|
+
# Write the file content to the temp file
|
114
|
+
temp_file.binmode
|
115
|
+
temp_file.write(response.body)
|
116
|
+
temp_file.rewind
|
117
|
+
|
118
|
+
# Close and delete the temp file when the script exits
|
119
|
+
temp_file.close
|
120
|
+
puts "File downloaded and saved to: #{temp_file.path}"
|
121
|
+
|
122
|
+
puts `echo "#{ENV["REDOCLY_API_KEY"]}" | redocly login`
|
123
|
+
|
124
|
+
puts `redocly push #{temp_file.path} "@#{ENV["REDOCLY_ORGANIZATION_ID"]}/#{I18n.t("application.name")}@#{BulletTrain::Api.current_version}" --public --upsert`
|
125
|
+
|
126
|
+
temp_file.unlink
|
127
|
+
else
|
128
|
+
puts "Failed to download the OpenAPI Document. Status code: #{response.status}"
|
129
|
+
end
|
130
|
+
end
|
91
131
|
end
|
92
132
|
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.2.
|
4
|
+
version: 1.2.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|