envoy-hooks 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -4
- data/.ruby-version +1 -1
- data/Gemfile +6 -0
- data/Gemfile.lock +34 -1
- data/envoy-hooks.gemspec +3 -3
- data/lib/envoy/hooks/version.rb +1 -1
- data/lib/envoy/hooks.rb +41 -13
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 823a05c8d454becc1b2cb7921832436a790c3d99b0a7b370ab98fe4335ead22a
|
4
|
+
data.tar.gz: 16eb2a0e6f82a4915c66ca5a0f59c9335bb004738f78510bfeaa923e13f8618e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83df03d0fbc601589785e4a96972ec0aa4cc48ea7a41d724494b35dbb408112f3b6b1eda0bc9ebb5cd00b1046c2fb11aade9978685a59ae8a16c148f5afc750
|
7
|
+
data.tar.gz: 4bfa3ce0f3616690a4ed80efae2f2fc1809bc47accb9518c574202808c648d3089a447b285ec5e136ab828992fde42ae416187c514053a588cc64adaad7ed5bf
|
data/.rubocop.yml
CHANGED
@@ -3,7 +3,7 @@ require:
|
|
3
3
|
- rubocop-rspec
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.7.7
|
7
7
|
Exclude:
|
8
8
|
- 'bin/*'
|
9
9
|
- 'db/**/*'
|
@@ -14,9 +14,6 @@ AllCops:
|
|
14
14
|
- 'vendor/**/*'
|
15
15
|
CacheRootDirectory: "tmp/cache"
|
16
16
|
|
17
|
-
Rails:
|
18
|
-
Enabled: true
|
19
|
-
|
20
17
|
Layout/LineLength:
|
21
18
|
Max: 150
|
22
19
|
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
envoy-hooks (0.9.
|
4
|
+
envoy-hooks (0.9.2)
|
5
5
|
faraday (~> 0.15.4)
|
6
6
|
faraday-net_http (~> 1.0)
|
7
7
|
faraday_middleware (~> 0.12.2)
|
@@ -9,14 +9,22 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
+
ast (2.4.2)
|
12
13
|
diff-lcs (1.5.0)
|
13
14
|
faraday (0.15.4)
|
14
15
|
multipart-post (>= 1.2, < 3)
|
15
16
|
faraday-net_http (1.0.1)
|
16
17
|
faraday_middleware (0.12.2)
|
17
18
|
faraday (>= 0.7.4, < 1.0)
|
19
|
+
json (2.6.3)
|
18
20
|
multipart-post (2.2.0)
|
21
|
+
parallel (1.22.1)
|
22
|
+
parser (3.2.1.0)
|
23
|
+
ast (~> 2.4.1)
|
24
|
+
rainbow (3.1.1)
|
19
25
|
rake (13.0.6)
|
26
|
+
regexp_parser (2.7.0)
|
27
|
+
rexml (3.2.5)
|
20
28
|
rspec (3.10.0)
|
21
29
|
rspec-core (~> 3.10.0)
|
22
30
|
rspec-expectations (~> 3.10.0)
|
@@ -30,8 +38,30 @@ GEM
|
|
30
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
39
|
rspec-support (~> 3.10.0)
|
32
40
|
rspec-support (3.10.3)
|
41
|
+
rubocop (1.48.0)
|
42
|
+
json (~> 2.3)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 3.2.0.0)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8, < 3.0)
|
47
|
+
rexml (>= 3.2.5, < 4.0)
|
48
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
51
|
+
rubocop-ast (1.27.0)
|
52
|
+
parser (>= 3.2.1.0)
|
53
|
+
rubocop-capybara (2.17.1)
|
54
|
+
rubocop (~> 1.41)
|
55
|
+
rubocop-performance (1.5.2)
|
56
|
+
rubocop (>= 0.71.0)
|
57
|
+
rubocop-rspec (2.19.0)
|
58
|
+
rubocop (~> 1.33)
|
59
|
+
rubocop-capybara (~> 2.17)
|
60
|
+
ruby-progressbar (1.13.0)
|
61
|
+
unicode-display_width (2.4.2)
|
33
62
|
|
34
63
|
PLATFORMS
|
64
|
+
ruby
|
35
65
|
universal-darwin-21
|
36
66
|
x86_64-darwin-18
|
37
67
|
x86_64-darwin-19
|
@@ -41,6 +71,9 @@ DEPENDENCIES
|
|
41
71
|
envoy-hooks!
|
42
72
|
rake (~> 13.0)
|
43
73
|
rspec (~> 3.0)
|
74
|
+
rubocop
|
75
|
+
rubocop-performance
|
76
|
+
rubocop-rspec
|
44
77
|
|
45
78
|
BUNDLED WITH
|
46
79
|
2.3.19
|
data/envoy-hooks.gemspec
CHANGED
@@ -5,13 +5,13 @@ require_relative 'lib/envoy/hooks/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'envoy-hooks'
|
7
7
|
spec.version = Envoy::Hooks::VERSION
|
8
|
-
spec.authors = ['Jeffrey-Biles-Envoy']
|
9
|
-
spec.email = ['
|
8
|
+
spec.authors = ['Jeffrey-Biles-Envoy', 'Anthony-Floccari-Envoy']
|
9
|
+
spec.email = ['afloccari@envoy.com']
|
10
10
|
|
11
11
|
spec.summary = 'Ruby wrapper for envoy/hooks'
|
12
12
|
# spec.description = "TODO: Write a longer description or delete this line."
|
13
13
|
spec.homepage = 'https://github.com/envoy/envoy-hooks-ruby'
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.7')
|
15
15
|
|
16
16
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
17
17
|
|
data/lib/envoy/hooks/version.rb
CHANGED
data/lib/envoy/hooks.rb
CHANGED
@@ -9,6 +9,7 @@ module Envoy
|
|
9
9
|
class Error < StandardError; end
|
10
10
|
|
11
11
|
attr_reader :jwtToken, :baseUrl, :adapter
|
12
|
+
|
12
13
|
def initialize(jwtToken:, baseUrl:, adapter: Faraday.default_adapter, stubs: nil, timeout: 25)
|
13
14
|
@jwtToken = jwtToken
|
14
15
|
@baseUrl = baseUrl
|
@@ -30,8 +31,9 @@ module Envoy
|
|
30
31
|
end
|
31
32
|
|
32
33
|
# Should we require all these, or can we get some from the environment?
|
33
|
-
def upsertSubscription(subscriptionScope:, clientId:, status:, config: {}, externalId: nil, creatorUserId: nil,
|
34
|
-
|
34
|
+
def upsertSubscription(subscriptionScope:, clientId:, status:, config: {}, externalId: nil, creatorUserId: nil,
|
35
|
+
authorizedScopes: [])
|
36
|
+
# NOTE: - should we be doing these checks in here, or let the API handle it?
|
35
37
|
if !subscriptionScope || !subscriptionScope[:type] || !subscriptionScope[:id]
|
36
38
|
raise(Error, 'Must fully define a subscriptionScope for `upsertSubscription`')
|
37
39
|
end
|
@@ -55,9 +57,7 @@ module Envoy
|
|
55
57
|
|
56
58
|
validateEnum('responseType', responseType, %w[HTML JSON])
|
57
59
|
|
58
|
-
unless resourceType.nil?
|
59
|
-
validateEnum('resourceType', resourceType, %w[INVITE ENTRY])
|
60
|
-
end
|
60
|
+
validateEnum('resourceType', resourceType, %w[INVITE ENTRY]) unless resourceType.nil?
|
61
61
|
|
62
62
|
faraday.post("/rest/v1/locations/#{locationId}/hooks/ui/trigger", {
|
63
63
|
locationId: locationId,
|
@@ -72,6 +72,25 @@ module Envoy
|
|
72
72
|
})
|
73
73
|
end
|
74
74
|
|
75
|
+
def triggerZoneUIHooks(responseType:, zoneIds: [], triggerNames: [], resourceId: nil,
|
76
|
+
resourceType: nil, accentColor: nil, previewMode: false, uiHookIds: [])
|
77
|
+
|
78
|
+
validateEnum('responseType', responseType, %w[HTML JSON])
|
79
|
+
|
80
|
+
validateEnum('resourceType', resourceType, %w[INVITE ENTRY]) unless resourceType.nil?
|
81
|
+
|
82
|
+
faraday.post('/rest/v1/zones/hooks/ui/trigger', {
|
83
|
+
zoneIds: zoneIds,
|
84
|
+
triggerNames: triggerNames,
|
85
|
+
responseType: responseType,
|
86
|
+
resourceId: resourceId,
|
87
|
+
resourceType: resourceType,
|
88
|
+
accentColor: accentColor,
|
89
|
+
previewMode: previewMode,
|
90
|
+
uiHookIds: uiHookIds
|
91
|
+
})
|
92
|
+
end
|
93
|
+
|
75
94
|
def subscribedUIHooks(locationId: nil, locationIds: [], triggerName: nil, triggerNames: [], includeHidden: false)
|
76
95
|
faraday.get('/rest/v1/locations/hooks/ui', {
|
77
96
|
locationId: locationId,
|
@@ -82,10 +101,20 @@ module Envoy
|
|
82
101
|
})
|
83
102
|
end
|
84
103
|
|
85
|
-
def
|
104
|
+
def subscribedZoneUIHooks(zoneIds: [], triggerNames: [], includeHidden: false)
|
105
|
+
faraday.get('/rest/v1/zones/hooks/ui', {
|
106
|
+
zoneIds: zoneIds,
|
107
|
+
triggerNames: triggerNames,
|
108
|
+
includeHidden: includeHidden
|
109
|
+
})
|
110
|
+
end
|
111
|
+
|
112
|
+
def triggerEventHooks(locationId:, userEmail: nil, userEmails: [], triggerName: nil,
|
113
|
+
triggerNames: [], resourceId: nil, eventHookIds: [])
|
86
114
|
faraday.post("/rest/v1/locations/#{locationId}/hooks/event/trigger", {
|
87
115
|
locationId: locationId,
|
88
116
|
userEmail: userEmail,
|
117
|
+
userEmails: userEmails,
|
89
118
|
triggerName: triggerName,
|
90
119
|
triggerNames: triggerNames,
|
91
120
|
resourceId: resourceId,
|
@@ -110,12 +139,8 @@ module Envoy
|
|
110
139
|
)
|
111
140
|
validateEnum('clientType', clientType, %w[APP PRODUCT])
|
112
141
|
uiHooks.each do |uiHook|
|
113
|
-
if uiHook[:invocationType] != 'STATIC_CONTENT'
|
114
|
-
|
115
|
-
end
|
116
|
-
if uiHook[:invocationType] != 'DYNAMIC_CONTENT'
|
117
|
-
uiHook[:invocationURL] = nil
|
118
|
-
end
|
142
|
+
uiHook[:staticContent] = nil if uiHook[:invocationType] != 'STATIC_CONTENT'
|
143
|
+
uiHook[:invocationURL] = nil if uiHook[:invocationType] != 'DYNAMIC_CONTENT'
|
119
144
|
end
|
120
145
|
faraday.post("/rest/v1/clients/#{clientId}/config", {
|
121
146
|
clientId: clientId,
|
@@ -135,7 +160,10 @@ module Envoy
|
|
135
160
|
end
|
136
161
|
|
137
162
|
def validateEnum(optionName, testOption, validOptions)
|
138
|
-
|
163
|
+
return if validOptions.include?(testOption)
|
164
|
+
|
165
|
+
raise(Error,
|
166
|
+
"#{optionName} must be one of the allowed options: #{validOptions.join(', ')}")
|
139
167
|
end
|
140
168
|
end
|
141
169
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envoy-hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey-Biles-Envoy
|
8
|
-
|
8
|
+
- Anthony-Floccari-Envoy
|
9
|
+
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: faraday
|
@@ -52,9 +53,9 @@ dependencies:
|
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '1.0'
|
55
|
-
description:
|
56
|
+
description:
|
56
57
|
email:
|
57
|
-
-
|
58
|
+
- afloccari@envoy.com
|
58
59
|
executables: []
|
59
60
|
extensions: []
|
60
61
|
extra_rdoc_files: []
|
@@ -78,7 +79,7 @@ licenses: []
|
|
78
79
|
metadata:
|
79
80
|
homepage_uri: https://github.com/envoy/envoy-hooks-ruby
|
80
81
|
source_code_uri: https://github.com/envoy/envoy-hooks-ruby
|
81
|
-
post_install_message:
|
82
|
+
post_install_message:
|
82
83
|
rdoc_options: []
|
83
84
|
require_paths:
|
84
85
|
- lib
|
@@ -86,15 +87,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
87
|
requirements:
|
87
88
|
- - ">="
|
88
89
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
90
|
+
version: 2.7.7
|
90
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: '0'
|
95
96
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
97
|
-
signing_key:
|
97
|
+
rubygems_version: 3.1.6
|
98
|
+
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Ruby wrapper for envoy/hooks
|
100
101
|
test_files: []
|