envoy-hooks 0.9.2 → 0.9.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
  SHA256:
3
- metadata.gz: 823a05c8d454becc1b2cb7921832436a790c3d99b0a7b370ab98fe4335ead22a
4
- data.tar.gz: 16eb2a0e6f82a4915c66ca5a0f59c9335bb004738f78510bfeaa923e13f8618e
3
+ metadata.gz: 6e6db4336c82e3603c57e732c1e4aa84fec6f05936ab63464b59aef7ce581166
4
+ data.tar.gz: d3f3e6e9354713f02afa2de55582ba3befeefdf3d571cbb15ba53b005e13b536
5
5
  SHA512:
6
- metadata.gz: b83df03d0fbc601589785e4a96972ec0aa4cc48ea7a41d724494b35dbb408112f3b6b1eda0bc9ebb5cd00b1046c2fb11aade9978685a59ae8a16c148f5afc750
7
- data.tar.gz: 4bfa3ce0f3616690a4ed80efae2f2fc1809bc47accb9518c574202808c648d3089a447b285ec5e136ab828992fde42ae416187c514053a588cc64adaad7ed5bf
6
+ metadata.gz: c2406a63dee186c7c69b62c4ee30f680635134f3bc30f84c13d1c45bbd36555997a15b6bf2ae72c95a86b9629332539ba5c7928b0eb1800d82c42f16fb9362b2
7
+ data.tar.gz: '059642c37160e8a8d0445cd4a1886b09634010eb5fcb256dc3e953ea6c26546d32fac8af685c58019865408e2e13c3c19001a18e154735c9d522dcacf3e18849'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- envoy-hooks (0.9.2)
4
+ envoy-hooks (0.9.4)
5
5
  faraday (~> 0.15.4)
6
6
  faraday-net_http (~> 1.0)
7
7
  faraday_middleware (~> 0.12.2)
@@ -76,4 +76,4 @@ DEPENDENCIES
76
76
  rubocop-rspec
77
77
 
78
78
  BUNDLED WITH
79
- 2.3.19
79
+ 2.4.6
data/README.md CHANGED
@@ -10,6 +10,7 @@ It has the following three API methods regarding UI Hooks and their subscription
10
10
 
11
11
  * `upsertSubscription`
12
12
  * `triggerUIHooks`
13
+ * `triggerZoneUIHooks`
13
14
  * `subscribedUIHooks`
14
15
 
15
16
  These are the methods listed in [the Jira ticket](https://envoycom.atlassian.net/jira/software/c/projects/DEVP/boards/131?modal=detail&selectedIssue=DEVP-829) describing what's required for the email customization screen and the dynamic email sender.
@@ -171,6 +172,32 @@ hooksService.triggerUIHooks(
171
172
  )
172
173
  ```
173
174
 
175
+ The return value will be an array of objects. Each object will contain a lot of information, but the most important part is `response` - that will contain the HTML or JSON from the UI Hooks, which will then be used to create the UI.
176
+ ### **`triggerZoneUIHooks`**
177
+
178
+ This is how we fetch custom UI at a Connect zone. The name "trigger Zone UI Hooks" comes from the fact that we are getting the custom UI from potentially multiple UI Hooks, and we "trigger" them in order to fetch the data.
179
+
180
+ This will act to fetch the custom UI, which we will receive in the response.
181
+
182
+ ```rb
183
+ hooksService.triggerZoneUIHooks(
184
+ # REQUIRED
185
+ zoneIds: [3],
186
+ triggerName: "welcome_email", # The UI Hook name to invoke (deprecated)
187
+ triggerNames: ["welcome_email"], # The list of UI Hook extension names to invoke (triggerName or triggerNames required)
188
+ responseType: "JSON", # only other option is HTML. Determines whether you get Component JSON or prerendered HTML.
189
+
190
+ # XOR REQUIRED
191
+ resourceId: 341153, # the ID of the invite we are working with
192
+ resourceIds: [341153, 341153] # array of IDs of the invites we are working with
193
+
194
+ # OPTIONAL
195
+ previewMode: false, # Whether or not to run in preview mode. Preview mode makes it so you do not need to send in a resourceId
196
+ accentColor: "#123DEF", # Override the default Envoy accent color on applicable UI components. Currently only in emails, but that could change.
197
+ uiHookIds: [2954, 8271], # The specific UI hooks to invoke. If you don't include it, _all_ UI Hook subscriptions that match the locationId and triggerName will trigger.
198
+ )
199
+ ```
200
+
174
201
  The return value will be an array of objects. Each object will contain a lot of information, but the most important part is `response` - that will contain the HTML or JSON from the UI Hooks, which will then be used to create the UI.
175
202
  ## Client Config
176
203
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Envoy
4
4
  class Hooks
5
- VERSION = '0.9.2'
5
+ VERSION = '0.9.4'
6
6
  end
7
7
  end
data/lib/envoy/hooks.rb CHANGED
@@ -57,7 +57,7 @@ module Envoy
57
57
 
58
58
  validateEnum('responseType', responseType, %w[HTML JSON])
59
59
 
60
- validateEnum('resourceType', resourceType, %w[INVITE ENTRY]) unless resourceType.nil?
60
+ validateEnum('resourceType', resourceType, %w[INVITE EMPLOYEE ENTRY]) unless resourceType.nil?
61
61
 
62
62
  faraday.post("/rest/v1/locations/#{locationId}/hooks/ui/trigger", {
63
63
  locationId: locationId,
@@ -72,18 +72,19 @@ module Envoy
72
72
  })
73
73
  end
74
74
 
75
- def triggerZoneUIHooks(responseType:, zoneIds: [], triggerNames: [], resourceId: nil,
75
+ def triggerZoneUIHooks(responseType:, zoneIds:, triggerNames: [], resourceId: nil, resourceIds: [],
76
76
  resourceType: nil, accentColor: nil, previewMode: false, uiHookIds: [])
77
77
 
78
78
  validateEnum('responseType', responseType, %w[HTML JSON])
79
79
 
80
- validateEnum('resourceType', resourceType, %w[INVITE ENTRY]) unless resourceType.nil?
80
+ validateEnum('resourceType', resourceType, %w[INVITE EMPLOYEE ENTRY]) unless resourceType.nil?
81
81
 
82
+ resource_ids = Array(resourceId || resourceIds)
82
83
  faraday.post('/rest/v1/zones/hooks/ui/trigger', {
83
84
  zoneIds: zoneIds,
84
85
  triggerNames: triggerNames,
85
86
  responseType: responseType,
86
- resourceId: resourceId,
87
+ resourceIds: resource_ids,
87
88
  resourceType: resourceType,
88
89
  accentColor: accentColor,
89
90
  previewMode: previewMode,
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envoy-hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey-Biles-Envoy
8
8
  - Anthony-Floccari-Envoy
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-03-07 00:00:00.000000000 Z
12
+ date: 2023-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -53,7 +53,7 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.0'
56
- description:
56
+ description:
57
57
  email:
58
58
  - afloccari@envoy.com
59
59
  executables: []
@@ -79,7 +79,7 @@ licenses: []
79
79
  metadata:
80
80
  homepage_uri: https://github.com/envoy/envoy-hooks-ruby
81
81
  source_code_uri: https://github.com/envoy/envoy-hooks-ruby
82
- post_install_message:
82
+ post_install_message:
83
83
  rdoc_options: []
84
84
  require_paths:
85
85
  - lib
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubygems_version: 3.1.6
98
- signing_key:
98
+ signing_key:
99
99
  specification_version: 4
100
100
  summary: Ruby wrapper for envoy/hooks
101
101
  test_files: []