arkaan 0.7.18 → 0.7.19

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
  SHA1:
3
- metadata.gz: 905077c1bbe8679549f8949e8f90f2132a3e217d
4
- data.tar.gz: 31cd85935a4dee853d2b5f176d551e8d63503f0d
3
+ metadata.gz: 7600e95ffa796c17564879976e258e2be2d93120
4
+ data.tar.gz: a0703ac0822608b541fc8afc5adc394677de44f4
5
5
  SHA512:
6
- metadata.gz: 309c732e2dac6be5cf4f91d66838da2ac0d440c60f606da2a65aaa6fc2ce7a4193f2e5e06d11f0a2667e4b3adf130640371bde13f68e603269fd92b322514af8
7
- data.tar.gz: 8adf71cff63870589f9291725b2c086170c4bc381bd92c1089f3da343247475e78d89a545e589b8d89eb13ea35833b0de7e4e663680e24a9cfcbc6c99da39c3e
6
+ metadata.gz: c19ada966e37f2d2028135e36fe7387f8f9c606c8250bb3428cb64a0fcdb6505d0c7593cf0536f812c39d762fd93ee81c08a3b1146c988d6eb2f543e5a92f7bc
7
+ data.tar.gz: 9df8559123c96edd543cb253269643f26f7810306b93f089e4cb3d44d0251f29764e185fc128f1efeaaa562fd8e4c9ccd62dd85a994b250910acd3606e55d768
@@ -9,15 +9,12 @@ module Arkaan
9
9
  check_presence('token', 'app_key')
10
10
 
11
11
  gateway = Arkaan::Monitoring::Gateway.where(token: params['token']).first
12
- application = Arkaan::OAuth::Application.where(key: params['app_key']).first
13
- route = parse_current_route
14
-
12
+ @application = Arkaan::OAuth::Application.where(key: params['app_key']).first
13
+
15
14
  if gateway.nil?
16
15
  halt 404, {message: 'gateway_not_found'}.to_json
17
- elsif application.nil?
16
+ elsif @application.nil?
18
17
  halt 404, {message: 'application_not_found'}.to_json
19
- elsif route && route.premium? && !application.premium?
20
- halt 401, {message: 'application_not_authorized'}.to_json
21
18
  end
22
19
  end
23
20
 
@@ -44,7 +41,17 @@ module Arkaan
44
41
  unless service.nil? || !service.routes.where(path: path, verb: verb).first.nil?
45
42
  Arkaan::Monitoring::Route.create(path: path, verb: verb, premium: premium, service: service)
46
43
  end
47
- self.public_send(verb, path, &block)
44
+ if premium
45
+ self.public_send(verb, path) do
46
+ @sinatra_route = parse_current_route
47
+ if !@application.premium?
48
+ halt 401, {message: 'application_not_authorized'}.to_json
49
+ end
50
+ instance_eval(&block)
51
+ end
52
+ else
53
+ self.public_send(verb, path, &block)
54
+ end
48
55
  end
49
56
 
50
57
  # Checks the presence of several fields given as parameters and halts the execution if it's not present.
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.7.18
4
+ version: 0.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois