apicasso 0.1.4 → 0.1.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 +4 -4
- data/README.md +1 -0
- data/app/controllers/apicasso/crud_controller.rb +8 -0
- data/lib/apicasso/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd79fffcb4c7c86e39a0873b71139d6bf8f2e7c4ebf181d68083b2963c3e9a66
|
4
|
+
data.tar.gz: 90b1009449d217a580518ad0957d99215cedf838042948cfcc1b7b08cbbfc692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 845781b36267c16168ddeca5fe9e053eb2e4e35be1abaacc544ae3d4e98f3aafe9f92af0caa31d8c8ed41cbdd7fbba19fb07e90412b2f71d39deef5ae0a8ca0a
|
7
|
+
data.tar.gz: 168c5576cb188b4aee794187acc3c1af622130f011aad842d2aedbe4bc6da0a72d288c8108db659dec381d3ef6a3420f8955ab3ff3a6e3871a83613c1aba4df6
|
data/README.md
CHANGED
@@ -77,6 +77,7 @@ Everyone interacting in the APIcasso project’s codebases, issue trackers, chat
|
|
77
77
|
|
78
78
|
## TODO
|
79
79
|
|
80
|
+
- Abstract a configurable CORS approach.
|
80
81
|
- Add gem options like: Token rotation, Alternative authentication methods
|
81
82
|
- Response fields selecting
|
82
83
|
- Rate limiting
|
@@ -73,11 +73,19 @@ module Apicasso
|
|
73
73
|
# Will return a JSON with the schema of the current resource, using
|
74
74
|
# attribute names as keys and attirbute types as values.
|
75
75
|
def schema
|
76
|
+
set_access_control_headers
|
76
77
|
render json: resource_schema.to_json
|
77
78
|
end
|
78
79
|
|
79
80
|
private
|
80
81
|
|
82
|
+
def set_access_control_headers
|
83
|
+
response.headers['Access-Control-Allow-Origin'] = '*'
|
84
|
+
response.headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, PATCH, DELETE, OPTIONS'
|
85
|
+
response.headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token, Auth-Token, Email, X-User-Token, X-User-Email'
|
86
|
+
response.headers['Access-Control-Max-Age'] = '1728000'
|
87
|
+
end
|
88
|
+
|
81
89
|
# Common setup to stablish which model is the resource of this request
|
82
90
|
def set_root_resource
|
83
91
|
@root_resource = params[:resource].classify.constantize
|
data/lib/apicasso/version.rb
CHANGED