arkaan 0.9.7 → 0.10.0

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: 82b48398f8819576417eade7cf5eba42d356d5ce
4
- data.tar.gz: b2cfd36e16de4b6b4fa50d85e5a17bdc41b3b8aa
3
+ metadata.gz: c2637184d71c562a5e215f822f78267b8dfbcd2a
4
+ data.tar.gz: 48f5cebfb2b211e41e58b820d5c4fe0f54cb89d7
5
5
  SHA512:
6
- metadata.gz: 5f4dcd6b8d2c101495e0fa339deab9c1c063604f9c7e10865084b59506d3b6daa1fbe2735a69e2284e2e52cad63337dce697ae8b8bf8a5017f5565717a68afc6
7
- data.tar.gz: 2dd59574e0346ab75935889a48d2b56133671b56eaa3c98a900267bb86be60517b42b2e64baf30507e2bab556b1c59c01d6bc11b97917bf50ed67ba919452a09
6
+ metadata.gz: e1489fc65b5a189ffd76905367927075b9c35f04bfd8f9a70cfcf3a4a72968daf877435164b64074acfdef4eca755646e1ae32c6379f3fd931143076733b4c21
7
+ data.tar.gz: f5ffc1f76831fb7874bca2227516ce15bd802a3e89f91abfbaa81637a79fa1bf4d54e93d5ac3e21c709e9e68ee61174e308fe44ff355b914b07baf530c57134c
@@ -53,6 +53,9 @@ module Arkaan
53
53
  # @!attribute [rw] invitations
54
54
  # @return [Array<Arkaan::Campaigns::Invitation>] the invitations you've issued yourself to other players.
55
55
  has_many :created_invitations, class_name: 'Arkaan::Campaigns::Invitation', inverse_of: :creator
56
+ # @!attribute [rw] websockets
57
+ # @return [Array<Arkaan::Monitoring::Websocket>] the websockets created by the owner of this account.
58
+ has_many :websockets, class_name: 'Arkaan::Monitoring::Websocket', inverse_of: :creator
56
59
 
57
60
  # @!attribute [rw] phones
58
61
  # @return [Array<Arkaan::Phone>] the phone numbers given by the user.
@@ -7,19 +7,15 @@ module Arkaan
7
7
 
8
8
  # Module holding the class methods for the classes including this concern.
9
9
  # @author Vincent Courtois <courtois.vincent@outlook.com>
10
- module ClassMethods
11
- # Add the field and its validations in the model including it.
12
- # @param entity_type [String,Symbol] the name of the model including it, to be included in the error messages.
13
- def make_diagnosticable(entity_type)
14
- # @!attribute [rw] diagnostic
15
- # @return [String] the diagnostic URL to know the status of an entity (usually a gateway, or an instance of a service).
16
- field :diagnostic, type: String, default: '/status'
10
+ included do
11
+ # @!attribute [rw] diagnostic
12
+ # @return [String] the diagnostic URL to know the status of an entity (usually a gateway, or an instance of a service).
13
+ field :diagnostic, type: String, default: '/status'
17
14
 
18
- validates :diagnostic,
19
- presence: {message: "required"},
20
- length: {minimum: 4, message: "minlength"},
21
- format: {with: /\A(\/[a-z]+)+\z/, message: "pattern"}
22
- end
15
+ validates :diagnostic,
16
+ presence: {message: "required"},
17
+ length: {minimum: 4, message: "minlength"},
18
+ format: {with: /\A(\/[a-z]+)+\z/, message: "pattern"}
23
19
  end
24
20
  end
25
21
  end
@@ -2,9 +2,10 @@ 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'
6
- autoload :Instance, 'arkaan/monitoring/instance'
7
- autoload :Gateway , 'arkaan/monitoring/gateway'
8
- autoload :Route , 'arkaan/monitoring/route'
5
+ autoload :Service , 'arkaan/monitoring/service'
6
+ autoload :Instance , 'arkaan/monitoring/instance'
7
+ autoload :Gateway , 'arkaan/monitoring/gateway'
8
+ autoload :Route , 'arkaan/monitoring/route'
9
+ autoload :Websocket, 'arkaan/monitoring/websocket'
9
10
  end
10
11
  end
@@ -20,8 +20,6 @@ module Arkaan
20
20
 
21
21
  scope :running , ->{ where(running: true) }
22
22
 
23
- make_diagnosticable 'gateway'
24
-
25
23
  validates :url,
26
24
  presence: {message: 'required'},
27
25
  format: {with: /\A(https?:\/\/)((localhost:[0-9]+)|(([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*))\/?\z/, message: 'pattern', if: :url?}
@@ -15,8 +15,6 @@ module Arkaan
15
15
  # @!attribute [rw] path
16
16
  # @return [String] the path the service will be mapped on in the API.
17
17
  field :path, type: String, default: '/'
18
-
19
- make_diagnosticable 'service'
20
18
 
21
19
  # @!attribute [rw] creator
22
20
  # @return [Arkaan::Account] the creator of this service.
@@ -0,0 +1,25 @@
1
+ module Arkaan
2
+ module Monitoring
3
+ # The websocket is a particular kind of service, just like the gateway. It always has the same signature.
4
+ # A websocket document is a particular instance of websocket, located on a server and answering to a URL.
5
+ # @author Vincent Courtois <courtois.vincent@outlook.com>
6
+ class Websocket
7
+ include Mongoid::Document
8
+ include Mongoid::Timestamps
9
+ include Arkaan::Concerns::Activable
10
+ include Arkaan::Concerns::Diagnosticable
11
+
12
+ # @!attribute [rw] url
13
+ # @return [String] the URL of the websocket to be contacted on.
14
+ field :url, type: String
15
+
16
+ # @!attribute [rw] creator
17
+ # @return [Arkaan::Account] the account that created this web socket instance in the database.
18
+ belongs_to :creator, class_name: 'Arkaan::Account', inverse_of: :web_sockets
19
+
20
+ validates :url,
21
+ presence: {message: 'required'},
22
+ format: {with: /\A(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\z/, message: 'pattern', if: :url?}
23
+ end
24
+ end
25
+ end
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.9.7
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
@@ -231,6 +231,7 @@ files:
231
231
  - lib/arkaan/monitoring/instance.rb
232
232
  - lib/arkaan/monitoring/route.rb
233
233
  - lib/arkaan/monitoring/service.rb
234
+ - lib/arkaan/monitoring/websocket.rb
234
235
  - lib/arkaan/oauth.rb
235
236
  - lib/arkaan/oauth/access_token.rb
236
237
  - lib/arkaan/oauth/application.rb