bullet_train-api 1.3.16 → 1.3.18

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: 4d34df0b90eff4a61fb172e3d966a16ee832727a46d776422ea256d6037c4295
4
- data.tar.gz: af6fec4a834593145936feb0b211dfa341672ed84a882fa5fae52ba7ebcb2032
3
+ metadata.gz: 192746a08fe439389283941230b98c379d75512f5f94516d2b0c518bd255904b
4
+ data.tar.gz: 689d9619c7df62bbccc1be5f099ab8bf68fcde44d760ff85cdd6c2b108a93712
5
5
  SHA512:
6
- metadata.gz: 2ce192380dc8b1e9d19af67bc6f66c5d16c628ded83377823bd122c02d218071dcab63dc29f588bf683336b1501dfa66feddde3f9e92c20de4b2345306108afa
7
- data.tar.gz: c8f309f01d27deafa830bf59676a388b0639eb6e76c4deb21e750933342c45921f3c8491399b0013c1cdb78dfc1e49475b4777f4cd088fbaf0d8a0bb75cf1e7d
6
+ metadata.gz: 588bf3ea462835aea300cae7a1dd7889915697a196037cd8b24a2fb7b1c5fc3f64916af691a1500939addd0f6d6556cc4073e62a68c02bf47d19f9a21c220c25
7
+ data.tar.gz: 8e69885f9291d4a3f7708d5223afdf15538ea8e83beaaf580d0464fcd34b375769200a9de2d8437e15e224cdca11b4ff30634c850588be507c127f7668f1d4c4
@@ -7,13 +7,6 @@ module Api
7
7
  lines.unshift(first_line).join.html_safe
8
8
  end
9
9
 
10
- # TODO: Remove this method? It's not being used anywhere
11
- def components_for(model)
12
- for_model model do
13
- indent(render("api/#{@version}/open_api/#{model.name.underscore.pluralize}/components"), 2)
14
- end
15
- end
16
-
17
10
  def current_model
18
11
  @model_stack.last
19
12
  end
@@ -112,22 +105,6 @@ module Api
112
105
  end
113
106
  end
114
107
 
115
- def attribute(attribute)
116
- heading = t("#{current_model.name.underscore.pluralize}.fields.#{attribute}.heading")
117
- attribute_data = current_model.columns_hash[attribute.to_s]
118
-
119
- # Default to `string` when the type returns nil.
120
- type = attribute_data.nil? ? "string" : attribute_data.type
121
-
122
- attribute_block = <<~YAML
123
- #{attribute}:
124
- description: "#{heading}"
125
- type: #{type}
126
- YAML
127
- indent(attribute_block.chomp, 2)
128
- end
129
- alias_method :parameter, :attribute
130
-
131
108
  private
132
109
 
133
110
  def has_strong_parameters?(controller)
@@ -0,0 +1,19 @@
1
+ /invitations/{id}/resend:
2
+ post:
3
+ tags:
4
+ - Invitation
5
+ summary: "Resend Invitation"
6
+ operationId: resendInvitation
7
+ parameters:
8
+ - $ref: "#/components/parameters/id"
9
+ responses:
10
+ "404":
11
+ description: "Not Found"
12
+ "200":
13
+ description: "OK"
14
+ content:
15
+ application/json:
16
+ schema:
17
+ $ref: "#/components/schemas/InvitationAttributes"
18
+ example:
19
+ <%= FactoryBot.get_example(:invitation, version: @version) %>
@@ -4,29 +4,30 @@ module FactoryBot
4
4
  module ExampleBot
5
5
  attr_accessor :tables_to_reset
6
6
 
7
- def example(model, **options)
7
+ def example(model, **)
8
8
  @tables_to_reset = [model.to_s.pluralize]
9
9
 
10
10
  object = nil
11
11
 
12
12
  ActiveRecord::Base.transaction do
13
- instance = FactoryBot.create(factory(model), **options)
13
+ instance = FactoryBot.create(factory(model), **)
14
14
  object = deep_clone(instance)
15
15
 
16
16
  raise ActiveRecord::Rollback
17
17
  end
18
18
 
19
- reset_tables!
20
19
  object
20
+ ensure
21
+ reset_tables!
21
22
  end
22
23
 
23
- def example_list(model, quantity, **options)
24
+ def example_list(model, quantity, **)
24
25
  @tables_to_reset = [model.to_s.pluralize]
25
26
 
26
27
  objects = []
27
28
 
28
29
  ActiveRecord::Base.transaction do
29
- instances = FactoryBot.create_list(factory(model), quantity, **options)
30
+ instances = FactoryBot.create_list(factory(model), quantity, **)
30
31
 
31
32
  instances.each do |instance|
32
33
  objects << deep_clone(instance)
@@ -35,8 +36,9 @@ module FactoryBot
35
36
  raise ActiveRecord::Rollback
36
37
  end
37
38
 
38
- reset_tables!
39
39
  objects
40
+ ensure
41
+ reset_tables!
40
42
  end
41
43
 
42
44
  REST_METHODS = %i[get_examples get_example post_example post_parameters put_example put_parameters patch_example patch_parameters]
@@ -55,8 +57,11 @@ module FactoryBot
55
57
  end
56
58
 
57
59
  def reset_tables!
58
- # This is only availble for postgres
60
+ # This is only available for postgres
61
+ return unless @tables_to_reset.present?
62
+
59
63
  return unless ActiveRecord::Base.connection.respond_to?(:reset_pk_sequence!)
64
+
60
65
  @tables_to_reset.each do |name|
61
66
  ActiveRecord::Base.connection.reset_pk_sequence!(name) if ActiveRecord::Base.connection.table_exists?(name)
62
67
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.3.16"
3
+ VERSION = "1.3.18"
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.3.16
4
+ version: 1.3.18
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-08-24 00:00:00.000000000 Z
11
+ date: 2023-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -181,6 +181,7 @@ files:
181
181
  - app/views/api/v1/invitations/show.json.jbuilder
182
182
  - app/views/api/v1/memberships/index.json.jbuilder
183
183
  - app/views/api/v1/memberships/show.json.jbuilder
184
+ - app/views/api/v1/open_api/invitations/_paths.yaml.erb
184
185
  - app/views/api/v1/open_api/shared/_paths.yaml.erb
185
186
  - app/views/api/v1/open_api/teams/_paths.yaml.erb
186
187
  - app/views/api/v1/open_api/users/_paths.yaml.erb