bullet_train-api 1.1.11 → 1.1.13

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: 807f6397b8ca4d3ed29c7181d9aa72456630ad6262baeab928637f11858d83f1
4
- data.tar.gz: d3db30ae44aa54f4504554a10eadd3570c061a558068b9dba844580bb8fb1b7d
3
+ metadata.gz: a26bfba5a9e08beab9b2e9ef020751627ba9f5e622708f74bf44798ea903434b
4
+ data.tar.gz: b40893d54092bb315a343891b69a0cc84a651c30775bd8840f0a3b917b791136
5
5
  SHA512:
6
- metadata.gz: e748b8c2207bc0a43e8cbacfb69e48108fff664298404194299fafa5271d5b330222830bedce8351916096430ef42d83ea9b4af96c647abc9f4996e9e73194f8
7
- data.tar.gz: 702abad5b373fe2600f460c26c363a2063082e9cd9fb832b9991d7bf079ba40175e0eba8ef25f2f4a3bf0f9e4b46026e83b1383144cafb0c20789a8c0c7574e2
6
+ metadata.gz: 2794b6b2cb7574361e60c9ef1e26b9cf1cf142c557f6bbebb60fe724b2c7c7ea0857b036ad432c0cfee1d9e286508db49ea63822d06ea71a0566407f60cbd082
7
+ data.tar.gz: 2b4f042745a52886ba79973b159fe3a70b216f55591d537746d1a0a62365454ad6be01f132ed198665b03ed24f85022eeecd7fa5788555ce2dccdd52c5f1ae03
@@ -25,31 +25,29 @@ module OpenApiHelper
25
25
  end
26
26
 
27
27
  def automatic_paths_for(model, parent, except: [])
28
- output = render("api/v1/open_api/shared/paths", except: except)
28
+ output = render("api/#{@version}/open_api/shared/paths", except: except)
29
29
  output = Scaffolding::Transformer.new(model.name, [parent&.name]).transform_string(output).html_safe
30
30
  indent(output, 1)
31
31
  end
32
32
 
33
33
  def automatic_components_for(model, locals: {})
34
- extend JbuilderSchema
35
-
36
- schema_json = jbuilder_schema("api/v1/#{model.name.underscore.pluralize}/_#{model.name.underscore.split("/").last}",
34
+ jbuilder = Jbuilder::Schema.renderer("app/views/api/#{@version}", locals: {
35
+ # If we ever get to the point where we need a real model here, we should implement an example team in seeds that we can source it from.
36
+ model.name.underscore.split("/").last.to_sym => model.new,
37
+ # Same here, if we ever need this to be a real object, this should be `test@example.com` with an `SecureRandom.hex` password.
38
+ :current_user => User.new
39
+ }.merge(locals))
40
+
41
+ schema_json = jbuilder.json(
42
+ model.new,
37
43
  title: I18n.t("#{model.name.underscore.pluralize}.label"),
38
44
  # TODO Improve this. We don't have a generic description for models we can use here.
39
45
  description: I18n.t("#{model.name.underscore.pluralize}.label"),
40
- format: :json,
41
- paths: view_paths.map(&:path),
42
- model: model,
43
- locals: {
44
- # If we ever get to the point where we need a real model here, we should implement an example team in seeds that we can source it from.
45
- model.name.underscore.split("/").last.to_sym => model.new,
46
- # Same here, if we ever need this to be a real object, this should be `test@example.com` with an `SecureRandom.hex` password.
47
- :current_user => User.new
48
- }.merge(locals))
46
+ )
49
47
 
50
48
  attributes_output = JSON.parse(schema_json)
51
49
 
52
- strong_params_module = "Api::V1::#{model.name.pluralize}Controller::StrongParameters".constantize
50
+ strong_params_module = "Api::#{@version.upcase}::#{model.name.pluralize}Controller::StrongParameters".constantize
53
51
  strong_parameter_keys = BulletTrain::Api::StrongParametersReporter.new(model, strong_params_module).report
54
52
  if strong_parameter_keys.last.is_a?(Hash)
55
53
  strong_parameter_keys += strong_parameter_keys.pop.keys
@@ -70,8 +70,7 @@ module Api::Controllers::Base
70
70
  # TODO Make this logic configurable so that downstream developers can write different methods for this column getting updated.
71
71
  begin
72
72
  doorkeeper_token.update(last_used_at: Time.zone.now)
73
- rescue
74
- ActiveRecord::StatementInvalid
73
+ rescue ActiveRecord::StatementInvalid => _
75
74
  end
76
75
  @current_user ||= User.find_by(id: doorkeeper_token[:resource_owner_id])
77
76
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.1.11"
3
+ VERSION = "1.1.13"
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.1.11
4
+ version: 1.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-03 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 2.0.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 2.0.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bullet_train
113
113
  requirement: !ruby/object:Gem::Requirement