wit_bot 0.5.2 → 0.5.3

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: 54335eac2026b307d2ee5ab5d2db3bd677682307
4
- data.tar.gz: 383290319ad7d6a874f3b285380d2b1031ab3092
3
+ metadata.gz: c7d6e0785606df6105dde09e3ead4e05271731a9
4
+ data.tar.gz: 9dddbc1790db86afcccaf3b034db1214216745d3
5
5
  SHA512:
6
- metadata.gz: 94fda45b8bed4e23e077ac9182de55967c06bb5e78a634973a88bbd0f010c0a830aa7b79cb5069499441d9c72cf89386515489660fd75545b2a123bece745722
7
- data.tar.gz: 7b4d2d19a66604195a0c0709eb3668e893aefdc0d88213b8c4f98db6ba75d29b77dd8256d5fc3b268751da1eaf5ce166154ce12c8db38ab5be5ea2faeab1f8a2
6
+ metadata.gz: 8847345c0d92b91ec8ba730fbe81ad13c82a859c29eaa886868bc6c9a05cff80ee17d32d1883a87513924b7ef0cd36d976039f9556c45d8a2dfc4d1d5899277a
7
+ data.tar.gz: 8295f7591a12a2cd0d138ce693f27cc29ba7136c355c67cb590b0a6ef55ca856ac66b9649c6701fceac4c4b5a06e97eb2879d3442ccadee36df8be1cf7e2524b
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # WitBot
2
2
 
3
+ [![GitHub stars](https://img.shields.io/github/stars/penne12/wit_bot.svg?style=flat-square?style=flat-square)](https://github.com/penne12/wit_bot)
3
4
  ![gem version](https://img.shields.io/gem/v/wit_bot.svg?style=flat-square)
4
5
  ![gem rank](https://img.shields.io/gem/rt/wit_bot.svg?style=flat-square)
5
6
  ![gem downloads](https://img.shields.io/gem/dt/wit_bot.svg?style=flat-square)
@@ -8,6 +9,15 @@ A better [wit.ai] client for Ruby. Written in Ruby. With an api for creating bot
8
9
 
9
10
  Pretty Awesome™
10
11
 
12
+ ## We're on:
13
+
14
+ | [Product Hunt] | [Hacker News] | [Reddit] |
15
+ |----------------|---------------|----------|
16
+
17
+ [Product Hunt]: https://www.producthunt.com/tech/witbot
18
+ [Hacker News]: https://news.ycombinator.com/item?id=11411364
19
+ [Reddit]: https://www.reddit.com/r/languagetechnology
20
+
11
21
  ## Installation
12
22
 
13
23
  Add this line to your application's Gemfile:
@@ -45,4 +55,4 @@ The gem is available as open source under the terms of the [MIT License].
45
55
 
46
56
  [wit.ai]: https://wit.ai/
47
57
  [wiki]: https://github.com/penne12/wit_bot/wiki
48
- [MIT License]: http://opensource.org/licenses/MIT
58
+ [MIT License]: http://opensource.org/licenses/MIT
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Creates a job to clear old conversations.
3
+
4
+ Example:
5
+
6
+ rails generate wit_bot:clear_conversations_job
7
+
8
+ This will create:
9
+
10
+ clock.rb
11
+ app/jobs/clear_conversations_job.rb
@@ -0,0 +1,14 @@
1
+ module WitBot
2
+ module Generators
3
+ class ClearConversationsJobGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def create_job
7
+ gem 'clockwork', '~> 1.2.0'
8
+
9
+ template 'clock.rb', 'clock.rb'
10
+ template 'clear_conversations_job.rb', 'app/jobs/clear_conversations_job.rb'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ require 'clockwork'
2
+
3
+ require_relative 'config/boot'
4
+ require_relative 'config/environment'
5
+
6
+ module Clockwork
7
+ every(1.hour, 'Clear Old Conversations') { ClearConversationsJob.perform_later }
8
+ end
@@ -0,0 +1,8 @@
1
+ class ClearConversationsJob < ActiveJob::Base
2
+ queue_as :low
3
+
4
+ def perform
5
+ # Find all conversations not updated in the last 4 hours, and destroy them.
6
+ Conversation.where{ updated_at <= 4.hours.ago }.destroy_all
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module WitBot
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
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.5.2
4
+ version: 0.5.3
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-03 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,6 +151,10 @@ files:
151
151
  - lib/generators/wit_bot/bot/USAGE
152
152
  - lib/generators/wit_bot/bot/bot_generator.rb
153
153
  - lib/generators/wit_bot/bot/templates/bot.rb.erb
154
+ - lib/generators/wit_bot/clear_conversations_job/USAGE.txt
155
+ - lib/generators/wit_bot/clear_conversations_job/clear_conversations_job.rb
156
+ - lib/generators/wit_bot/clear_conversations_job/templates/clock.rb
157
+ - lib/generators/wit_bot/clear_conversations_job/templates/job.rb
154
158
  - lib/generators/wit_bot/message_bus/USAGE
155
159
  - lib/generators/wit_bot/message_bus/message_bus_generator.rb
156
160
  - lib/generators/wit_bot/message_bus/templates/job.rb.erb