bullet_train-api 1.0.4 → 1.0.5

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: 3193b351fc4f2279c115fb5f0c9b7a4faa716aaf471ef46e1cef99ede8e4f22f
4
- data.tar.gz: f1833fdccd067769780ddfb225afa34fb4c41180b710a6c8125d212e14b98ced
3
+ metadata.gz: 89d0d8de58c2132c0e4f9d5f704a8ca8035126f030ccaf711b2b1a27ebf793f6
4
+ data.tar.gz: 279210193a45516e0e2ffb2d89c6dc5ac82406154dfef7e7ce0c229b8bc621aa
5
5
  SHA512:
6
- metadata.gz: eb7b59e156cadb8ac52ecc6e5e1dbf3b9d0910a99fcffcb77b3785f8a557e27fda9ab16049afe08cdbfa23d78975980e10ccf03c3b15e667eb88c793990d5af2
7
- data.tar.gz: 46aac6d3e39cbc8bd4593f7ee16d77d5669fb582c0949abe6cd78fd5c3d9b6fec07b9aebce72b21d3eac1527446a6902f7d197e894b8c351802adc01c11aceb3
6
+ metadata.gz: 63fe9c16afc1e7d7753504f540304e5d0ed3cfe8812806adbe7f9f52e71ecdc9d2fcbea595968d195d42dd9f7b553af861033d3af6ca5ee1e45aa26d37ac4506
7
+ data.tar.gz: 572fb40701d7c521c8e03bcff7a2fd5a30295fbba0e3c18e830ea84bc850010bf6cd0b95b1b9219fc0da5903316308257a04b672400d4a6d33761c866ccdfa8a
@@ -0,0 +1,31 @@
1
+ module Api::V1::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ include Api::V1::Base
6
+ include Api::V1::Defaults
7
+ include Api::V1::LoadsAndAuthorizesApiResource
8
+
9
+ version "v1"
10
+ use ::WineBouncer::OAuth2
11
+
12
+ rescue_from :all do |error|
13
+ handle_api_error(error)
14
+ end
15
+
16
+ BulletTrain::Api.endpoints.each do |endpoint_class|
17
+ mount endpoint_class.constantize
18
+ end
19
+ end
20
+
21
+ class_methods do
22
+ # TODO I actually don't know of any way to make this work. This was supposed to be run after all other endpoints
23
+ # are registered, but I don't know of a way to know when we're done running `initializer` blocks from the engines
24
+ # a user may have included.
25
+ def handle_not_found
26
+ route :any, "*path" do
27
+ raise StandardError, "Unable to find API endpoint"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -11,6 +11,12 @@ require "rack/cors"
11
11
  module BulletTrain
12
12
  module Api
13
13
  class Engine < ::Rails::Engine
14
+ initializer "bullet_train.api.register_api_endpoints" do |app|
15
+ if BulletTrain::Api
16
+ BulletTrain::Api.endpoints << "Api::V1::MeEndpoint"
17
+ BulletTrain::Api.endpoints << "Api::V1::TeamsEndpoint"
18
+ end
19
+ end
14
20
  end
15
21
  end
16
22
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
@@ -3,6 +3,6 @@ require "bullet_train/api/engine"
3
3
 
4
4
  module BulletTrain
5
5
  module Api
6
- # Your code goes here...
6
+ mattr_accessor :endpoints, default: []
7
7
  end
8
8
  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.0.4
4
+ version: 1.0.5
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-02-11 00:00:00.000000000 Z
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -169,8 +169,8 @@ files:
169
169
  - app/controllers/api/v1/exceptions_handler.rb
170
170
  - app/controllers/api/v1/loads_and_authorizes_api_resource.rb
171
171
  - app/controllers/api/v1/me_endpoint.rb
172
- - app/controllers/api/v1/root.rb
173
172
  - app/controllers/api/v1/teams_endpoint.rb
173
+ - app/controllers/concerns/api/v1/base.rb
174
174
  - app/models/platform/application.rb
175
175
  - app/views/account/platform/applications/_application.json.jbuilder
176
176
  - app/views/account/platform/applications/_breadcrumbs.html.erb
@@ -1,27 +0,0 @@
1
- class Api::V1::Root < Api::Base
2
- include Api::V1::Defaults
3
- include Api::V1::LoadsAndAuthorizesApiResource
4
-
5
- version "v1"
6
- use ::WineBouncer::OAuth2
7
-
8
- rescue_from :all do |error|
9
- handle_api_error(error)
10
- end
11
-
12
- unless scaffolding_things_disabled?
13
- mount Api::V1::Scaffolding::AbsolutelyAbstract::CreativeConceptsEndpoint
14
- mount Api::V1::Scaffolding::CompletelyConcrete::TangibleThingsEndpoint
15
- end
16
-
17
- mount Api::V1::MeEndpoint
18
- mount Api::V1::TeamsEndpoint
19
- mount Api::V1::Webhooks::Outgoing::EndpointsEndpoint
20
- mount Api::V1::Webhooks::Outgoing::DeliveriesEndpoint
21
- mount Api::V1::Webhooks::Outgoing::DeliveryAttemptsEndpoint
22
- # 🚅 super scaffolding will mount new endpoints above this line.
23
-
24
- route :any, "*path" do
25
- raise StandardError, "Unable to find API endpoint"
26
- end
27
- end