waylon-core 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: bf4a171a8420b5e982d54cf24b991a7ae667f3aa93f08b361d10ac28d9726207
4
- data.tar.gz: 63982b47f1c05134c4fa5c69d07c4e05e8a1d748c245a4d7bd0695dabe4171c5
3
+ metadata.gz: 1f5c64d272b9360761b3c7d77b9930cc0d04e23e6fd5e87ab28540be57d283f1
4
+ data.tar.gz: d6bcd56f391f3d842b082975bf1c2d7ffb2263a413a3be9ff943be9d0d54e2a8
5
5
  SHA512:
6
- metadata.gz: 17a2baf807fd68312c76da6d9d1ca328ed5e5fec065711a7b8ce14a7d86850843d3ce2f6cfa3d4ea26f3c3ce30f329796427deeb98dcd6df77ec181da0afaf3f
7
- data.tar.gz: 3edb93a7e82655d44d553687493d11a0a7559b6ae318ffb92051d481872c882baa2c6191a88e96ddd3936df278844e1caee97837f15523fd2158275d0a84eb03
6
+ metadata.gz: ac0179b9880f4f0a30ff2d0f4bc39c4e2d991b87fc643c8ce323f707319dfdd56de2114d91b028e2f658480276f909dad89c2e17fdb82e4c05c58eb4b63dc144
7
+ data.tar.gz: 35e0eba674ddc78a8b49fcf4e47d35c529a0e4ab102afe955965ce64ca74d1cf4dfdda24126e25cf9bc277e64c2eed74b5d2c3f145e02ad240c5043dcac866ea
data/.roxanne.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  version: 1.0
2
2
  stages:
3
3
  test:
4
- image: ruby:3.0
4
+ image: ruby:3.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waylon-core (0.1.2)
4
+ waylon-core (0.1.3)
5
5
  addressable (~> 2.8)
6
6
  faraday (~> 1.8)
7
7
  i18n (~> 1.8)
@@ -35,14 +35,14 @@ GEM
35
35
  faraday-em_synchrony (1.0.0)
36
36
  faraday-excon (1.1.0)
37
37
  faraday-httpclient (1.0.1)
38
- faraday-multipart (1.0.2)
38
+ faraday-multipart (1.0.3)
39
39
  multipart-post (>= 1.2, < 3)
40
40
  faraday-net_http (1.0.1)
41
41
  faraday-net_http_persistent (1.2.0)
42
42
  faraday-patron (1.0.0)
43
43
  faraday-rack (1.0.0)
44
44
  faraday-retry (1.0.3)
45
- i18n (1.8.11)
45
+ i18n (1.9.1)
46
46
  concurrent-ruby (~> 1.0)
47
47
  json (2.6.1)
48
48
  moneta (1.4.2)
@@ -56,12 +56,12 @@ GEM
56
56
  parser (3.1.0.0)
57
57
  ast (~> 2.4.1)
58
58
  public_suffix (4.0.6)
59
- puma (5.5.2)
59
+ puma (5.6.1)
60
60
  nio4r (~> 2.0)
61
61
  rack (2.2.3)
62
62
  rack-protection (2.1.0)
63
63
  rack
64
- rainbow (3.0.0)
64
+ rainbow (3.1.1)
65
65
  rake (13.0.6)
66
66
  redis (4.5.1)
67
67
  redis-namespace (1.8.1)
@@ -78,18 +78,18 @@ GEM
78
78
  rspec-core (~> 3.10.0)
79
79
  rspec-expectations (~> 3.10.0)
80
80
  rspec-mocks (~> 3.10.0)
81
- rspec-core (3.10.1)
81
+ rspec-core (3.10.2)
82
82
  rspec-support (~> 3.10.0)
83
- rspec-expectations (3.10.1)
83
+ rspec-expectations (3.10.2)
84
84
  diff-lcs (>= 1.2.0, < 2.0)
85
85
  rspec-support (~> 3.10.0)
86
- rspec-mocks (3.10.2)
86
+ rspec-mocks (3.10.3)
87
87
  diff-lcs (>= 1.2.0, < 2.0)
88
88
  rspec-support (~> 3.10.0)
89
89
  rspec-support (3.10.3)
90
- rubocop (1.24.1)
90
+ rubocop (1.25.0)
91
91
  parallel (~> 1.10)
92
- parser (>= 3.0.0.0)
92
+ parser (>= 3.1.0.0)
93
93
  rainbow (>= 2.2.2, < 4.0)
94
94
  regexp_parser (>= 1.8, < 3.0)
95
95
  rexml
@@ -100,7 +100,7 @@ GEM
100
100
  parser (>= 3.0.1.1)
101
101
  rubocop-rake (0.6.0)
102
102
  rubocop (~> 1.0)
103
- rubocop-rspec (2.7.0)
103
+ rubocop-rspec (2.8.0)
104
104
  rubocop (~> 1.19)
105
105
  ruby-progressbar (1.11.0)
106
106
  ruby2_keywords (0.0.5)
data/lib/waylon/core.rb CHANGED
@@ -49,3 +49,4 @@ require "waylon/routes/black_hole"
49
49
  require "waylon/routes/default"
50
50
  require "waylon/routes/permission_denied"
51
51
  require "waylon/webhook"
52
+ require "waylon/webhook_registry"
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waylon
4
+ module Services
5
+ # A Ping Service for monitoring
6
+ class Ping < Sinatra::Base
7
+ configure do
8
+ set :protection, except: :http_origin
9
+ set :logging, ::Waylon::Logger
10
+ end
11
+
12
+ before do
13
+ content_type "application/json"
14
+ halt 403 unless request.get? || request.options?
15
+ end
16
+
17
+ after do
18
+ headers "Access-Control-Allow-Methods" => %w[OPTIONS GET] if request.options?
19
+ end
20
+
21
+ get "/" do
22
+ { status: :ok }.to_json
23
+ end
24
+
25
+ options "/" do
26
+ halt 200
27
+ end
28
+ end
29
+ end
30
+ end
@@ -6,7 +6,7 @@ module Waylon
6
6
  VERSION = [
7
7
  0, # Major
8
8
  1, # Minor
9
- 2 # Patch
9
+ 3 # Patch
10
10
  ].join(".")
11
11
  end
12
12
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waylon
4
+ # Registry of Webhook subclasses known to Waylon
5
+ class WebhookRegistry
6
+ include Singleton
7
+
8
+ attr_reader :webhooks
9
+
10
+ # A convenience wrapper around the singleton instance #register method
11
+ # @param (see #register)
12
+ # @return (see #register)
13
+ def self.register(name, class_name)
14
+ instance.register(name, class_name)
15
+ end
16
+
17
+ # Add the provided Webhook class to the registry under `name`
18
+ # @param name [String] The name of the Webhook in the registry
19
+ # @param class_name [Class] The Webhook subclass to add
20
+ # @return [Class] The Webhook subclass
21
+ def register(name, class_name)
22
+ @webhooks ||= {}
23
+ @webhooks[name.to_s] = class_name
24
+ end
25
+
26
+ # Provides a Hash version of this registry
27
+ # @return [Hash]
28
+ def to_hash
29
+ (@webhooks || {}).transform_keys { |k| "/hooks/#{k}" }
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waylon-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-29 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -276,6 +276,7 @@ files:
276
276
  - lib/waylon/rspec/test_worker.rb
277
277
  - lib/waylon/sense.rb
278
278
  - lib/waylon/sense_registry.rb
279
+ - lib/waylon/services/ping.rb
279
280
  - lib/waylon/skill.rb
280
281
  - lib/waylon/skill_registry.rb
281
282
  - lib/waylon/skills/default.rb
@@ -286,6 +287,7 @@ files:
286
287
  - lib/waylon/user.rb
287
288
  - lib/waylon/version.rb
288
289
  - lib/waylon/webhook.rb
290
+ - lib/waylon/webhook_registry.rb
289
291
  - scripts/test.sh
290
292
  - waylon-core.gemspec
291
293
  homepage: https://github.com/jgnagy/waylon-core