arkaan 2.1.0 → 2.3.0

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: 4ac24b9a1965256ba6dee7471db0aa4be3d83edffa32478fe56a7e306869e995
4
- data.tar.gz: c59db73326dddf95bb8e4e10283f122207b4924d27a91068596c43d0a8fb0f65
3
+ metadata.gz: b3b465b5fc4b05bb9c7418535aad8e08604e5a31a9ced1f59c35b1b9e034564a
4
+ data.tar.gz: f4b606b42e585e3f76fb67822438e45c3db8e992d0e147a6aa862269b2542ba4
5
5
  SHA512:
6
- metadata.gz: 025a125c48b204298b0365153eae8527e35a9b92defcf9a38c136895c5869de1a7fa86e4cc2a13aaf7b6578e8078be799844ae5817d1fb042775cb0165a8f3c5
7
- data.tar.gz: 4d27a49e75b1199b355bf12dbe5ef3c3454045ee2c68b0c7114b903ad3e4e4a4dabd5ca184643179532950652c0b9cda64e646e326960e9262f1f1a27bfe7f7f
6
+ metadata.gz: d10d9f661bd8a6a2355e1e9f5d3d8facda27b109c0573a95a0a36a99298b286b4e5aa232f0d43b5a57fe9428f320abe1fff64a1b29ba1262eb7132102a757d07
7
+ data.tar.gz: 01405711bc3616838a2dfa1ba589b19f1ed747c0ad1357f556f350cd5525779fb662231f6dbe2eebc169d6d8f7c93b6c5537e61877d8ed24c8127355715654e9
@@ -15,6 +15,9 @@ module Arkaan
15
15
  # @!attribute [rw] premium
16
16
  # @return [Boolean] a value indicating whether the application should automatically receive a token when an account is created, or not.
17
17
  field :premium, type: Boolean, default: false
18
+ # @!attirbute [rw] redirect_uris
19
+ # @return [Array<String>] the redirection URIs used for this application.
20
+ field :redirect_uris, type: Array, default: []
18
21
 
19
22
  # @!attribute [rw] creator
20
23
  # @return [Arkaan::Account] the account that has created this application, considered its owner.
@@ -31,6 +34,23 @@ module Arkaan
31
34
  validates :key,
32
35
  presence: {message: 'required'},
33
36
  uniqueness: {message: 'uniq'}
37
+
38
+ validate :redirect_uris_values
39
+
40
+ # Checks the URIs to get sure they are correct, a URI is correct if :
41
+ # - it is a string
42
+ # - it has a correct URL format.
43
+ def redirect_uris_values
44
+ redirect_uris.each do |uri|
45
+ if !uri.is_a? String
46
+ errors.add(:redirect_uris, 'type')
47
+ break
48
+ elsif uri.match(/\A(https?:\/\/)((([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*)|(localhost:[0-9]{2,4})\/?)\z/).nil?
49
+ errors.add(:redirect_uris, 'format')
50
+ break
51
+ end
52
+ end
53
+ end
34
54
  end
35
55
  end
36
56
  end
@@ -1,3 +1,3 @@
1
1
  module Arkaan
2
- VERSION = '2.1.0'
2
+ VERSION = '2.3.0'
3
3
  end
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: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-26 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec