aws-lex-conversation 2.0.0 → 2.1.0

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: 3d7e1994eb1948eceb9d236d65c0cc449e5120b6c91fb86585a7225e660cbc84
4
- data.tar.gz: 071c8e344b1c6d78597986f679a7446250d2d2d75a001d4af7d393043c567529
3
+ metadata.gz: 50a4b4cc2a28aa4251723f715953de0a102e7cabb0268db095e50470e49e2772
4
+ data.tar.gz: a5bd7550ef4a7391c0d9221ac86b3c1760053b03dda9932d8416778f4ea319e5
5
5
  SHA512:
6
- metadata.gz: c83c69dfb06fd6faa16af4dfeb37119b84054c473e11929f201b34b419aba071918405635587ad38b21ce6d97862f60f1e360d9867059942deaea348a9eab176
7
- data.tar.gz: f3cb8c0162884104b0ccb6f921c3cacdd08412d83b32e2463178b0a945b8e795de8da9bb99eabaaaf814de3b19b930e0a59972aea0dd128d8ca29d0da7e05982
6
+ metadata.gz: 48883e2e7ce637dc0b6a327bdf839b9e233a3a1bc06f99b318f5bdbf83e91c762fb8c2bbe1ffc597ac8a6900d7a01ee4dfab7a67a52c2f941595754e13f8cb06
7
+ data.tar.gz: 3bf93255a75da95213ffc74a7a3a86785bba94ea70d758c53dbad1c351b3567f5bb6f23adffafbf67e7581ad9f4a9ece31a489ef35b9cd3ad31311121a209105
data/.rubocop.yml CHANGED
@@ -5,35 +5,42 @@ AllCops:
5
5
  Exclude:
6
6
  - 'bin/**/*'
7
7
  - 'vendor/**/*'
8
- Documentation:
9
- Enabled: false
8
+ SuggestExtensions: false
10
9
  Gemspec/RequiredRubyVersion:
11
10
  Enabled: false
12
11
  Layout/FirstArrayElementIndentation:
13
12
  Enabled: false
13
+ Layout/LineLength:
14
+ Max: 130
14
15
  Layout/MultilineMethodCallIndentation:
15
16
  Enabled: false
16
17
  Layout/SpaceAroundOperators:
17
18
  Enabled: false
18
19
  Metrics/AbcSize:
19
- Max: 18
20
+ Max: 20
20
21
  Metrics/ClassLength:
21
22
  Max: 150
22
23
  Metrics/BlockLength:
23
24
  Exclude:
24
25
  - 'spec/**/*'
25
26
  - '*.gemspec'
26
- Metrics/LineLength:
27
- Max: 130
28
27
  Metrics/MethodLength:
29
28
  Max: 25
30
29
  Naming/FileName:
31
30
  Enabled: true
32
31
  Exclude:
33
32
  - lib/aws-lex-conversation.rb
33
+ Style/Alias:
34
+ EnforcedStyle: prefer_alias_method
35
+ Style/Documentation:
36
+ Enabled: false
37
+ Style/DocumentDynamicEvalDefinition:
38
+ Enabled: false
34
39
  Style/Lambda:
35
40
  EnforcedStyle: literal
36
41
  Style/GuardClause:
37
42
  Enabled: false
43
+ Style/RedundantFetchBlock:
44
+ Enabled: false
38
45
  Style/SlicingWithRange:
39
46
  Enabled: false
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ gem 'factory_bot'
8
8
  gem 'pry'
9
9
  gem 'rake'
10
10
  gem 'rspec'
11
- gem 'rubocop', '0.85.1'
11
+ gem 'rubocop', '~> 1.9', require: false
12
12
  gem 'simplecov'
@@ -26,10 +26,12 @@ require_relative 'type/dialog_action_type'
26
26
  require_relative 'type/confirmation_status'
27
27
  require_relative 'type/fulfillment_state'
28
28
  require_relative 'type/intent_confidence'
29
+ require_relative 'type/time_to_live'
29
30
  require_relative 'type/recent_intent_summary_view'
30
31
  require_relative 'type/slot'
31
32
  require_relative 'type/slot_resolution'
32
33
  require_relative 'type/slot_detail'
34
+ require_relative 'type/context'
33
35
  require_relative 'type/intent'
34
36
  require_relative 'type/output_dialog_mode'
35
37
  require_relative 'type/bot'
@@ -5,11 +5,16 @@ module Aws
5
5
  class Conversation
6
6
  module Response
7
7
  class Base
8
- attr_accessor :session_attributes, :recent_intent_summary_view
8
+ attr_accessor(
9
+ :active_contexts,
10
+ :recent_intent_summary_view,
11
+ :session_attributes
12
+ )
9
13
 
10
14
  def initialize(opts = {})
11
- self.session_attributes = opts[:session_attributes]
15
+ self.active_contexts = opts[:active_contexts]
12
16
  self.recent_intent_summary_view = opts[:recent_intent_summary_view]
17
+ self.session_attributes = opts[:session_attributes]
13
18
  end
14
19
 
15
20
  def dialog_action
@@ -18,9 +23,10 @@ module Aws
18
23
 
19
24
  def to_lex
20
25
  Type::Response.new(
21
- session_attributes: session_attributes,
26
+ active_contexts: active_contexts,
27
+ dialog_action: dialog_action,
22
28
  recent_intent_summary_view: recent_intent_summary_view,
23
- dialog_action: dialog_action
29
+ session_attributes: session_attributes
24
30
  ).to_lex
25
31
  end
26
32
  end
@@ -20,7 +20,7 @@ module Aws
20
20
  fulfillmentState: fulfillment_state,
21
21
  message: message,
22
22
  responseCard: response_card
23
- }.reject { |_, v| v.nil? }
23
+ }.compact
24
24
  end
25
25
  end
26
26
  end
@@ -22,7 +22,7 @@ module Aws
22
22
  slots: slots,
23
23
  message: message,
24
24
  responseCard: response_card
25
- }.reject { |_, v| v.nil? }
25
+ }.compact
26
26
  end
27
27
  end
28
28
  end
@@ -20,7 +20,7 @@ module Aws
20
20
  slots: slots,
21
21
  kendraQueryRequestPayload: kendra_query_request_payload,
22
22
  kendraQueryFilterString: kendra_query_filter_string
23
- }.reject { |_, v| v.nil? }
23
+ }.compact
24
24
  end
25
25
  end
26
26
  end
@@ -18,7 +18,7 @@ module Aws
18
18
  type: 'ElicitIntent',
19
19
  message: message,
20
20
  responseCard: response_card
21
- }.reject { |_, v| v.nil? }
21
+ }.compact
22
22
  end
23
23
  end
24
24
  end
@@ -24,7 +24,7 @@ module Aws
24
24
  slotToElicit: slot_to_elicit,
25
25
  message: message,
26
26
  responseCard: response_card
27
- }.reject { |_, v| v.nil? }
27
+ }.compact
28
28
  end
29
29
  end
30
30
  end
@@ -8,17 +8,19 @@ module Aws
8
8
  module Responses
9
9
  def close(opts = {})
10
10
  params = {
11
- session_attributes: lex.session_attributes,
12
- recent_intent_summary_view: lex.recent_intent_summary_view
11
+ active_contexts: lex.active_contexts,
12
+ recent_intent_summary_view: lex.recent_intent_summary_view,
13
+ session_attributes: lex.session_attributes
13
14
  }.merge(opts)
14
15
  Response::Close.new(params).to_lex
15
16
  end
16
17
 
17
18
  def confirm_intent(opts = {})
18
19
  params = {
19
- session_attributes: lex.session_attributes,
20
- recent_intent_summary_view: lex.recent_intent_summary_view,
20
+ active_contexts: lex.active_contexts,
21
21
  intent_name: lex.current_intent.name,
22
+ recent_intent_summary_view: lex.recent_intent_summary_view,
23
+ session_attributes: lex.session_attributes,
22
24
  slots: lex.current_intent.slots
23
25
  }.merge(opts)
24
26
  Response::ConfirmIntent.new(params).to_lex
@@ -26,8 +28,9 @@ module Aws
26
28
 
27
29
  def delegate(opts = {})
28
30
  params = {
29
- session_attributes: lex.session_attributes,
31
+ active_contexts: lex.active_contexts,
30
32
  recent_intent_summary_view: lex.recent_intent_summary_view,
33
+ session_attributes: lex.session_attributes,
31
34
  slots: lex.current_intent.slots
32
35
  }.merge(opts)
33
36
  Response::Delegate.new(params).to_lex
@@ -35,18 +38,20 @@ module Aws
35
38
 
36
39
  def elicit_intent(opts = {})
37
40
  params = {
38
- session_attributes: lex.session_attributes,
39
- recent_intent_summary_view: lex.recent_intent_summary_view
41
+ active_contexts: lex.active_contexts,
42
+ recent_intent_summary_view: lex.recent_intent_summary_view,
43
+ session_attributes: lex.session_attributes
40
44
  }.merge(opts)
41
45
  Response::ElicitIntent.new(params).to_lex
42
46
  end
43
47
 
44
48
  def elicit_slot(opts = {})
45
49
  params = {
46
- session_attributes: lex.session_attributes,
50
+ active_contexts: lex.active_contexts,
51
+ intent_name: lex.current_intent.name,
47
52
  recent_intent_summary_view: lex.recent_intent_summary_view,
48
- slots: lex.current_intent.slots,
49
- intent_name: lex.current_intent.name
53
+ session_attributes: lex.session_attributes,
54
+ slots: lex.current_intent.slots
50
55
  }.merge(opts)
51
56
  Response::ElicitSlot.new(params).to_lex
52
57
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Lex
5
+ class Conversation
6
+ module Type
7
+ class Context
8
+ include Base
9
+
10
+ required :time_to_live
11
+ required :name
12
+ required :parameters
13
+
14
+ coerce(
15
+ time_to_live: TimeToLive,
16
+ parameters: symbolize_hash!
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -7,6 +7,7 @@ module Aws
7
7
  class Event
8
8
  include Base
9
9
 
10
+ required :active_contexts, default: -> { [] }
10
11
  required :alternative_intents, default: -> { [] }
11
12
  required :current_intent
12
13
  required :bot
@@ -26,6 +27,7 @@ module Aws
26
27
  end
27
28
 
28
29
  coerce(
30
+ active_contexts: Array[Context],
29
31
  alternative_intents: Array[Intent],
30
32
  current_intent: Intent,
31
33
  bot: Bot,
@@ -29,7 +29,7 @@ module Aws
29
29
  def slot_details!
30
30
  ->(val) do
31
31
  val
32
- .reject { |_, v| v.nil? }
32
+ .compact
33
33
  .each_with_object({}) do |(key, value), hash|
34
34
  hash[key.to_sym] = SlotDetail.shrink_wrap(value)
35
35
  end
@@ -10,6 +10,7 @@ module Aws
10
10
  required :dialog_action
11
11
  optional :session_attributes
12
12
  optional :recent_intent_summary_view
13
+ optional :active_contexts
13
14
  end
14
15
  end
15
16
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws
4
+ module Lex
5
+ class Conversation
6
+ module Type
7
+ class TimeToLive
8
+ include Base
9
+
10
+ required :time_to_live_in_seconds
11
+ required :turns_to_live
12
+
13
+ coerce(
14
+ time_to_live_in_seconds: integer!,
15
+ turns_to_live: integer!
16
+ )
17
+
18
+ alias_method :seconds, :time_to_live_in_seconds
19
+ alias_method :seconds=, :time_to_live_in_seconds=
20
+ alias_method :turns, :turns_to_live
21
+ alias_method :turns=, :turns_to_live=
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -3,7 +3,7 @@
3
3
  module Aws
4
4
  module Lex
5
5
  class Conversation
6
- VERSION = '2.0.0'
6
+ VERSION = '2.1.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: 2.0.0
4
+ version: 2.1.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: 2020-08-21 00:00:00.000000000 Z
15
+ date: 2021-02-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: shrink_wrap
@@ -75,6 +75,7 @@ files:
75
75
  - lib/aws/lex/conversation/type/base.rb
76
76
  - lib/aws/lex/conversation/type/bot.rb
77
77
  - lib/aws/lex/conversation/type/confirmation_status.rb
78
+ - lib/aws/lex/conversation/type/context.rb
78
79
  - lib/aws/lex/conversation/type/dialog_action_type.rb
79
80
  - lib/aws/lex/conversation/type/enumeration.rb
80
81
  - lib/aws/lex/conversation/type/event.rb
@@ -97,6 +98,7 @@ files:
97
98
  - lib/aws/lex/conversation/type/slot.rb
98
99
  - lib/aws/lex/conversation/type/slot_detail.rb
99
100
  - lib/aws/lex/conversation/type/slot_resolution.rb
101
+ - lib/aws/lex/conversation/type/time_to_live.rb
100
102
  - lib/aws/lex/conversation/version.rb
101
103
  homepage: https://github.com/amaabca/aws-lex-conversation
102
104
  licenses:
@@ -118,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
120
  - !ruby/object:Gem::Version
119
121
  version: '0'
120
122
  requirements: []
121
- rubygems_version: 3.1.2
123
+ rubygems_version: 3.1.4
122
124
  signing_key:
123
125
  specification_version: 4
124
126
  summary: AWS Lex Conversation Dialog Management