aws-lex-conversation 4.0.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03d9728c4b5f1df6540f4d78885e99bae9c94d7ce3279c370c1b6041095dd55a
4
- data.tar.gz: eb47cc1400d6202a616c1c408b05571ec553202f98a8e94465436e267076cc9f
3
+ metadata.gz: 8722262608a479a7c20069ac72e1e15c70e417fe92ffcbc4eaaab6b54defc792
4
+ data.tar.gz: ee77736e7e9c313a3de59b6c651253d226cfb5c0def75e52f50082489e514cd0
5
5
  SHA512:
6
- metadata.gz: a23afc87b3d9741252853e76639e9415e47f28ee29dbf3a5010bf497579ddf3da980326e49e51f582b1cb5ce1d950217f3f0138e6cadcde6341c9d5747a54983
7
- data.tar.gz: 829a4f55cab831b4ab96e9f62d3af7f06a78a6e3104100beb9f0aa356323436c91ad2a9a4592a22d25d62196b70bb87894f3c4b2039a655349cd92d19c3d1e5b
6
+ metadata.gz: c0c8edafbb942dd0e692908db397887c5fea54e2fef7be71369ed72be2debd62054cb4c31593f0d38598d895758c9bd5b0ce678f3e3ec05ec807354a230b51a6
7
+ data.tar.gz: 360558203dbc323968b841e8caf1f37cd3ee14afa43f308fa254d5edfee471321916527fd7806382614f19386f50c3753f8f7f403866d052c592dcdeccaf34e1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
- # 4.0.2 - July 20, 2021
1
+ # 4.3.0 - August 25, 2021
2
2
 
3
- * Defaulted input_transcript in event.rb to an empty string
3
+ * Slot elicitor can now be passed an Aws::Lex::Conversation::Type::Message as part of the DSL/callback and properly formats the response as such
4
+
5
+ # 4.1.0 - July 21, 2021
6
+
7
+ * Don't set the `intent` property in the response for `ElicitIntent`
8
+ actions as the field is optional as per [AWS documentation](https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html#lambda-response-format).
9
+ * Add `InProgress` and `ReadyForFulfillment` enumerations to `FulfillmentState`.
4
10
 
5
11
  # 4.0.1 - July 16, 2021
6
12
 
@@ -10,6 +10,8 @@ module Aws
10
10
  def initialize(opts = {})
11
11
  super
12
12
  session_state.dialog_action = dialog_action
13
+ # by default, we set intent as nil unless overridden
14
+ session_state.intent = opts[:intent]
13
15
  end
14
16
 
15
17
  def dialog_action
@@ -5,38 +5,32 @@ module Aws
5
5
  class Conversation
6
6
  module Slot
7
7
  class Elicitation
8
- attr_accessor :name, :elicit, :message, :follow_up_message,
9
- :content_type, :fallback, :maximum_elicitations,
10
- :conversation
8
+ attr_accessor :name, :elicit, :messages, :follow_up_messages,
9
+ :fallback, :maximum_elicitations, :conversation
11
10
 
12
11
  def initialize(opts = {})
13
12
  self.name = opts.fetch(:name)
14
13
  self.elicit = opts.fetch(:elicit) { ->(_c) { true } }
15
- self.message = opts.fetch(:message)
16
- self.follow_up_message = opts.fetch(:follow_up_message) { opts.fetch(:message) }
17
- self.content_type = opts.fetch(:content_type) do
18
- Aws::Lex::Conversation::Type::Message::ContentType.new('PlainText')
19
- end
20
- self.fallback = opts.fetch(:fallback) { ->(_c) {} }
14
+ self.messages = opts.fetch(:messages)
15
+ self.follow_up_messages = opts.fetch(:follow_up_messages) { opts.fetch(:messages) }
16
+ self.fallback = opts[:fallback]
21
17
  self.maximum_elicitations = opts.fetch(:maximum_elicitations) { 0 }
22
18
  end
23
19
 
24
20
  def elicit!
21
+ return false unless elicit?
25
22
  return fallback.call(conversation) if maximum_elicitations?
26
23
 
27
24
  increment_slot_elicitations!
28
25
  conversation.elicit_slot(
29
26
  slot_to_elicit: name,
30
- messages: [
31
- {
32
- contentType: content_type,
33
- content: elicitation_content
34
- }
35
- ]
27
+ messages: elicitation_messages
36
28
  )
37
29
  end
38
30
 
39
31
  def elicit?
32
+ return false if maximum_elicitations? && fallback.nil?
33
+
40
34
  elicit.call(conversation) && !slot.filled?
41
35
  end
42
36
 
@@ -46,11 +40,11 @@ module Aws
46
40
  conversation.slots[name.to_sym]
47
41
  end
48
42
 
49
- def elicitation_content
50
- first_elicitation? ? compose_message(message) : compose_message(follow_up_message)
43
+ def elicitation_messages
44
+ first_elicitation? ? compose_messages(messages) : compose_messages(follow_up_messages)
51
45
  end
52
46
 
53
- def compose_message(msg)
47
+ def compose_messages(msg)
54
48
  msg.is_a?(Proc) ? msg.call(conversation) : msg
55
49
  end
56
50
 
@@ -9,6 +9,8 @@ module Aws
9
9
 
10
10
  enumeration('Fulfilled')
11
11
  enumeration('Failed')
12
+ enumeration('InProgress')
13
+ enumeration('ReadyForFulfillment')
12
14
  end
13
15
  end
14
16
  end
@@ -3,7 +3,7 @@
3
3
  module Aws
4
4
  module Lex
5
5
  class Conversation
6
- VERSION = '4.0.2'
6
+ VERSION = '5.0.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-lex-conversation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Doyle
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2021-07-20 00:00:00.000000000 Z
15
+ date: 2021-08-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: shrink_wrap