aws-lex-conversation 4.0.0 → 4.0.1

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: f57f415463cb7d78d0ddb4f48232b1c0038bc91e4813fb9d6de6455fa7f0a4d9
4
- data.tar.gz: 7ba9cdf27e3f2368862bc7584eb1ce555a24a253d2a1ce3dd4c1d8500264fd0c
3
+ metadata.gz: 476f05cfb93c1025db506486915dedc693c7ad4d89579841a6eb5400d96c29bd
4
+ data.tar.gz: db5be62a9dc9239d9fbdaaa93bef25ecd1fe7add316712d9c63e3cacd0b0b75b
5
5
  SHA512:
6
- metadata.gz: 168eb69456d693dbf0f2618a23e4ec13fef7daca4921871b2d0b5a532ef39f4a1fdceb435b3122518aee7e4ae9495546b85f58e4d95bceab255fb2b91f8fcfc6
7
- data.tar.gz: 2d9577a331c617a681c3f961daaa1d1825812c907f6d40ebe838db4ce471b37ea948d9f0b75985430795d449ffcf4a59968180a591f9cfbc66a8f115864d75eb
6
+ metadata.gz: 7d6b36def37b7daf757b05a769877ebc35186e0639c99847317457e8786d50d0def6e2b8d539bab73ad0d43c704d3325702f8331387bf5549361b70cf7ecf055
7
+ data.tar.gz: f6ac291760737662ea7452ad6ebc092f225aaefbccbcdc20f549c42b0aa1661267669b827bd82696a3d7d10c06c31e6deeaa4c9a2365cfc90739ab4dac3093f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ # 4.0.1 - July 16, 2021
2
+
3
+ * Fix a bug with the `Aws::Lex::Conversation::Handler::Echo` class because it
4
+ didn't correctly return an array of messages required for Lex V2.
5
+ * Drop a call to `Hash#deep_symbolize_keys` so we don't implicitly rely on
6
+ ActiveSupport.
7
+ * Call `Hash#compact` when transforming a Lex response so we don't include any
8
+ `nil` values in the response.
9
+
10
+ # 4.0.0 - July 14, 2021
11
+
12
+ **breaking change** - Drop support for the Lex runtime version 1. If you are using Lex Version 1, please lock this gem to `~> 3.0.0`.
13
+ **breaking change** - Implement support and types for [Lex Version 2](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html), which implements a new Lambda [input/output event format](https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html#lambda-input-format).
14
+
15
+ # 3.1.0 - June 1, 2021
16
+
17
+ * Default both `request_attributes` and `session_attributes`
18
+ to an empty Hash when the values from the event are `null`.
19
+ It is much easier to reason and write logic when you can
20
+ assume that these values are always at least a hash.
21
+
22
+ # 3.0.0 - May 20, 2021
23
+
24
+ * **breaking change** - Don't pass the `recentIntentSummaryView` back
25
+ in the Lex response unless we have modified or added an existing
26
+ checkpoint. Lex will persist the previous intent summary/history
27
+ if we do not send a `recentIntentSummaryView` value back in the
28
+ response (see [1]).
29
+ * Add a few helper methods to the `Aws::Lex::Conversation::Type::Slot`
30
+ instances:
31
+
32
+ - `active?`: returns true if the slot is defined (either optional or
33
+ required) for the current intent.
34
+ - `requestable?`: returns true if the slot is active for the current
35
+ intent and it is not filled.
36
+
37
+ [1]: https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html#lambda-response-recentIntentSummaryView
38
+
1
39
  # 2.0.0 - August 19, 2020
2
40
 
3
41
  * **breaking change:** Rename `Aws::Lex::Conversation::Type::CurrentIntent` to `Aws::Lex::Conversation::Type::Intent`.
@@ -11,10 +11,12 @@ module Aws
11
11
  fulfillment_state = options.fetch(:fulfillment_state) { Type::FulfillmentState.new('Fulfilled') }
12
12
  conversation.close(
13
13
  fulfillment_state: fulfillment_state,
14
- message: Type::Message.new(
15
- content: content,
16
- content_type: content_type
17
- )
14
+ messages: [
15
+ Type::Message.new(
16
+ content: content,
17
+ content_type: content_type
18
+ )
19
+ ]
18
20
  )
19
21
  end
20
22
  end
@@ -26,10 +26,11 @@ module Aws
26
26
  end
27
27
 
28
28
  def to_lex
29
- self.class.attributes.each_with_object({}) do |attribute, hash|
29
+ output = self.class.attributes.each_with_object({}) do |attribute, hash|
30
30
  value = transform_to_lex(public_send(attribute))
31
31
  hash[self.class.mapping.fetch(attribute)] = value
32
32
  end
33
+ output.compact
33
34
  end
34
35
 
35
36
  private
@@ -40,9 +41,10 @@ module Aws
40
41
  if value.respond_to?(:to_lex)
41
42
  value.to_lex
42
43
  else
43
- value.each_with_object({}) do |(key, val), hash|
44
+ output = value.each_with_object({}) do |(key, val), hash|
44
45
  hash[key.to_sym] = transform_to_lex(val)
45
46
  end
47
+ output.compact
46
48
  end
47
49
  when Array
48
50
  value.map { |v| transform_to_lex(v) }
@@ -66,7 +68,7 @@ module Aws
66
68
  end
67
69
 
68
70
  def symbolize_hash!
69
- ->(v) { v.deep_transform_keys(&:to_sym) }
71
+ ->(v) { v.transform_keys(&:to_sym) }
70
72
  end
71
73
 
72
74
  def computed_property(attribute, callable)
@@ -22,13 +22,13 @@ module Aws
22
22
  end
23
23
 
24
24
  instance.raw_slots.each_with_object(default_hash) do |(key, value), hash|
25
- value ||= { shape: 'Scalar' }
25
+ normalized = value&.transform_keys(&:to_sym) || { shape: 'Scalar' }
26
26
  hash[key.to_sym] = Slot.shrink_wrap(
27
27
  active: true,
28
28
  name: key,
29
- shape: value[:shape],
30
- value: value[:value],
31
- values: value[:values]
29
+ shape: normalized[:shape],
30
+ value: normalized[:value],
31
+ values: normalized[:values]
32
32
  )
33
33
  end
34
34
  end
@@ -10,12 +10,10 @@ module Aws
10
10
  optional :checkpoints
11
11
 
12
12
  def checkpoints
13
- @checkpoints ||= begin # rubocop:disable Style/RedundantBegin
14
- JSON.parse(
15
- Base64.urlsafe_decode64(fetch(:checkpoints) { Base64.urlsafe_encode64([].to_json, padding: false) })
16
- ).map do |checkpoint|
17
- Checkpoint.shrink_wrap(checkpoint)
18
- end
13
+ @checkpoints ||= JSON.parse(
14
+ Base64.urlsafe_decode64(fetch(:checkpoints) { Base64.urlsafe_encode64([].to_json, padding: false) })
15
+ ).map do |checkpoint|
16
+ Checkpoint.shrink_wrap(checkpoint)
19
17
  end
20
18
  end
21
19
 
@@ -16,7 +16,7 @@ module Aws
16
16
  active_contexts: Array[Context],
17
17
  dialog_action: DialogAction,
18
18
  intent: Intent,
19
- session_attributes: ->(v) { SessionAttributes[v.deep_symbolize_keys] }
19
+ session_attributes: ->(v) { SessionAttributes[v.transform_keys(&:to_sym)] }
20
20
  )
21
21
  end
22
22
  end
@@ -14,6 +14,14 @@ module Aws
14
14
  alias_method :value, :interpreted_value
15
15
  alias_method :value=, :interpreted_value=
16
16
 
17
+ def to_lex
18
+ {
19
+ interpretedValue: interpreted_value,
20
+ originalValue: original_value,
21
+ resolvedValues: resolved_values
22
+ }
23
+ end
24
+
17
25
  def resolve!(index: 0)
18
26
  self.interpreted_value = resolved(index: index)
19
27
  end
@@ -3,7 +3,7 @@
3
3
  module Aws
4
4
  module Lex
5
5
  class Conversation
6
- VERSION = '4.0.0'
6
+ VERSION = '4.0.1'
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.0
4
+ version: 4.0.1
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-14 00:00:00.000000000 Z
15
+ date: 2021-07-16 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: shrink_wrap