apicasso 0.1.4 → 0.1.5

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: 7e9325d76432737bcb94628c6c2e1c7daaffd62a8bfd9375059c991f032c4c59
4
- data.tar.gz: 64fd479c4933a5085b24d97d042d09b42afa855332a18403357ec002e73d3bdc
3
+ metadata.gz: cd79fffcb4c7c86e39a0873b71139d6bf8f2e7c4ebf181d68083b2963c3e9a66
4
+ data.tar.gz: 90b1009449d217a580518ad0957d99215cedf838042948cfcc1b7b08cbbfc692
5
5
  SHA512:
6
- metadata.gz: fca3af2a4f83dbf1c2fbda914f9ac44ea214af244961ca54cd536af9b8bbce1fecad184e241d04a9501ec08e8aa475c5f2c821ca77056d3c3c35ac801f74bb80
7
- data.tar.gz: d67e0ae171c4e9d7cdb31bd31b742debb5216d523186bdd469ad9532bcb292ee13fdecaed7b0620092a0e11da506b7dc97e4936a158938bdd10ec9c38f77bd04
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
@@ -1,3 +1,3 @@
1
1
  module Apicasso
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apicasso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Bellincanta