bullet_train-api 1.3.9 → 1.3.11

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: 57bdc1dcce4550114b6449532a99da6a12ea97ccb03973316234ce373480466c
4
- data.tar.gz: 203cae345a6b6c69e15724a365bc71dfa0a3e4958ae8c773cd3d3e64d20b4707
3
+ metadata.gz: 51746c1a3b84cf591581ecb49d4ae9894066ffbe242c9542e812dfbc8942ea6a
4
+ data.tar.gz: 3f1d5dafff1340d8c688d65d3f50322b9e9737b251b6171dd1ff9529a7b968f1
5
5
  SHA512:
6
- metadata.gz: 12745e7a1475287db86b1bd3440ef6a9918161a3644d924b1add7c7b6188f6375817923db97128aa1f2e2fe8d16321f0b6c9f99a945d23331dcd8c01b5682a0d
7
- data.tar.gz: 8cfa646bb3c7440328a09ae59819317168b96767f876dad8705b28f7f1486b70d33d5160770947a81877add14d2d7ee459a5f1e2bf8d53e229b4110654a61e3e
6
+ metadata.gz: 30c8f67f96ce8375e889e3ad9826d5bbc86869b9fb2d64ac50cced67b6c80a8aa404bc9738bbab22a461c09229b0a5e08fce105a77d0fc8a2eca7d067bdefba3
7
+ data.tar.gz: 3ee4761dd3c33bde4747e1eb6fd55983a61acffbb74db7ddf656df578c1a5c79d0f783b5e4b4e9872e00eba4f70ae05c7bc5eaf6fc5723aa476c255c60c5d789
@@ -0,0 +1,62 @@
1
+ module Api::V1::Memberships::ControllerBase
2
+ extend ActiveSupport::Concern
3
+
4
+ module StrongParameters
5
+ # Only allow a list of trusted parameters through.
6
+ def membership_params
7
+ strong_params = params.require(:membership).permit(
8
+ *permitted_fields,
9
+ :user_first_name,
10
+ :user_last_name,
11
+ # 🚅 super scaffolding will insert new fields above this line.
12
+ *permitted_arrays,
13
+ # 🚅 super scaffolding will insert new arrays above this line
14
+ )
15
+
16
+ process_params(strong_params)
17
+
18
+ strong_params
19
+ end
20
+ end
21
+
22
+ included do
23
+ load_and_authorize_resource :membership, class: "Membership", prepend: true,
24
+ member_actions: (defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
25
+ collection_actions: (defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])
26
+
27
+ private
28
+
29
+ include StrongParameters
30
+ end
31
+
32
+ # GET /api/v1/teams/:team_id/memberships
33
+ def index
34
+ end
35
+
36
+ # GET /api/v1/memberships/:id
37
+ def show
38
+ end
39
+
40
+ # POST /api/v1/teams/:team_id/memberships
41
+ def create
42
+ if @membership.save
43
+ render :show, status: :created, location: [:api, :v1, @membership]
44
+ else
45
+ render json: @membership.errors, status: :unprocessable_entity
46
+ end
47
+ end
48
+
49
+ # PUT /api/v1/memberships/:id
50
+ def update
51
+ if @membership.update(membership_params)
52
+ render :show
53
+ else
54
+ render json: @membership.errors, status: :unprocessable_entity
55
+ end
56
+ end
57
+
58
+ # DELETE /api/v1/memberships/:id
59
+ def destroy
60
+ @membership.destroy
61
+ end
62
+ end
@@ -0,0 +1 @@
1
+ json.array! @memberships, partial: "api/v1/memberships/membership", as: :membership
@@ -0,0 +1 @@
1
+ json.partial! "api/v1/memberships/membership", membership: @membership
@@ -0,0 +1,18 @@
1
+ module BulletTrain
2
+ module Api
3
+ module Attributes
4
+ # We default this to the current version of the API, but developers can request a specific version.
5
+ def api_attributes(api_version = BulletTrain::Api.current_version_numeric)
6
+ controller = "Api::V#{api_version}::ApplicationController".constantize.new
7
+ # TODO We need to fix host names here.
8
+ controller.request = ActionDispatch::Request.new({})
9
+ local_class_key = self.class.name.underscore.split("/").last.to_sym
10
+
11
+ # Returns a hash, not string.
12
+ JbuilderTemplate.new(controller.view_context) do |json|
13
+ json.partial! "api/#{BulletTrain::Api.current_version}/#{self.class.name.underscore.pluralize}/#{local_class_key}", local_class_key => self
14
+ end.attributes!
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.3.9"
3
+ VERSION = "1.3.11"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ require "bullet_train/api/version"
2
2
  require "bullet_train/api/engine"
3
3
  require "bullet_train/api/strong_parameters_reporter"
4
4
  require "bullet_train/api/example_bot"
5
+ require "bullet_train/api/attributes"
5
6
  require "bullet_train/platform/connection_workflow"
6
7
 
7
8
  # require "wine_bouncer"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -153,6 +153,7 @@ files:
153
153
  - app/controllers/api/open_api_controller.rb
154
154
  - app/controllers/api/v1/platform/access_tokens_controller.rb
155
155
  - app/controllers/concerns/api/controllers/base.rb
156
+ - app/controllers/concerns/api/v1/memberships/controller_base.rb
156
157
  - app/controllers/concerns/api/v1/teams/controller_base.rb
157
158
  - app/controllers/concerns/api/v1/users/controller_base.rb
158
159
  - app/helpers/api/open_api_helper.rb
@@ -175,6 +176,8 @@ files:
175
176
  - app/views/account/platform/applications/new.html.erb
176
177
  - app/views/account/platform/applications/show.html.erb
177
178
  - app/views/account/platform/connections/new.html.erb
179
+ - app/views/api/v1/memberships/index.json.jbuilder
180
+ - app/views/api/v1/memberships/show.json.jbuilder
178
181
  - app/views/api/v1/open_api/shared/_paths.yaml.erb
179
182
  - app/views/api/v1/open_api/teams/_paths.yaml.erb
180
183
  - app/views/api/v1/open_api/users/_paths.yaml.erb
@@ -202,6 +205,7 @@ files:
202
205
  - config/locales/en/platform/connections.en.yml
203
206
  - config/routes.rb
204
207
  - lib/bullet_train/api.rb
208
+ - lib/bullet_train/api/attributes.rb
205
209
  - lib/bullet_train/api/engine.rb
206
210
  - lib/bullet_train/api/example_bot.rb
207
211
  - lib/bullet_train/api/strong_parameters_reporter.rb