virtuatable-core 1.2.0 → 1.2.1

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: 66ce5b5678adffaaf85ae207353fb60805ebdde74d02c8aa87aedd70109184d6
4
- data.tar.gz: 70b78998d52d0a8e47938b200500f445287d9d3d0f5cf3749fd856f645140275
3
+ metadata.gz: dfc5218a02310414bc7961f93e97d05bb37cb73b9d4868fa8c83e6666485447a
4
+ data.tar.gz: c83d949e50ae999b2182fd7c4678b9b45a5418c25d750d859d43f4f41713029e
5
5
  SHA512:
6
- metadata.gz: 3547e559af72ec612be70b6423c50c8bb0d2a5ad8ea7cec3e64eef1c47940faa2702a1c4a8f010463f4ac5bc696f91811348e31ace459f206dd875c01ef93677
7
- data.tar.gz: cc76eb73b5418e74d9215040d334991365d937675bd8af6015cc15b0a93526be4e0c410f03c358ae0f738675adaaaef226ef9af27abc68eed0348e1e476a3f20
6
+ metadata.gz: 34d89edd05d094d7db645e4403060bbbe091e3e4c77733285cd34fb7d4ab3890f28a03427bb270195c5422f4ea6235140a5693d5a112b3178f25d7a1fe9e8314
7
+ data.tar.gz: c5c6871afefd3a2dd445ffaf060c59cb676ed54a720ae26c401af4a5b62e49be4969baac10eebea8bd46ded9a8835249b62168c6ef1338560f00f6d190d288cc
@@ -55,10 +55,8 @@ module Core
55
55
  api_forbidden exception.message
56
56
  end
57
57
 
58
- if ENV['RACK_ENV'] != 'test'
59
- error StandardError do |error|
60
- api_error 500, "unknown_field.#{error.class.name}"
61
- end
58
+ error StandardError do |error|
59
+ api_error 500, "unknown_field.#{error.class.name}"
62
60
  end
63
61
  end
64
62
  end
@@ -6,7 +6,7 @@ module Core
6
6
  # @author Vincent Courtois <courtois.vincent@outlook.com>
7
7
  module Applications
8
8
  # Looks for the application sending the API's request, and raises error if not found.
9
- # @param [Arkaan::OAuth::Application] the application requesting the service.
9
+ # @param [Core::Models::OAuth::Application] the application requesting the service.
10
10
  def application(premium: false)
11
11
  return @application unless @application.nil?
12
12
 
@@ -19,7 +19,7 @@ module Core
19
19
  end
20
20
 
21
21
  def application_model
22
- Arkaan::OAuth::Application
22
+ Core::Models::OAuth::Application
23
23
  end
24
24
  end
25
25
  end
@@ -7,7 +7,7 @@ module Core
7
7
  # @author Vincent Courtois <courtois.vincent@outlook.com>
8
8
  module Declarators
9
9
  # @!attribute [r] routes
10
- # @return [Array<Arkaan::Monitoring::Route>] the currently declared routes.
10
+ # @return [Array<Core::Models::Permissions::Route>] the currently declared routes.
11
11
  attr_reader :api_routes
12
12
 
13
13
  # Main method to declare new routes, persisting them in the database and
@@ -33,9 +33,9 @@ module Core
33
33
  # Add a route to the database, then to the routes array.
34
34
  # @param verb [String] the HTTP method used to request this route.
35
35
  # @param path [String] the path used to request this route.
36
- # @return [Arkaan::Monitoring::Route] the created route.
36
+ # @return [Core::Models::Permissions::Route] the created route.
37
37
  def add_route(verb:, path:, options:)
38
- route = Arkaan::Monitoring::Route.find_or_create_by!(
38
+ route = Core::Models::Permissions::Route.find_or_create_by!(
39
39
  path: path,
40
40
  verb: verb.downcase,
41
41
  premium: options[:premium],
@@ -47,7 +47,7 @@ module Core
47
47
  end
48
48
 
49
49
  # Pushes the route in the api routes list, by creating it if needed
50
- # @param route [Arkaan::Monitoring::Route] the route to push in the list of routes.
50
+ # @param route [Core::Models::Permissions::Route] the route to push in the list of routes.
51
51
  def push_route(route)
52
52
  @api_routes << route if api_routes.none? do |tmp_route|
53
53
  route.id == tmp_route.id
@@ -56,9 +56,9 @@ module Core
56
56
 
57
57
  # Add the default access permissions to a route. Any group tagged superuser
58
58
  # can automatically access any newly declared_route.
59
- # params route [Arkaan::Monitoring::Route] the route to add the permissions to.
59
+ # params route [Core::Models::Permissions::Route] the route to add the permissions to.
60
60
  def add_permissions(route)
61
- groups = Arkaan::Permissions::Group.where(is_superuser: true)
61
+ groups = Core::Models::Permissions::Group.where(is_superuser: true)
62
62
  groups.each do |group|
63
63
  unless route.groups.where(id: group.id).exists?
64
64
  route.groups << group
@@ -3,12 +3,12 @@
3
3
  module Core
4
4
  module Helpers
5
5
  # This module provides the #current_route method to get the current
6
- # Arkaan::Monitoring::Route object from whithin sinatra routes.
6
+ # Core::Models::Monitoring::Route object from whithin sinatra routes.
7
7
  # @author Vincent Courtois <courtois.vincent@outlook.com>
8
8
  module Routes
9
9
  # The currently requested API route, used to see inside the block
10
10
  # if the route is premium or not, authenticated or not.
11
- # @return [Arkaan::Monitoring::Route] the currently requested route.
11
+ # @return [Core::Models::Monitoring::Route] the currently requested route.
12
12
  def current_route
13
13
  splitted = request.env['sinatra.route'].split(' ')
14
14
  verb = splitted.first.downcase
@@ -13,7 +13,7 @@ module Core
13
13
  # @raise [Virtuatable::API::Errors::BadRequest] if the session token is
14
14
  # not correctly given in the parameters.
15
15
  #
16
- # @return [Arkaan::Authentication::Session] the current session of the user.
16
+ # @return [Core::Models::Authentication::Session] the current session of the user.
17
17
  def session
18
18
  return @session unless @session.nil?
19
19
 
@@ -23,7 +23,7 @@ module Core
23
23
  end
24
24
 
25
25
  def session_model
26
- Arkaan::Authentication::Session
26
+ Core::Models::Authentication::Session
27
27
  end
28
28
  end
29
29
  end
@@ -16,7 +16,7 @@ module Core
16
16
  field :description, type: String
17
17
  # @!attribute [rw] is_private
18
18
  # @return [Boolean] TRUE if the campaign can be joined only by being invited by the creator, FALSE if it's publicly displayed and accessible.
19
- field :is_private, type: Boolean, default: true
19
+ field :is_private, type: Mongoid::Boolean, default: true
20
20
  # @!attribute [rw] tags
21
21
  # @return [Array<String>] an array of tags describing characteristics of this campaign.
22
22
  field :tags, type: Array, default: []
@@ -21,7 +21,7 @@ module Core
21
21
  field :raw, type: String, default: ''
22
22
  # @!attribute [rw] deleted
23
23
  # @return [Boolean] TRUE if the message has been marked as deleted by its user, FALSE otherwise.
24
- field :deleted, type: Boolean, default: false
24
+ field :deleted, type: Mongoid::Boolean, default: false
25
25
 
26
26
  # @!attribute [rw] campaign
27
27
  # @return [Core::Models::Chatrooms::Campaign] the chatroom in which the message has been emitted.
@@ -9,7 +9,7 @@ module Core
9
9
  included do
10
10
  # @!attribute [rw] active
11
11
  # @return [Boolean] the active status of the instance, indicating if someone has deactivated it or not.
12
- field :active, type: Boolean, default: true
12
+ field :active, type: Mongoid::Boolean, default: true
13
13
 
14
14
  scope :active , ->{ where(active: true) }
15
15
  scope :inactive, ->{ where(active: false) }
@@ -9,7 +9,7 @@ module Core
9
9
  included do
10
10
  # @!attribute [rw] premium
11
11
  # @return [Boolean] TRUE if the entity is made to be accessible only to premiuma pplications, FALSE otherwise.
12
- field :premium, type: Boolean, default: false
12
+ field :premium, type: Mongoid::Boolean, default: false
13
13
  end
14
14
  end
15
15
  end
@@ -11,7 +11,7 @@ module Core
11
11
  field :type, type: String, default: 'NOTIFICATIONS.DEFAULT'
12
12
  # @!attribute [rw] read
13
13
  # @return [Boolean] TRUE if the notification has been read (seen by the user), FALSE otherwise.
14
- field :read, type: Boolean, default: false
14
+ field :read, type: Mongoid::Boolean, default: false
15
15
  # @!attribute [rw] data
16
16
  # @return [Hash] the custom data that can be attached to this notification, for example for an invitation it can be the invited username.
17
17
  field :data, type: Hash, default: {}
@@ -17,7 +17,7 @@ module Core
17
17
  field :key, type: String, default: ->{ SecureRandom.hex }
18
18
  # @!attribute [rw] premium
19
19
  # @return [Boolean] a value indicating whether the application should automatically receive a token when an account is created, or not.
20
- field :premium, type: Boolean, default: false
20
+ field :premium, type: Mongoid::Boolean, default: false
21
21
  # @!attirbute [rw] redirect_uris
22
22
  # @return [Array<String>] the redirection URIs used for this application.
23
23
  field :redirect_uris, type: Array, default: []
@@ -12,10 +12,10 @@ module Core
12
12
 
13
13
  # @!attribute [rw] is_default
14
14
  # @return [Boolean] a boolean indicating whether this group is given when a new user registered or not.
15
- field :is_default, type: Boolean, default: false
15
+ field :is_default, type: Mongoid::Boolean, default: false
16
16
  # @!attribute [rw] is_superuser
17
17
  # @return [Boolean] a boolean indicating whether this group should have access to all groups and rights or not.
18
- field :is_superuser, type: Boolean, default: false
18
+ field :is_superuser, type: Mongoid::Boolean, default: false
19
19
 
20
20
  # @!attribute [rw] accounts
21
21
  # @return [Array<Core::Models::Account>] the accounts having the rights granted by this group.
@@ -19,7 +19,7 @@ module Core
19
19
  field :verb, type: String, default: 'get'
20
20
  # @!attribute [rw] authenticated
21
21
  # @return [Boolean] if true, the session_id is needed for this route, if false it is not.
22
- field :authenticated, type: Boolean, default: true
22
+ field :authenticated, type: Mongoid::Boolean, default: true
23
23
  # @!attribute [rw] groups
24
24
  # @return [Array<Core::Models::Permissions::Group>] the groups having permission to access this route.
25
25
  has_and_belongs_to_many :groups, class_name: 'Core::Models::Permissions::Group', inverse_of: :groups
data/lib/core/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Core
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtuatable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - '='
242
242
  - !ruby/object:Gem::Version
243
- version: 7.1.0
243
+ version: 7.4.0
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - '='
249
249
  - !ruby/object:Gem::Version
250
- version: 7.1.0
250
+ version: 7.4.0
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: sinatra
253
253
  requirement: !ruby/object:Gem::Requirement