arkaan 0.5.3 → 0.5.4

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: 51d8f61e045a649bda2c80f55ff55391e5e7c9db
4
- data.tar.gz: 00d7ac079864435c676b06765167ad607e8e3c7a
3
+ metadata.gz: 18d230ffa3ef80986d2ff4cd09eb1c0a7821fd9e
4
+ data.tar.gz: 9c97b1b1340d6321323121d5774cac905b3fa9e0
5
5
  SHA512:
6
- metadata.gz: 679cab55ab6b3028d1c2621a75fbe623225e4dd5729d0967bb4264cea07c8e0161dc5f86ebb59657bc98491b2c959825e7fac8da5f76d80e2290f01d8a7b0fba
7
- data.tar.gz: 21cf2b4863fdca86766dbb20e122aa9242b4f53ec6cfc662f3c4ae6159bb483e99d34235f7b7fe24662162a6679048aef4d09ae7236414d93ff6628f3c78ef24
6
+ metadata.gz: 84e7d129e2863836f69c0beae278386b59da9d87b0d676e3c6c935676c6698e104cee41da4ea65afbde980b716e352262b7e606143e8e54b1fadbb8e1eeb8e31
7
+ data.tar.gz: ab6b0e75ea42271678137898e164e3b41223327402facfa61e56e5b3bac43a6a5b5b294c402d06a180ed94aae320a85bf78c6f3a10ec9441722db3acf84a3885
@@ -2,6 +2,7 @@ module Arkaan
2
2
  # The monitoring module holds all the logic about the services so they can be activated or deactivated.
3
3
  # @author Vincent Courtois <courtois.vincent@outlook.com>
4
4
  module Monitoring
5
- autoload :Service, 'arkaan/monitoring/service'
5
+ autoload :Service , 'arkaan/monitoring/service'
6
+ autoload :Instance, 'arkaan/monitoring/instance'
6
7
  end
7
8
  end
@@ -0,0 +1,22 @@
1
+ module Arkaan
2
+ module Monitoring
3
+ # An instance is one of the services, deployed on one server. A service may have many instances to balance the load between them all.
4
+ # @param Vincent Courtois <courtois.vincent@outlook.com>
5
+ class Instance
6
+ include Mongoid::Document
7
+ include Mongoid::Timestamps
8
+
9
+ # @!attribute [rw] url
10
+ # @return [String] the URL of the instance, where the requests will be issued.
11
+ field :url, type: String
12
+
13
+ # @!attribute [r] service
14
+ # @return [Arkaan::Monitoring::Service] the service this instance is linked to.
15
+ embedded_in :service, class_name: 'Arkaan::Monitoring::Service', inverse_of: :instances
16
+
17
+ validates :url,
18
+ presence: {message: 'instance.url.blank'},
19
+ format: {with: /\A(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\z/, message: 'instance.url.format', if: :url?}
20
+ end
21
+ end
22
+ end
@@ -9,9 +9,6 @@ module Arkaan
9
9
  # @!attribute [rw] key
10
10
  # @return [String] the name, or title of the service, optionally given to identify it more easily.
11
11
  field :key, type: String
12
- # @!attribute [rw] url
13
- # @return [String] the URL of the service, where the requests will be issued.
14
- field :url, type: String
15
12
  # @!attribute [rw] path
16
13
  # @return [String] the path the service will be mapped on in the API.
17
14
  field :path, type: String, default: '/'
@@ -19,13 +16,12 @@ module Arkaan
19
16
  # @!attribute [rw] creator
20
17
  # @return [Arkaan::Account] the creator of this service.
21
18
  belongs_to :creator, class_name: 'Arkaan::Account', optional: true, inverse_of: :services
19
+ # @!attribute [rw] instances
20
+ # @return [Array<Arkaan::Monitoring::Instance>] the instances of this service currently deployed.
21
+ embeds_many :instances, class_name: 'Arkaan::Monitoring::Instance', inverse_of: :service
22
22
 
23
23
  validates :key, uniqueness: {message: 'service.key.uniq'}
24
24
 
25
- validates :url,
26
- presence: {message: 'service.url.blank'},
27
- format: {with: /\A(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\z/, message: 'service.url.format', if: :url?}
28
-
29
25
  validates :path, format: {with: /\A(\/:?[a-z]+)+\z/, message: 'service.path.format'}
30
26
  end
31
27
  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: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -161,6 +161,7 @@ files:
161
161
  - lib/arkaan/concerns.rb
162
162
  - lib/arkaan/concerns/sluggable.rb
163
163
  - lib/arkaan/monitoring.rb
164
+ - lib/arkaan/monitoring/instance.rb
164
165
  - lib/arkaan/monitoring/service.rb
165
166
  - lib/arkaan/oauth.rb
166
167
  - lib/arkaan/oauth/access_token.rb