wit_bot 0.4.2 → 0.5.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
  SHA1:
3
- metadata.gz: c1b7c52f2b1b3dcb990efec623c7b8937d070863
4
- data.tar.gz: c4fac73cffe1125374cfd876f4cbae198b2fcd00
3
+ metadata.gz: 6665e746f0e43cac8afda18e6597652e9938c3c8
4
+ data.tar.gz: 61201b2b210381924ebbafebf873117d32f7fbec
5
5
  SHA512:
6
- metadata.gz: 658ca8a99ce362a44beb1d233b1df2c6ee30e1ea0fbe27d002526af4f12c8b287fd258ba060c7b2db7ef8972dede09be7b9a16457df1bc285c24da2114d8961b
7
- data.tar.gz: 2fe302edf51fe1bde5c5e1f5d6b719b11314b83fb58771b7575a873a200729ef0ab7c0494f92f088e2a74b0605ce08c5ff07b49faa80a4cfcc1f4d4d99ee38f8
6
+ metadata.gz: b6b754b9c04dafd6a263b400f0d6423b0ccb553a0f809aa905c56145c2f463e3529d304949275e94c8058b1793d543b568db1ac6b888e05ee6291d80ec034565
7
+ data.tar.gz: 984e8ba0c67d29c9365bb9c794a6085f2cd142058ce1190bfd619b9544475f5a42899bf10b11d155e2f3b871df5ceaedbe261290e7301cbe9c85a0f638c84c0f
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Sets up an initializer for wit_bot.
3
+
4
+ Example:
5
+ rails generate wit_bot:setup
6
+
7
+ This will create:
8
+ config/initializers/wit_bot.rb
@@ -0,0 +1,12 @@
1
+ module WitBot
2
+ module Generators
3
+ class BotGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+ argument :intents, type: :array, default: nil
6
+
7
+ def create_bot
8
+ template 'bot.rb.erb', "app/wit_bot/#{file_name}_bot.rb"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ class <%=class_name%>Bot < WitBot::Bot::Base
2
+ # Set the intents your app listens to:
3
+ <% if intents && !intents.empty? %>
4
+ intents <%= intents.map{|i| ":#{i.to_s}"}.join(', ') %>
5
+
6
+ <% intents.each do |intent| %>
7
+ # When the <%= intent %> intent is received...
8
+ def on_<%= intent %>(message)
9
+ # Do something
10
+ end
11
+ <% end %>
12
+ <% else %>
13
+ # intents :example_intent, :example2 ...
14
+
15
+ # def on_example_intent(message)
16
+ # # do something
17
+ # end
18
+ <% end %>
19
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Sets up an initializer for wit_bot.
3
+
4
+ Example:
5
+ rails generate wit_bot:setup
6
+
7
+ This will create:
8
+ config/initializers/wit_bot.rb
@@ -0,0 +1,11 @@
1
+ module WitBot
2
+ module Generators
3
+ class SetupGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def create_initializer_file
7
+ copy_file 'initializer.rb', 'config/initializers/wit_bot.rb'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ WitBot.configure do |c|
2
+ # Set your access token here. We recommend using the ENV variable for security reasons.
3
+ c.token = ENV['WIT_ACCESS_TOKEN']
4
+ end
@@ -1,3 +1,3 @@
1
1
  module WitBot
2
- VERSION = '0.4.2'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wit_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben (@penne12_)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-02 00:00:00.000000000 Z
11
+ date: 2016-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,6 +148,12 @@ files:
148
148
  - examples/helpers/helpers.rb
149
149
  - examples/simple.rb
150
150
  - examples/thread.rb
151
+ - lib/generators/wit_bot/bot/USAGE
152
+ - lib/generators/wit_bot/bot/bot_generator.rb
153
+ - lib/generators/wit_bot/bot/templates/bot.rb.erb
154
+ - lib/generators/wit_bot/setup/USAGE
155
+ - lib/generators/wit_bot/setup/setup_generator.rb
156
+ - lib/generators/wit_bot/setup/templates/initializer.rb
151
157
  - lib/wit_bot.rb
152
158
  - lib/wit_bot/bot/base.rb
153
159
  - lib/wit_bot/bot/conversation/base.rb