Class: Dialog

Inherits:
Object
  • Object
show all
Defined in:
lib/load_dialogs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Dialog

Returns a new instance of Dialog.



32
33
34
35
36
# File 'lib/load_dialogs.rb', line 32

def initialize args
  args.each do |k,v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#describeObject (readonly)

Returns the value of attribute describe.



29
30
31
# File 'lib/load_dialogs.rb', line 29

def describe
  @describe
end

#fileObject

Returns the value of attribute file.



30
31
32
# File 'lib/load_dialogs.rb', line 30

def file
  @file
end

#interactionsObject (readonly)

Returns the value of attribute interactions.



29
30
31
# File 'lib/load_dialogs.rb', line 29

def interactions
  @interactions
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/load_dialogs.rb', line 29

def name
  @name
end

Instance Method Details

#create_exampleObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/load_dialogs.rb', line 46

def create_example()
  return if @interactions.size == 0
  interactions = @interactions

  @@lex_chat = lex_chat()
  ::RSpec.describe "#{@describe} #{@name}" do

    it @name do
      while interactions.size > 1 do
        resp = @@lex_chat.post_message(interactions[0])
        expect(resp[:message]).to match(interactions[1])
        interactions = interactions.drop(2)          
      end

      resp = @@lex_chat.post_message(interactions[0]) if interactions.size == 1
    end
  end

end

#lex_chatObject



42
43
44
# File 'lib/load_dialogs.rb', line 42

def lex_chat
  @lex_chat ||= BotSpec::AWS::LexService.new({botname: LoadDialogs.botname})
end