xip 0.0.1 → 2.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +116 -0
- data/.gitignore +12 -0
- data/CHANGELOG.md +135 -0
- data/Gemfile +4 -1
- data/Gemfile.lock +65 -15
- data/LICENSE +6 -4
- data/README.md +51 -1
- data/VERSION +1 -0
- data/bin/xip +3 -11
- data/lib/xip.rb +1 -3
- data/lib/xip/base.rb +189 -0
- data/lib/xip/cli.rb +273 -0
- data/lib/xip/cli_base.rb +24 -0
- data/lib/xip/commands/command.rb +13 -0
- data/lib/xip/commands/console.rb +74 -0
- data/lib/xip/commands/server.rb +63 -0
- data/lib/xip/configuration.rb +56 -0
- data/lib/xip/controller/callbacks.rb +63 -0
- data/lib/xip/controller/catch_all.rb +84 -0
- data/lib/xip/controller/controller.rb +274 -0
- data/lib/xip/controller/dev_jumps.rb +40 -0
- data/lib/xip/controller/dynamic_delay.rb +61 -0
- data/lib/xip/controller/helpers.rb +128 -0
- data/lib/xip/controller/interrupt_detect.rb +99 -0
- data/lib/xip/controller/messages.rb +283 -0
- data/lib/xip/controller/nlp.rb +49 -0
- data/lib/xip/controller/replies.rb +281 -0
- data/lib/xip/controller/unrecognized_message.rb +61 -0
- data/lib/xip/core_ext.rb +5 -0
- data/lib/xip/core_ext/numeric.rb +10 -0
- data/lib/xip/core_ext/string.rb +18 -0
- data/lib/xip/dispatcher.rb +68 -0
- data/lib/xip/errors.rb +55 -0
- data/lib/xip/flow/base.rb +69 -0
- data/lib/xip/flow/specification.rb +56 -0
- data/lib/xip/flow/state.rb +82 -0
- data/lib/xip/generators/builder.rb +41 -0
- data/lib/xip/generators/builder/.gitignore +30 -0
- data/lib/xip/generators/builder/Gemfile +19 -0
- data/lib/xip/generators/builder/Procfile.dev +2 -0
- data/lib/xip/generators/builder/README.md +9 -0
- data/lib/xip/generators/builder/Rakefile +2 -0
- data/lib/xip/generators/builder/bot/controllers/bot_controller.rb +55 -0
- data/lib/xip/generators/builder/bot/controllers/catch_alls_controller.rb +21 -0
- data/lib/xip/generators/builder/bot/controllers/concerns/.keep +0 -0
- data/lib/xip/generators/builder/bot/controllers/goodbyes_controller.rb +9 -0
- data/lib/xip/generators/builder/bot/controllers/hellos_controller.rb +9 -0
- data/lib/xip/generators/builder/bot/controllers/interrupts_controller.rb +9 -0
- data/lib/xip/generators/builder/bot/controllers/unrecognized_messages_controller.rb +9 -0
- data/lib/xip/generators/builder/bot/helpers/bot_helper.rb +2 -0
- data/lib/xip/generators/builder/bot/models/bot_record.rb +3 -0
- data/lib/xip/generators/builder/bot/models/concerns/.keep +0 -0
- data/lib/xip/generators/builder/bot/replies/catch_alls/level1.yml +2 -0
- data/lib/xip/generators/builder/bot/replies/goodbyes/say_goodbye.yml +2 -0
- data/lib/xip/generators/builder/bot/replies/hellos/say_hello.yml +2 -0
- data/lib/xip/generators/builder/config.ru +4 -0
- data/lib/xip/generators/builder/config/boot.rb +6 -0
- data/lib/xip/generators/builder/config/database.yml +25 -0
- data/lib/xip/generators/builder/config/environment.rb +2 -0
- data/lib/xip/generators/builder/config/flow_map.rb +25 -0
- data/lib/xip/generators/builder/config/initializers/autoload.rb +8 -0
- data/lib/xip/generators/builder/config/initializers/inflections.rb +16 -0
- data/lib/xip/generators/builder/config/puma.rb +25 -0
- data/lib/xip/generators/builder/config/services.yml +35 -0
- data/lib/xip/generators/builder/config/sidekiq.yml +3 -0
- data/lib/xip/generators/builder/db/seeds.rb +7 -0
- data/lib/xip/generators/generate.rb +39 -0
- data/lib/xip/generators/generate/flow/controllers/controller.tt +7 -0
- data/lib/xip/generators/generate/flow/helpers/helper.tt +3 -0
- data/lib/xip/generators/generate/flow/replies/ask_example.tt +9 -0
- data/lib/xip/helpers/redis.rb +40 -0
- data/lib/xip/jobs.rb +9 -0
- data/lib/xip/lock.rb +82 -0
- data/lib/xip/logger.rb +9 -3
- data/lib/xip/migrations/configurator.rb +73 -0
- data/lib/xip/migrations/generators.rb +16 -0
- data/lib/xip/migrations/railtie_config.rb +14 -0
- data/lib/xip/migrations/tasks.rb +43 -0
- data/lib/xip/nlp/client.rb +21 -0
- data/lib/xip/nlp/result.rb +56 -0
- data/lib/xip/reloader.rb +89 -0
- data/lib/xip/reply.rb +36 -0
- data/lib/xip/scheduled_reply.rb +18 -0
- data/lib/xip/server.rb +63 -0
- data/lib/xip/service_message.rb +17 -0
- data/lib/xip/service_reply.rb +44 -0
- data/lib/xip/services/base_client.rb +24 -0
- data/lib/xip/services/base_message_handler.rb +27 -0
- data/lib/xip/services/base_reply_handler.rb +72 -0
- data/lib/xip/services/jobs/handle_message_job.rb +21 -0
- data/lib/xip/session.rb +203 -0
- data/lib/xip/version.rb +7 -1
- data/logo.svg +17 -0
- data/spec/configuration_spec.rb +93 -0
- data/spec/controller/callbacks_spec.rb +217 -0
- data/spec/controller/catch_all_spec.rb +154 -0
- data/spec/controller/controller_spec.rb +889 -0
- data/spec/controller/dynamic_delay_spec.rb +70 -0
- data/spec/controller/helpers_spec.rb +119 -0
- data/spec/controller/interrupt_detect_spec.rb +171 -0
- data/spec/controller/messages_spec.rb +744 -0
- data/spec/controller/nlp_spec.rb +93 -0
- data/spec/controller/replies_spec.rb +694 -0
- data/spec/controller/unrecognized_message_spec.rb +168 -0
- data/spec/dispatcher_spec.rb +79 -0
- data/spec/flow/flow_spec.rb +82 -0
- data/spec/flow/state_spec.rb +109 -0
- data/spec/helpers/redis_spec.rb +77 -0
- data/spec/lock_spec.rb +100 -0
- data/spec/nlp/client_spec.rb +23 -0
- data/spec/nlp/result_spec.rb +57 -0
- data/spec/replies/hello.yml.erb +15 -0
- data/spec/replies/messages/say_hola.yml+facebook.erb +6 -0
- data/spec/replies/messages/say_hola.yml+twilio.erb +6 -0
- data/spec/replies/messages/say_hola.yml.erb +6 -0
- data/spec/replies/messages/say_howdy_with_dynamic.yml +79 -0
- data/spec/replies/messages/say_msgs_without_breaks.yml +4 -0
- data/spec/replies/messages/say_offer.yml +6 -0
- data/spec/replies/messages/say_offer_with_dynamic.yml +6 -0
- data/spec/replies/messages/say_oi.yml.erb +15 -0
- data/spec/replies/messages/say_randomize_speech.yml +10 -0
- data/spec/replies/messages/say_randomize_text.yml +10 -0
- data/spec/replies/messages/say_yo.yml +6 -0
- data/spec/replies/messages/say_yo.yml+twitter +6 -0
- data/spec/replies/messages/sub1/sub2/say_nested.yml +10 -0
- data/spec/reply_spec.rb +61 -0
- data/spec/scheduled_reply_spec.rb +23 -0
- data/spec/service_reply_spec.rb +92 -0
- data/spec/session_spec.rb +366 -0
- data/spec/spec_helper.rb +22 -66
- data/spec/support/alternate_helpers/foo_helper.rb +5 -0
- data/spec/support/controllers/vaders_controller.rb +24 -0
- data/spec/support/helpers/fun/games_helper.rb +7 -0
- data/spec/support/helpers/fun/pdf_helper.rb +7 -0
- data/spec/support/helpers/standalone_helper.rb +5 -0
- data/spec/support/helpers_typo/users_helper.rb +2 -0
- data/spec/support/nlp_clients/dialogflow.rb +9 -0
- data/spec/support/nlp_clients/luis.rb +9 -0
- data/spec/support/nlp_results/luis_result.rb +163 -0
- data/spec/support/sample_messages.rb +66 -0
- data/spec/support/services.yml +31 -0
- data/spec/support/services_with_erb.yml +31 -0
- data/spec/version_spec.rb +16 -0
- data/xip.gemspec +25 -14
- metadata +320 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ab4a49b00d8aa6cf932ce0e918e017ab2bd3fc226d31aa54d96af3e046fb6c9
|
4
|
+
data.tar.gz: 30b6944b77f421190585e3fb3159a913bdd9c9e3d6ddebe0c7b330a7ce0d2e96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf670a2bf2804ab525df5af0bb7957dd851de3a39988a79817a0dfbc5036ca632541aa6758c76382cb1932763bbd5138ab29f4dbc720ad2fa11dc5d902b1b99
|
7
|
+
data.tar.gz: fe59920fec27c782efa08583854f3658f544673308b64d60734082e6aae2e09d61ed539b851c9938447dca8e0cedb3323f95bd40d8c61cf634c5200c769af56f
|
@@ -0,0 +1,116 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
ruby_2_6:
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.6-node-browsers
|
7
|
+
environment:
|
8
|
+
STEALTH_ENV: test
|
9
|
+
|
10
|
+
working_directory: ~/repo
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
|
15
|
+
# Download and cache dependencies
|
16
|
+
- restore_cache:
|
17
|
+
keys:
|
18
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
19
|
+
# fallback to using the latest cache if no exact match is found
|
20
|
+
- v1-dependencies-
|
21
|
+
- run:
|
22
|
+
name: Configure Bundler
|
23
|
+
command: |
|
24
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
25
|
+
source $BASH_ENV
|
26
|
+
gem install bundler
|
27
|
+
- run:
|
28
|
+
name: install dependencies
|
29
|
+
command: |
|
30
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
31
|
+
|
32
|
+
- save_cache:
|
33
|
+
paths:
|
34
|
+
- ./vendor/bundle
|
35
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
36
|
+
|
37
|
+
# run tests!
|
38
|
+
- run:
|
39
|
+
name: run tests
|
40
|
+
command: |
|
41
|
+
mkdir /tmp/test-results
|
42
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
43
|
+
|
44
|
+
bundle exec rspec --format progress \
|
45
|
+
--format RspecJunitFormatter \
|
46
|
+
--out /tmp/test-results/rspec.xml \
|
47
|
+
--format progress \
|
48
|
+
-- \
|
49
|
+
$TEST_FILES
|
50
|
+
|
51
|
+
# collect reports
|
52
|
+
- store_test_results:
|
53
|
+
path: /tmp/test-results
|
54
|
+
- store_artifacts:
|
55
|
+
path: /tmp/test-results
|
56
|
+
destination: test-results
|
57
|
+
ruby_2_7:
|
58
|
+
docker:
|
59
|
+
- image: circleci/ruby:2.7-node-browsers
|
60
|
+
environment:
|
61
|
+
STEALTH_ENV: test
|
62
|
+
|
63
|
+
working_directory: ~/repo
|
64
|
+
|
65
|
+
steps:
|
66
|
+
- checkout
|
67
|
+
|
68
|
+
# Download and cache dependencies
|
69
|
+
- restore_cache:
|
70
|
+
keys:
|
71
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
72
|
+
# fallback to using the latest cache if no exact match is found
|
73
|
+
- v1-dependencies-
|
74
|
+
- run:
|
75
|
+
name: Configure Bundler
|
76
|
+
command: |
|
77
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
78
|
+
source $BASH_ENV
|
79
|
+
gem install bundler
|
80
|
+
- run:
|
81
|
+
name: install dependencies
|
82
|
+
command: |
|
83
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
84
|
+
|
85
|
+
- save_cache:
|
86
|
+
paths:
|
87
|
+
- ./vendor/bundle
|
88
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
89
|
+
|
90
|
+
# run tests!
|
91
|
+
- run:
|
92
|
+
name: run tests
|
93
|
+
command: |
|
94
|
+
mkdir /tmp/test-results
|
95
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
96
|
+
|
97
|
+
bundle exec rspec --format progress \
|
98
|
+
--format RspecJunitFormatter \
|
99
|
+
--out /tmp/test-results/rspec.xml \
|
100
|
+
--format progress \
|
101
|
+
-- \
|
102
|
+
$TEST_FILES
|
103
|
+
|
104
|
+
# collect reports
|
105
|
+
- store_test_results:
|
106
|
+
path: /tmp/test-results
|
107
|
+
- store_artifacts:
|
108
|
+
path: /tmp/test-results
|
109
|
+
destination: test-results
|
110
|
+
|
111
|
+
workflows:
|
112
|
+
version: 2
|
113
|
+
build:
|
114
|
+
jobs:
|
115
|
+
- ruby_2_6
|
116
|
+
- ruby_2_7
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# Changelog for Xip v2.0.0
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* [Controllers] Added support for Dev Jumping. This feature allows developers to jump around flows and states for bot's in development.
|
6
|
+
* [NLP] Added base classes for `Xip::Nlp::Result` and `Xip::Nlp::Client` to be used by NLP drivers.
|
7
|
+
* [Controllers] Scheduled replies no longer call `controller.route` when they run. Instead we `step_to` to the flow and state directly. This ensures the `route` is reserved for incoming messages.
|
8
|
+
* [Catch All] Backtrace logging has been improved. The error message is now included first in the backtrace.
|
9
|
+
* [Logger] The thread's ID (TID) is now included in every logging entry preceding the log type, ie "[facebook]"
|
10
|
+
* [Interrupt] Interrupt detection has been added. See the docs for more info on this feature.
|
11
|
+
* [Controllers] When user's flow is set to `catch_all` or `interrupt`, Xip will ignore incoming messages. If you have interactive states in either of these controllers, you will need to move those interactions to a different controller.
|
12
|
+
* [Sessions] Sessions can now be cleared by calling `session.clear_session`. Clearing a session removes the key from Redis.
|
13
|
+
* [Logging] `primary_session`, `previous_session`, and `back_to_session` now explicitly logged
|
14
|
+
* [Sessions] The session is no longer set on update or stepping witht destination flow and state match the existing session.
|
15
|
+
* [Scheduled Replies] The `service_message.target_id` is now set for scheduled replies. NOTE: scheduled replies that are already enqueued will NOT have this set.
|
16
|
+
* [Server] Updated to Puma 4.3
|
17
|
+
* [Server] Updated to Sinatra 2.1
|
18
|
+
* [Sessions] Added `to_s` for sessions to pretty print the slug. Useful when debugging.
|
19
|
+
* `send_reples` now supports two additional options for replies:
|
20
|
+
`send_replies(custom_reply: 'hello/say_hello')`
|
21
|
+
`send_replies(inline: [])`
|
22
|
+
* Dynamic delays for SMS platforms do not delay at the beginning of a reply.
|
23
|
+
* Added support for Bandwidth SMS
|
24
|
+
* The `ServiceMessage` (current_message) now contains a `target_id`. This can be set by the platform driver to provide more information about the intended target of a message.
|
25
|
+
* [Controller] Added a `do_nothing` method that prevents `catch_all` from firing when a controller action doesn't send replies nor progresses the session.
|
26
|
+
* [Replies] If `text` and `speech` replies are specified as an Array, Xip will now randomize the selected text.
|
27
|
+
* [Generators] Added sample payload handling to generated bots since it can be tricky.
|
28
|
+
* [Generators] Added `inflections.rb` to generators since we rely on `ActiveSupport::Inflector` to derive flow and controller names.
|
29
|
+
* [Sessions] previous_session log entries now appear below current_session entries.
|
30
|
+
* [Logging] Add option, `Xip.config.transcript_logging`, to log incoming and outgoing messages.
|
31
|
+
* [Server] The only HTTP header passed along to `handle_message_job` is now `HTTP_HOST`.
|
32
|
+
* [Controllers] Added `set_back_to` and `step_back` to allow user specified "redirect back". Useful for multi-state transitions that would otherwise not be possible with just `previous_session`.
|
33
|
+
* [Configuration] Xip::Configuration now returns `nil` for a configuration option that is missing. It still returns a `NoMethodError` if attempting to access a key from a parent node that is also missing.
|
34
|
+
* [Reloading] Bots in development mode now hot reload! It's no longer necessary to stop your local server.
|
35
|
+
* [Production] Production bots now eager load bot code to improve copy-on-write performance. The `puma.rb` config has been updated with instructions for multiple workers.
|
36
|
+
* [Flows] You can now specify custom options when defining states. These options can later be accessed via the flow specification.
|
37
|
+
* [CoreExt] Added a `String#without_punctuation` method. Removes a lot of common punctuation.
|
38
|
+
* [CoreExt] `String#normalize` no longer removes quotation marks.
|
39
|
+
* [Controllers] Alpha ordinal checks are now done against a "normalized" string without punctuation. See above.
|
40
|
+
* [Controllers] `normalized_msg` and `homophone_translated_msg` are now memoized for performance.
|
41
|
+
* [Errors] `Xip::Errors::MessageNotRecognized` has been renamed to `Xip::Errors::UnrecognizedMessage`
|
42
|
+
* [Controllers] When `handle_message` or `get_match` raise a `Xip::Errors::UnrecognizedMessage`, the user is first routed to a new `UnrecognizedMessagesController` to perform NLP. If that controller fails to match, the `catch_all` is run as normal.
|
43
|
+
* [Errors] Client errors now call respective BotController actions: `handle_opt_out` and `handle_invalid_session_id`. Each client is responsible for raising `Xip::Errors::UserOptOut` or `Xip::Errors::InvalidSessionId` errors.
|
44
|
+
* [Controllers] `handle_message` and `get_match` now detect homophones for alpha ordinals (A-Z)
|
45
|
+
* [Controllers] `handle_message` and `get_match` now ignore single and double quotes for alpha-ordinals
|
46
|
+
* [CoreExt] Strings now have a `normalize` method for removing padding and quotes
|
47
|
+
* [Controllers] Improved logging when `UnrecognizedMessagesController` runs.
|
48
|
+
* [Controllers] State transitions (via `step_to`, `update_session_to`, `step_to_at`, `step_to_in`, and `set_back_to`) now accept a session `slug` argument.
|
49
|
+
* [Replies] Added support for sub-state replies. `step_to` can now take a `pos` argument that will force any resulting `send_replies` to be sent starting at the `pos` specified. `pos` can also be negative, for example, `-1` will force `send_replies` to send replies starting at (only) the last reply.
|
50
|
+
* [Replies] Dynamic delays are automatically sent before each reply. This can be disabled by setting `Xip.config.auto_insert_delays` to `false`. If a delay is already included, the auto-delay is skipped.
|
51
|
+
* [Controllers] `handle_message` now supports `Regexp` keys.
|
52
|
+
* [Configuration] `database.yml` is now parsed with ERB in order to support environment variables. Thanks @malkovro.
|
53
|
+
* [Replies] Speech and SSML replies now use `speech` and `ssml` as keys, respectively, instead of `text`
|
54
|
+
|
55
|
+
## Bug Fixes
|
56
|
+
|
57
|
+
* [Catch All] Errors triggered within CatchAlls no longer trigger a CatchAll. They are simply ignored. This prevents infinite looping scenarios.
|
58
|
+
* [Interrupt] If CatchAll runs and doesn't `step_to`, it releases the session lock.
|
59
|
+
* [Controller] Messages are no longer ignored in CatchAll and Interrupt controllers
|
60
|
+
* [Interrupts] After `send_replies`, we now release the session lock. This ensures replies that send buttons can properly receive responses from them.
|
61
|
+
* Callbacks specified in child controllers of `BotController` where not being called during `step_to`. While the fix was small, we've bumped the minor release to ensure this fix does not break existing codebases.
|
62
|
+
* Fixed another bug loading replies from a `custom_reply` path in `send_replies`
|
63
|
+
* Fixed bug loading replies from a `custom_reply` path in `send_replies`
|
64
|
+
* Leading dynamic delays in a reply are not sent again on SMS platforms.
|
65
|
+
* [Sessions] Sessions retrieved when session expiration was enabled would return as an Array rather than a slug.
|
66
|
+
* [Sessions] previous_session now respects session_ttl values.
|
67
|
+
* [Catch All] Log output from all catch_all logging now includes the session_id so they can be included in log searches.
|
68
|
+
* [NLP] Strip out values from single element arrays in the case of custom LUIS List entities.
|
69
|
+
* [Config] Attempting to overwrite default config values with `nil` or `false` now correctly sets those config values.
|
70
|
+
|
71
|
+
## Deprecations
|
72
|
+
|
73
|
+
* [Controllers] current_user_id has now been completely removed since becoming deprecated in 1.1.0.
|
74
|
+
* [Ruby] MRI 2.4 is no longer supported as we depend on ActiveSupport 6.0 now. Rails 6.0 only supports Ruby MRI 2.5+.
|
75
|
+
|
76
|
+
# Changelog for Xip v1.1.5
|
77
|
+
|
78
|
+
## Enhancements
|
79
|
+
|
80
|
+
* [Replies] Replies will now always send the `sender_id` that came in to the service drivers. This ensures `current_session_id` hasn't been modified which would cause replies to fail to send.
|
81
|
+
|
82
|
+
# Changelog for Xip v1.1.4
|
83
|
+
|
84
|
+
## Bug Fixes
|
85
|
+
|
86
|
+
* [General] Fixed controller and model concern load order. Previously files in the concerns folder were not loading before their respective controllers or models causing LoadErrors.
|
87
|
+
|
88
|
+
# Changelog for Xip v1.1.3
|
89
|
+
|
90
|
+
## Bug Fixes
|
91
|
+
|
92
|
+
* [Server] Additional CONTENT_TYPE fixes that would cause the server to 500 when it was missing.
|
93
|
+
|
94
|
+
# Changelog for Xip v1.1.2
|
95
|
+
|
96
|
+
## Bug Fixes
|
97
|
+
|
98
|
+
* [Server] Handle cases where CONTENT_TYPE is missing from incoming requests.
|
99
|
+
|
100
|
+
## Enhancements
|
101
|
+
|
102
|
+
* [CI] Added Ruby 2.6 to build.
|
103
|
+
|
104
|
+
# Changelog for Xip v1.1.1
|
105
|
+
|
106
|
+
## Bug Fixes
|
107
|
+
|
108
|
+
* [Server] Does not auto-return an HTTP 202. Leaves it up to the drivers again.
|
109
|
+
|
110
|
+
# Changelog for Xip v1.1.0
|
111
|
+
|
112
|
+
## Breaking Changes
|
113
|
+
|
114
|
+
* [Sidekiq] Sidekiq queues have been renamed from `webhooks` and `default` to `xip_webhooks` and `xip_replies`. Please ensure your `Procfile` is adjusted accordingly.
|
115
|
+
* [Flows] `flow_map.current_state.fails_to` now returns a `Xip::Session` instead of a `Xip::Flow::State`. This might affect your `catch_alls`.
|
116
|
+
|
117
|
+
## Enhancements
|
118
|
+
|
119
|
+
* [Controllers] `current_session_id` now references the session ID in controllers
|
120
|
+
* [Replies] Added support for dynamic delays
|
121
|
+
* [Replies] Added support for service-specific variants
|
122
|
+
* [Models] ActiveRecord is now part of the generated bot Gemfile and can be removed from bots
|
123
|
+
* [Flows] Added support for `redirects_to` during state declaration. If specified, will automatically step a user to the specified state or session.
|
124
|
+
* [Flows] `redirects_to` and `fails_to` now support a session string as an argument (`my_flow->some_state`). This allows you to fail and redirect to other flows. A state name specified as a string or symbol is still allowed.
|
125
|
+
* [Errors] Backtraces are now more readable in logs
|
126
|
+
* [Sessions] Sessions can now be configured to expire after a specified period of inactivity.
|
127
|
+
|
128
|
+
## Bug Fixes
|
129
|
+
|
130
|
+
* [Generators] Fixed flow generation
|
131
|
+
* [Generators] Fixed sample Facebook services.yml example
|
132
|
+
|
133
|
+
## Deprecations
|
134
|
+
|
135
|
+
* [Controllers] `current_user_id` has been soft deprecated in favor of `current_session_id`
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,33 +1,83 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xip (0.0.
|
5
|
-
|
4
|
+
xip (2.0.0.beta2)
|
5
|
+
activesupport (~> 6.0)
|
6
|
+
multi_json (~> 1.12)
|
7
|
+
puma (>= 4.2, < 5.0)
|
8
|
+
sidekiq (~> 6.0)
|
9
|
+
sinatra (~> 2.0)
|
10
|
+
thor (~> 1.0)
|
6
11
|
|
7
12
|
GEM
|
8
13
|
remote: https://rubygems.org/
|
9
14
|
specs:
|
15
|
+
activesupport (6.1.0)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
connection_pool (2.2.3)
|
10
23
|
diff-lcs (1.3)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
i18n (1.8.5)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
minitest (5.14.2)
|
27
|
+
mock_redis (0.23.0)
|
28
|
+
multi_json (1.15.0)
|
29
|
+
mustermann (1.1.1)
|
30
|
+
ruby2_keywords (~> 0.0.1)
|
31
|
+
nio4r (2.5.4)
|
32
|
+
oj (3.10.6)
|
33
|
+
puma (4.3.7)
|
34
|
+
nio4r (~> 2.0)
|
35
|
+
rack (2.2.3)
|
36
|
+
rack-protection (2.1.0)
|
37
|
+
rack
|
38
|
+
rack-test (1.1.0)
|
39
|
+
rack (>= 1.0, < 3)
|
40
|
+
redis (4.2.5)
|
41
|
+
rspec (3.9.0)
|
42
|
+
rspec-core (~> 3.9.0)
|
43
|
+
rspec-expectations (~> 3.9.0)
|
44
|
+
rspec-mocks (~> 3.9.0)
|
45
|
+
rspec-core (3.9.1)
|
46
|
+
rspec-support (~> 3.9.1)
|
47
|
+
rspec-expectations (3.9.1)
|
19
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-mocks (3.9.1)
|
22
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-support (3.
|
52
|
+
rspec-support (~> 3.9.0)
|
53
|
+
rspec-support (3.9.2)
|
54
|
+
rspec_junit_formatter (0.4.1)
|
55
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
56
|
+
ruby2_keywords (0.0.2)
|
57
|
+
sidekiq (6.1.2)
|
58
|
+
connection_pool (>= 2.2.2)
|
59
|
+
rack (~> 2.0)
|
60
|
+
redis (>= 4.2.0)
|
61
|
+
sinatra (2.1.0)
|
62
|
+
mustermann (~> 1.0)
|
63
|
+
rack (~> 2.2)
|
64
|
+
rack-protection (= 2.1.0)
|
65
|
+
tilt (~> 2.0)
|
66
|
+
thor (1.0.1)
|
67
|
+
tilt (2.0.10)
|
68
|
+
tzinfo (2.0.4)
|
69
|
+
concurrent-ruby (~> 1.0)
|
70
|
+
zeitwerk (2.4.2)
|
25
71
|
|
26
72
|
PLATFORMS
|
27
73
|
ruby
|
28
74
|
|
29
75
|
DEPENDENCIES
|
30
|
-
|
76
|
+
mock_redis (~> 0.22)
|
77
|
+
oj (~> 3.10)
|
78
|
+
rack-test (~> 1.1)
|
79
|
+
rspec (~> 3.9)
|
80
|
+
rspec_junit_formatter (~> 0.3)
|
31
81
|
xip!
|
32
82
|
|
33
83
|
BUNDLED WITH
|
data/LICENSE
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
Copyright (c) 2020
|
1
|
+
Copyright (c) 2017-2020 Mauricio Gomes
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1 +1,51 @@
|
|
1
|
-
# Xip
|
1
|
+
# <a href='https://xipkit.com'><img src='logo.svg' width='400' alt='Xip Logo' aria-label='xipkit.com' /></a>
|
2
|
+
|
3
|
+
Xip is a Ruby framework for creating text and voice chatbots. It's design is inspired by Ruby on Rails's philosophy of convention over configuration. It has an MVC architecture with the slight caveat that `views` are aptly named `replies`.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
* Deploy anywhere, it's just a Rack app
|
8
|
+
* Variants allow you to use a single codebase on multiple messaging platforms
|
9
|
+
* Structured, universal reply format
|
10
|
+
* Sessions utilize a state-machine concept and are Redis backed
|
11
|
+
* Highly scalable. Incoming webhooks are processed via a Sidekiq queue
|
12
|
+
* Built-in best practices: catch-alls (error handling), hello flows, goodbye flows
|
13
|
+
|
14
|
+
## Getting Started
|
15
|
+
|
16
|
+
Getting started with Xip is simple:
|
17
|
+
|
18
|
+
```
|
19
|
+
> gem install xip
|
20
|
+
> xip new <bot>
|
21
|
+
```
|
22
|
+
|
23
|
+
## Service Integrations
|
24
|
+
|
25
|
+
Xip is extensible. All service integrations are split out into separate Ruby Gems. Things like analytics and natural language processing ([NLP](https://en.wikipedia.org/wiki/Natural-language_processing)) can be added in as gems as well.
|
26
|
+
|
27
|
+
Currently, there are gems for:
|
28
|
+
|
29
|
+
### Messaging
|
30
|
+
* [Facebook Messenger](https://github.com/xipkit/xip-facebook)
|
31
|
+
* [Twilio SMS and Whatsapp](https://github.com/xipkit/xip-twilio)
|
32
|
+
|
33
|
+
### Voice
|
34
|
+
* [Alexa Skill](https://github.com/xipkit/xip-alexa) (Early alpha)
|
35
|
+
* [Custom Voice](https://github.com/xipkit/xip-voice) (Early alpha)
|
36
|
+
|
37
|
+
### Natural Language Processing
|
38
|
+
* [LUIS](https://github.com/xipkit/xip-luis)
|
39
|
+
|
40
|
+
|
41
|
+
## Docs
|
42
|
+
|
43
|
+
You can find our full docs [here](https://github.com/xipkit/docs). If something is not clear in the docs, please file an issue! We consider all shortcomings in the docs as bugs.
|
44
|
+
|
45
|
+
## Versioning
|
46
|
+
|
47
|
+
Xip is versioned using [Semantic Versioning](https://semver.org). Even with major versions, though, we will strive to minimize breaking changes.
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
Xip is licensed under the MIT license. "Xip" and the Xip Kit logo are Copyright (c) 2020 Mauricio Gomes
|