arkaan 0.10.12 → 0.10.13

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
  SHA1:
3
- metadata.gz: 0b073888f8255f079daeb478d56d5318cc20b2ca
4
- data.tar.gz: 76780deffb583fea6a3dc5d73f7ef57512329d28
3
+ metadata.gz: 6180f327f4462ae9a5d4272aefc06b39e39ac6c8
4
+ data.tar.gz: 38d166cf6ce1cfc4605ed618c25d65047a2ce634
5
5
  SHA512:
6
- metadata.gz: f1cdfd8eba8397b9af89b28cf8cc02bf489c23a44e4e682931816a25c16975a66502d2016abbf4c91215f67e3548d0831189c5845017a70a97db8b3d0c69b52b
7
- data.tar.gz: e3381ade3dddebd267c15032b8a65f936ef7d69cd7f1019dc5a4bcefc9c3fbe66033a1b23830f757a286fa5aa7660c389c8d55222271da3fb2a42244ed12eedb
6
+ metadata.gz: 298bc122d64e5c9e7c7725af760c1169edb4ffc1c4ba1e4bec8c91cda34c52e2d7ac293fe1d42ccf5eaaac8b9a5ee1f1d4cd49784c8a775c2fa99303ff5187aa
7
+ data.tar.gz: 451ff72609d333a36edfda5001ed61fdea1bde37599fa96010881d34b17efdf1efc91bd0fed35511e3519ea2450b1670aa5b2e6ccc7c79c953672c06e297d910
@@ -8,28 +8,31 @@ module Arkaan
8
8
  # Creates a premium route whithin the Sinatra application, and registers it in the database if it does not already exists.
9
9
  # @param verb [String] the HTTP method used to create this route.
10
10
  # @param path [String] the path, beginning with a /, of the route to create.
11
- def self.declare_route(verb, path, &block)
12
- self.declare_route_with(verb, path, false, &block)
11
+ def self.declare_route(verb, path, options: {}, &block)
12
+ self.declare_route_with(verb, path, false, options, &block)
13
13
  end
14
14
 
15
15
  # Creates a non premium route whithin the Sinatra application, and registers it in the database if it does not already exists.
16
16
  # @param verb [String] the HTTP method used to create this route.
17
17
  # @param path [String] the path, beginning with a /, of the route to create.
18
- def self.declare_premium_route(verb, path, &block)
19
- self.declare_route_with(verb, path, true, &block)
18
+ def self.declare_premium_route(verb, path, options: {}, &block)
19
+ self.declare_route_with(verb, path, true, options, &block)
20
20
  end
21
21
 
22
22
  # Creates a route whithin the Sinatra application, and registers it in the database if it does not already exists.
23
23
  # @param verb [String] the HTTP method used to create this route.
24
24
  # @param path [String] the path, beginning with a /, of the route to create.
25
25
  # @param premium [Boolean] TRUE to make the route premium, FALSE otherwise.
26
- def self.declare_route_with(verb, path, premium, &block)
26
+ def self.declare_route_with(verb, path, premium, options, &block)
27
27
  service = Arkaan::Utils::MicroService.instance.service
28
28
  unless service.nil? || !service.routes.where(path: path, verb: verb).first.nil?
29
29
  route = Arkaan::Monitoring::Route.create(path: path, verb: verb, premium: premium, service: service)
30
+ if !options.nil? && !options[:authenticated].nil?
31
+ route.update_attribute(:authenticated, false)
32
+ end
30
33
  Arkaan::Permissions::Group.where(is_superuser: true).each do |group|
31
- groupe.routes << route
32
- groupe.save
34
+ group.routes << route
35
+ group.save!
33
36
  end
34
37
  end
35
38
  if premium
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.12
4
+ version: 0.10.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois