arkaan 0.8.8 → 0.8.9

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: fd0b2f1d08fc5e873ce338d61760b36532d9212d
4
- data.tar.gz: c6e37ff40994d9ea548dee4c744ec7a5ace725b6
3
+ metadata.gz: 307e2d6069e3590e31e8bbb4d99bfe89feee56af
4
+ data.tar.gz: 9cdcd6a5e096bf414b3cd59996de31a12befcd7d
5
5
  SHA512:
6
- metadata.gz: ec08731daaf756787dfa7c98f3cedb54f8f7fe96822463e4d7f67ad666e299bec91ebdc3f840d29ed6d427f13e7cece3755258e349e9fb25a75426de98094724
7
- data.tar.gz: 7e76fbf5be189941f8b361c8e6cf7fe283e71f7bc079298d6af4fe328442df79f0728cafed0111678e9b905296db006e84a60451a21bfc7b85e3e881a9f3c274
6
+ metadata.gz: 507a5048c7f777d9cc7e516b672109f05e574dc615695ab250b485b475f10af7568f29461d709a973859b6480c3934c7264e67a51708f51d569dc13c9ff730db
7
+ data.tar.gz: a31af0a0ea002429fcd45075f04a089125ece822f1dccd335968ccc1c3445a87bb7bcf1563b739037c2af61865bad04082d941c563206c94c7072075ed83d505
@@ -12,9 +12,11 @@ module Arkaan
12
12
  @application = Arkaan::OAuth::Application.where(key: params['app_key']).first
13
13
 
14
14
  if gateway.nil?
15
- halt 404, {message: 'gateway_not_found'}.to_json
15
+ url = 'https://github.com/jdr-tools/arkaan/wiki/Errors#gateway-token-not-found'
16
+ halt 404, {status: 404, field: 'token', error: 'unknown', docs: url}.to_json
16
17
  elsif @application.nil?
17
- halt 404, {message: 'application_not_found'}.to_json
18
+ url = 'https://github.com/jdr-tools/arkaan/wiki/Errors#application-key-not-found'
19
+ halt 404, {status: 404, field: 'app_key', error: 'unknown', docs: url}.to_json
18
20
  end
19
21
  end
20
22
 
@@ -45,7 +47,8 @@ module Arkaan
45
47
  self.public_send(verb, path) do
46
48
  @sinatra_route = parse_current_route
47
49
  if !@application.premium?
48
- halt 401, {message: 'application_not_authorized'}.to_json
50
+ url = 'https://github.com/jdr-tools/arkaan/wiki/Errors#application-not-premium'
51
+ halt 403, {status: 403, field: 'app_key', error: 'forbidden', docs: url}.to_json
49
52
  end
50
53
  instance_eval(&block)
51
54
  end
@@ -58,7 +61,10 @@ module Arkaan
58
61
  # @param fields [Array<String>] an array of fields names to search in the parameters
59
62
  def check_presence(*fields)
60
63
  fields.each do |field|
61
- halt 400, {message: "missing.#{field}"}.to_json if params[field].nil? || params[field] == ''
64
+ if params[field].nil? || params[field] == ''
65
+ url = 'https://github.com/jdr-tools/arkaan/wiki/Errors#parameter-not-given'
66
+ halt 400, {status: 400, field: field, error: 'required', docs: url}.to_json
67
+ end
62
68
  end
63
69
  end
64
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec