colloquy 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +160 -0
  3. data/TODO.md +256 -0
  4. data/bin/colloquy +14 -0
  5. data/examples/config/flows.yaml +22 -0
  6. data/examples/config/logger.yaml +2 -0
  7. data/examples/config/messages.yaml +3 -0
  8. data/examples/config/mysql.yaml +18 -0
  9. data/examples/config/redis.yaml +9 -0
  10. data/examples/config/scribe.yaml +2 -0
  11. data/examples/config/settings.yaml +2 -0
  12. data/examples/config/test.yaml +8 -0
  13. data/examples/config/urls.yaml +18 -0
  14. data/examples/flows/active_record_flow.rb +42 -0
  15. data/examples/flows/art_of_war_flow.rb +27 -0
  16. data/examples/flows/calculator_flow.rb +71 -0
  17. data/examples/flows/crossover_flow.rb +17 -0
  18. data/examples/flows/database_flow.rb +33 -0
  19. data/examples/flows/hangman_flow.rb +82 -0
  20. data/examples/flows/metadata_flow.rb +11 -0
  21. data/examples/flows/pagination_flow.rb +23 -0
  22. data/examples/flows/pass_flow.rb +29 -0
  23. data/examples/flows/prefix_menu_flow.rb +24 -0
  24. data/examples/flows/scribe_flow.rb +26 -0
  25. data/examples/flows/settings_flow.rb +23 -0
  26. data/examples/flows/special/special_redis_flow.rb +28 -0
  27. data/examples/flows/url_flow.rb +27 -0
  28. data/examples/log/renderer.log +198381 -0
  29. data/examples/log/urls.log +3269 -0
  30. data/examples/messages/active_record.yaml +2 -0
  31. data/examples/messages/art_of_war.yaml +1 -0
  32. data/examples/messages/calculator.yaml +2 -0
  33. data/examples/messages/database.yaml +1 -0
  34. data/examples/messages/hangman.yaml +0 -0
  35. data/examples/messages/prefix_menu.yaml +3 -0
  36. data/examples/models/activations.rb +5 -0
  37. data/lib/colloquy.rb +39 -0
  38. data/lib/colloquy/exceptions.rb +64 -0
  39. data/lib/colloquy/flow_parser.rb +315 -0
  40. data/lib/colloquy/flow_pool.rb +21 -0
  41. data/lib/colloquy/helpers.rb +15 -0
  42. data/lib/colloquy/helpers/mysql.rb +110 -0
  43. data/lib/colloquy/helpers/redis.rb +103 -0
  44. data/lib/colloquy/helpers/scribe.rb +103 -0
  45. data/lib/colloquy/helpers/settings.rb +111 -0
  46. data/lib/colloquy/helpers/url.rb +10 -0
  47. data/lib/colloquy/input.rb +14 -0
  48. data/lib/colloquy/logger.rb +11 -0
  49. data/lib/colloquy/menu.rb +128 -0
  50. data/lib/colloquy/message_builder.rb +54 -0
  51. data/lib/colloquy/node.rb +67 -0
  52. data/lib/colloquy/paginator.rb +59 -0
  53. data/lib/colloquy/paginator/menu.rb +79 -0
  54. data/lib/colloquy/paginator/prompt.rb +32 -0
  55. data/lib/colloquy/prompt.rb +35 -0
  56. data/lib/colloquy/renderer.rb +423 -0
  57. data/lib/colloquy/response.rb +4 -0
  58. data/lib/colloquy/runner.rb +93 -0
  59. data/lib/colloquy/server.rb +157 -0
  60. data/lib/colloquy/session_store.rb +46 -0
  61. data/lib/colloquy/session_store/memory.rb +14 -0
  62. data/lib/colloquy/session_store/redis.rb +24 -0
  63. data/lib/colloquy/simulator.rb +114 -0
  64. data/lib/colloquy/spec_helpers.rb +21 -0
  65. metadata +459 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjUzNDIwM2U3ODg2MWMxZmNmNTc4MmE0MmRhMjFhNmZhMmRhNjZjZQ==
5
+ data.tar.gz: !binary |-
6
+ MmYxYTgzNjdhZTkxNjk3NmQ2Y2Y4YTYxYTg2M2UwYzEwODFkMjllZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDYxZWEzYzY1ZmMxMzY3NmIxNWZhODhhYTU2OTY2N2M3MDE0MzkyN2MyNzli
10
+ MGY4OWJlN2ZmYjA4YTgyNjZkMDE4ZjU1MTcyMTRjOWY4NjZkMmFhNWNlMDUz
11
+ MzQ2MjEyNGY2ZTM3YzU0MzRhOTM2Y2U0MjFlZjFjOTVhN2ZiMmQ=
12
+ data.tar.gz: !binary |-
13
+ ODRhNDUxZWZmM2JmMzhlYWNkYzRkZTdlZTE2OTdiMTdhNzE1MzhiZWUxODlj
14
+ YzQ3NjVjMGJkZmNkNWJlYTUwNmY3NzhhYjkxZGIxMWJiN2MxMmYzZjZkMTZl
15
+ NDczMTJiYjgzNTkwNmI1ZWUxMmEzZTA3MzhmYTE1MDg4MGFmMWM=
@@ -0,0 +1,160 @@
1
+ # Colloquy
2
+
3
+ ## Overview
4
+
5
+ Colloquy is a library to build [USSD](http://en.wikipedia.org/wiki/Unstructured_Supplementary_Service_Data) applications in Ruby. It's a high-level full stack framework and addresses all common USSD needs: examples including building and managing a menu in USSD, accessing services over HTTP or even writing a hangman game.
6
+
7
+ ## Philosophy
8
+
9
+ * Ruby is more often than not the best DSL.
10
+ * Stay as close to the USSD spec as possible. Use the same terminology when possible.
11
+ * Be fast.
12
+ * Make BDD or TDD easy to do.
13
+ * Address real world needs, so handle slow backends gracefully and provide helpers for all common tasks.
14
+
15
+ ## Prerequisites
16
+
17
+ You'll need to have a basic understanding of how [USSD](http://en.wikipedia.org/wiki/Unstructured_Supplementary_Service_Data) applications work. The most common example of a USSD application is how folks check balance on a mobile phone: on Vodafone India for example, this is by dialing _*141#_. This special "phone number" is a USSD code.
18
+
19
+ ## Installing for Core Development
20
+
21
+ **Note:** you only need to do this if you intend to tweak the redux code itself. If you just want to develop USSD applications, see Installation for Flow Developers.
22
+
23
+ First install rvm and ruby > 1.9.3.
24
+
25
+ Then do:
26
+
27
+ $ bundle install
28
+
29
+ ## Writing Flows
30
+
31
+ ### Basic Terms
32
+
33
+ * _Flow_: a collection of a set of USSD responses that are sent to a MS in response to a USSD query. Often, a USSD _flow_ is the
34
+ same as as USSD _Application_
35
+ * _Mobile Subscriber_ (or just _MS_): This is a terminal device (usually a mobile phone) used to send and receive mobile messages.
36
+ * _Application_: A USSD Application which is most often just one flow, but can be a collection of flows working together to provide a service to a _mobile subscriber_.
37
+
38
+ ### Introduction
39
+
40
+ While programming using ussd-renderer-redux, Flows are collections of Nodes. Each Node has two blocks: a Request block that sends a USSD request to an MS and a Process block where the response received from an MS is analysed. The initial node is by convention named _index_.
41
+
42
+ A typical USSD request-response would follow this path:
43
+
44
+ Index Node -> Request -> Prompt for Input from MS -> Process -> Another Node ... (and so on)
45
+
46
+ Thus Flows traverse from Node to Node, and at each step, uses a Prompt to ask the MS for more Input. Flows end when Notify is used to tell the MS that the USSD Session is now over.
47
+
48
+ ### Writing your first flow
49
+
50
+ See Installation for Flow Developers first.
51
+
52
+ Flows are just Ruby classes with a module {Colloquy::FlowParser} mixed in. This module in addition to providing the class with some special statements (like _prompt_ and _notify_) also has some meta-programming magic to make writing flows simpler. If you've ever worked with [Adhearsion dialplans](http://adhearsion.com/examples), this will look similar, but it has some quirks of its own.
53
+
54
+ Before we start, if you'd like to just jump in, there are several examples available in the examples/ directory if you've cloned the Git repository. See {CalculatorFlow} for a jumpstart.
55
+
56
+ This is a simple flow:
57
+
58
+ class HelloWorldFlow
59
+ include Colloquy::FlowParser
60
+
61
+ index {
62
+ request {
63
+ prompt "Enter your name: "
64
+ }
65
+
66
+ process { |input|
67
+ notify "Hello #{input}!"
68
+ }
69
+ }
70
+ end
71
+
72
+ We begin a normal Ruby class definition, include the flow parser module and start writing the _index_ node by writing index and then opening up a curly braces pair. Nested within the index node, you have two blocks: a request block and a process block.
73
+
74
+ Remember: the request block always asks for input, and the process block always analyses it. This is a convention that you should stick to throughout Redux flows to ensure readable and idiomatic flows.
75
+
76
+ To run this flow:
77
+
78
+ * Save this as lib/hello\_world\_flow.rb
79
+ * Add a line to app/config/flows.yaml under _active_:
80
+
81
+ - hello_world
82
+
83
+ * Run this in the simulator:
84
+
85
+ $ bundle exec ussd-renderer -s app
86
+ Please enter flow name:
87
+ hello_world
88
+ Please enter msisdn:
89
+ 111
90
+ Please enter session_id:
91
+ 1212
92
+ Initial input (for direct flow):
93
+ > (press Enter)
94
+ Hello World
95
+ ---Flow complete---
96
+ --Going back to beginning of flow--
97
+ Initial input (for direct flow):
98
+ > quit
99
+ Bye!
100
+
101
+ Note: quit exits the simulator.
102
+
103
+ Congrats, you've written and tested your first flow!
104
+
105
+ ### Writing More Complex Flows
106
+
107
+ USSD Renderer Redux comes with a lot of helper methods that allow for complex USSD applications to be built. Here are some of its features:
108
+
109
+ * A Menu is one of the most common elements of an interactive USSD flow. This is what a simple menu looks like:
110
+
111
+ index {
112
+ request {
113
+ menu << :add << :subtract
114
+ }
115
+
116
+ process { |input|
117
+ notify "You selected #{menu.key(input)}"
118
+ }
119
+ }
120
+
121
+ which renders to:
122
+
123
+ 1. Add
124
+ 2. Subtract
125
+ Enter your choice:
126
+
127
+ Redux comes built in with a very capable menu that can paginate larger menus automatically, provide different prefixes and suffixes on each page, and automatically map user input to descriptive menu keys.
128
+
129
+ * A helper method called _url_ that is a wrapper around Colloquy::URLAgent. This is a robust library that calls HTTP URLs in an evented fashion and supports fallback URLs for a single service.
130
+
131
+ * Many other evented helpers, _redis_, _scribe_ and _mysql_ to access these servers and a _settings_ helper to read in configuration.
132
+
133
+ ### More Example Flows
134
+
135
+ Checkout the code and take a look at the examples/ directory. There are a lot more flows in there:
136
+
137
+ * active\_record\_flow: Connects to ActiveRecord. Configuration in config/mysql.yaml
138
+ * art\_of\_war\_flow: Run this flow to see how menu pagination works seamlessly.
139
+ * calculator\_flow.rb: A simple calculator in USSD.
140
+ * crossover\_flow.rb: This describes the syntax for switching between flows.
141
+ * database\_flow.rb: The raw evented mysql helper (without ActiveRecord). Configuration in config/mysql.yaml
142
+ * hangman\_flow.rb: A simple hangman game in USSD.
143
+ * metadata_flow.rb: Describes how to access request metadata (for e.g. parameters like mobile number location passed in from the stub) within the flow.
144
+ * pagination\_flow: A menu with a long prefix.
145
+ * pass\_flow: Describes the _pass_ special statement that is used mostly in direct entry flows.
146
+ * scribe\_flow: for the _scribe_ helper. Configuration in config/scribe.yaml
147
+ * settings\_flow: for the _settings_ helper. Configuration in config/settings.yaml
148
+ * url\_flow: for the url helper. Configuration in config/urls.yaml
149
+
150
+ ## Deployment Concepts
151
+
152
+ A USSD application running under the renderer typically has these components running end-to-end from mobile subscriber to the flow running inside the renderer:
153
+
154
+ Mobile Subscriber <--> Mobile Operator <--> USSD Gateway <--> Gateway Middleware (or Stub) <--> USSD Renderer <--> Flow
155
+
156
+ You can see then that the Renderer is just a small piece of the pie. To deploy USSD applications, you'll have to get connectivity to a USSD gateway that can send and receive USSD messages to and from mobile subscribers. This usually involves talking to a mobile network operator in your country to see if they can provide you access.
157
+
158
+ Depending on what kind of platform your mobile operator's USSD gateway is developed in, you will also have to write some sort of gateway middleware (some folks call this a 'stub') to connect the Renderer to the operator's USSD gateway. USSD gateways are usually proprietary solutions and they differ from gateway to gateway. As of now, the Renderer does not come with any default stubs, but these should be simple to write because the Renderer is flexible enough to speak any protocol and language. In the ideal scenario, you'll just use a stub that can send and process HTTP requests served by the Renderer Server.
159
+
160
+ What if you do not have connectivity to a gateway? Renderer provides a simulator that can simulate a mobile subscriber and allow you to run your flow.
data/TODO.md ADDED
@@ -0,0 +1,256 @@
1
+
2
+ ## TODO
3
+
4
+ * Documentation:
5
+ * Add YARD documentation for class-level flow constructs
6
+ * Add more documentation for flows
7
+ * BDD-ing a flow
8
+ * Make Renderer unicode aware
9
+ * Paginate menu correctly when unicode presence is detected
10
+ * Truncate Renderer#apply correctly
11
+ * When not in unicode mode, iconv down messages to ASCII
12
+ * Refactor flow_parser, it's grown too big and unwieldy
13
+ * Override input
14
+ * Use configuration gem for configuration
15
+ * Use syslog for logging
16
+ * Fix reloading flows
17
+ * Redis sessions:
18
+ * Additional full-stack testing
19
+ * Explore using alternatives to Marshal that preserve symbols versus strings
20
+ * Make all tests pass by defaulting to memory store in tests
21
+ * Investigate adding an :input option to switch so that a request block gets passed |input|
22
+ * Improve error messages of Renderer Server
23
+ * Complete test coverage of Renderer Server using Goliath testing (and Runner, if possible)
24
+ * Write performance specs so that we can measure regressions
25
+ * Renderer Server improvements
26
+ * Extensive logging throughout
27
+ * Optional full state logging, log everything to YYYYMMDD/HH/MM-MSISDN.log
28
+ * Replay from a full state log
29
+ * A i18n framework
30
+ * Pagination: support other pagination schemes (e.g. a. b. c. or I. II. III.)
31
+ * Pagination: implement an optional previous page.
32
+ * Pagination: refine changing prefix and suffix so that the changed prefixes/suffixes results in repagination of the menu
33
+ * Pagination: implement previous option on prompts
34
+ * Menu: add rewind and previous page options.
35
+ * Allow nested organization of messages in YAML files.
36
+
37
+ ## CHANGES
38
+
39
+ ### 20130115 (vishnu@mobme.in)
40
+ * A new parameter "accept" can be set to "text/plain" in the server to return only the plain text response instead of JSON.
41
+
42
+ ### 20120717 (binoy@mobme.in)
43
+ * Increased input parameter length from 20 to 160 characters
44
+ ### 20120605 (binoy@mobme.in)
45
+ * Flow name from url is now passed into flow objects during instantiation. The solves the switching and flow pool exhaustion issues that occur when flow path is not the same as the flow class
46
+ ### 20120604 (binoy@mobme.in)
47
+ * Bug fix to solve issue which was causing flow pool to get exhausted when flow path and flow class names didn't match
48
+ ### 20120314 (binoy@mobme.in)
49
+ * Minor bug fix in redis helper to enable redis connections to remote servers
50
+
51
+ ### 20120229 (binoy@mobme.in)
52
+ * Minor tweak to fit in more text in menu first page
53
+ * Previous option in menu can be disabled by setting the previous option text as an empty string
54
+
55
+ ### 20120226 (binoy@mobme.in)
56
+ * Added unicode message support
57
+
58
+ ### 20120203 (binoy@mobme.in)
59
+ * Added flow pooler to improve renderer performance. Each flow object now has a reference to a unique node object. This may solve concurrency issues.
60
+ * Minor performance tuning tweaks
61
+
62
+ ### 20120104 (vishnu@mobme.in)
63
+ * Bugfix: Scribe helper is now loaded dynamically
64
+
65
+ ### 20120102 (vishnu@mobme.in)
66
+ * Fixing a pretty serious bug in server.rb that resulted in shared state across Fibers. This might solve lots of unexplained behaviour.
67
+
68
+ ### 20120102 (binoy@mobme.in)
69
+ * Fixed menu issue occuring when menu input is a very large integer (greater than 2*30)
70
+
71
+ ### 20120101 (vishnu@mobme.in)
72
+ * Making ussd-renderer-redux Ruby 1.9.3 ready
73
+ * An attempt at better documentation using YARD
74
+
75
+ ### 20111214 (vishnu@mobme.in)
76
+ * Adding spec_helpers. Require:
77
+
78
+ require 'mobme/infrastructure/ussd\_renderer\_redux/spec\_helpers'
79
+
80
+ & you'll have a few methods available to you in your flow spec:
81
+ * stub\_mysql! to stub out MySQL properly.
82
+ * apply\_chain to apply lots of things to a flow at once and return every output
83
+ * state\_for(flow) to find the state (instead of flow.send(:state))
84
+
85
+ ### 20111214 (binoy@mobme.in)
86
+ * Fixed prompt pagination issue that was occuring when the message ended with a alphabet.
87
+
88
+ ### 20111116 (binoy@mobme.in)
89
+ * Fixed bug in settings helper. YAMLs that are not hashes can be parsed using the settings helper now.
90
+ * Fixed issue where sessions were not stored correctly while switching between flows.
91
+ * Session data stored in memory store is now 'marshalled', the same way as we do in redis store.
92
+ This means that the flow would error out if we try to store an 'unmarshallable' object in a session whatever the session store may be.
93
+ * Hack to remove the default proc that Goliath attaches to the url parameters hash. The default proc makes the flow state 'unmarshallable'
94
+
95
+ ### 20111111 (vishnu@mobme.in)
96
+ * Bugfix in menu: now correctly accounts for prefixes or suffixes that vary across pages.
97
+
98
+ Note: menu.prefix and menu.suffix blocks must not contain code with sideeffects
99
+ (i.e. these may be executed more times than necessary to generate the menu)
100
+ Use menu.before_page instead to guarantee an invocation before every page render.
101
+
102
+ ### 20111020 (vishnu@mobme.in)
103
+ * Message builder has a new syntax for string interpolation. (it's %{variable} instead of %%variable%%)
104
+ _ function remains the same: _([:example, {:user => "Vishnu"}]) but all strings in messages.yaml have to be rewritten!
105
+
106
+ Note: the old syntax is DEPRECATED and will be removed in 1.0!
107
+ * You can now organize the messages in YAML files hierarchically, see messages/active_record.yaml
108
+ Syntax for the _ function remains the same. Arguments are now split on the underscore character and
109
+ searched in the nested hash built from the YAML.
110
+
111
+ ### 20111019 (vishnu@mobme.in)
112
+ * Removed hardcoded version dependencies for em-synchrony and em-http-request
113
+
114
+ ### 20111018 (vishnu@mobme.in)
115
+ * Max USSD message length is now configurable in flows.yaml (maximum\_message_length) This is a renderer-wide setting.
116
+ * Fixing warnings with specs in the scribe and settings helper.
117
+
118
+ ### 20111018 (sreekanth@mobme.in)
119
+ * Settings helper. See examples/settings_flow.rb
120
+
121
+ ### 20111012 (sreekanth@mobme.in)
122
+ * Scribe helper. See examples/scribe_flow.rb
123
+
124
+ ### 20111012 (vishnu@mobme.in)
125
+ * Additional parameters passed in the server are available as headers[:metadata] in the flow.
126
+
127
+ ### 20111011 (vishnu@mobme.in)
128
+ * Fixing a bug whereby sometimes a menu rendered pages of a previous menu. Fixed in menu#reset! by setting pages to nil.
129
+ * The simulator does not reset the renderer in between runs. This is to better replicate what happens in production (session_id is incremented instead in between runs)
130
+
131
+ ### 20111004 (vishnu@mobme.in)
132
+ * Upgraded to latest eventmachine MASTER (1.0.0.beta.5 from github.com/vishnugopal/eventmachine)
133
+
134
+ ### 20111003 (vishnu@mobme.in)
135
+ * Suppress SEVERITIES warning in logger by checking for redefinition.
136
+ * BUGFIX: Menu is no longer frozen on switch!
137
+ * Menu is now reset completely on switch! (It still retains its state but is frozen on pass! or normal transition to the process block)
138
+
139
+ ### 20110929 (vishnu@mobme.in)
140
+ * CHANGED syntax of menu.prefix and menu.suffix to take a block instead. These are executed dynamically
141
+ on every page render to change the prefix and suffix selectively on each page by reading a new headers[:page]
142
+ variable.
143
+ * A new menu.before\_page block that can be used to execute code before each page render.
144
+
145
+ ### 20110906 (vishnu@mobme.in)
146
+ * switch :back support, including switching back to previous flows
147
+
148
+ ### 20110817 (vishnu@mobme.in)
149
+ * Moving notify, switch and pass to the flow parser. As a result, they can be called from the flow too.
150
+ * Fixing a bug with rendering multiple pages using a custom more.
151
+
152
+ ### 20110810 (binoy@mobme.in)
153
+ * Increased USSD message length from 140 to 160 characters.
154
+ * Corrected testcases for the message length change
155
+
156
+ ### 20110806 (vishnu@mobme.in)
157
+ * A slight change to flows.yaml to bring flow paths into the flow entry. Note: reloading flows is currently broken because
158
+ of earlier flows.yaml changes.
159
+
160
+ ### 20110804 (vishnu@mobme.in)
161
+ * An experimental session store in Redis, needs more tests, but the basic functionality works.
162
+ * Change config/flows.yaml session_store from memory to redis and add sessions and state entries to config/redis.yaml
163
+ * Tested by spawning two independent servers and hitting them with alternate requests
164
+ * -a address, -p port, -d for daemonize, -e env, -P pidfile are now handled by the runner and passed on to Goliath
165
+ * The logger is available at Colloquy.logger
166
+ * To notify consumers, Renderer now constructs a response object which responds to flow state
167
+ * When the flow state is :notify, upstreams should terminate session with the mobile subscriber.
168
+ * The server now responds with a hash of response and flow_state.
169
+ * The simulator now detects :notify and terminates & resets the flow.
170
+
171
+ ### 20110803 (vishnu@mobme.in)
172
+ * A first stab at performance testing: see spec/performance (needs much more work).
173
+ * Extracting _ (underscore) so that it works in the flow.
174
+ * Custom load paths & custom classes for flows: see examples/config/flows.yaml.
175
+
176
+ ### 20110802 (vishnu@mobme.in)
177
+ * Graceful error messages from the flow messages YAML (and backup from standard error messages) when something goes wrong.
178
+ * Renderer#apply now has a safety wrapper around it by default. This is called by both the server and the interactive tester.
179
+ * Call Renderer#apply! if you want exceptions to be raised.
180
+ * Interactive mode has been renamed to simulator and now started with -s.
181
+ * Also adds a "reset" command to the simulator to go back to the beginning of the flow.
182
+
183
+ ### 20110801 (vishnu@mobme.in)
184
+ * Pass in -i or --interactive to the ussd-renderer binary to start an interactive mode to test flows.
185
+ * A renderer-wide messages.yaml that can be used to set common messages (overridden by flow-specific messages).
186
+ * Database access refactored to use Mysql2::EM::Fiber.
187
+ * ActiveRecord support for the mysql helper (see examples/active\_record_flow.rb)
188
+
189
+ ### 20110731 (vishnu@mobme.in)
190
+ * Move menu_helper to within menu: menu.key(input)
191
+ * Menu pagination refactored to return symbols instead of strings.
192
+ * Menu.key now takes pages into account.
193
+ * Pagination is built into the flow parser and enabled automatically for long menus and prompts
194
+ * Customize the "more" prompt with the message symbol :more
195
+
196
+ ### 20110730 (vishnu@mobme.in)
197
+ * Extracting pagination out to be a common element
198
+ * Menu pagination
199
+ * Prompt pagination
200
+ * paginator#total\_pages, paginator#page_available?
201
+ * Specs for prompt and menu behavior under pagination
202
+
203
+ ### 20110729 (vishnu@mobme.in)
204
+ * A redis helper, use with: redis[:identifier].get/put, etc. from the flow
205
+ * MySQL helper changed, now use: mysql[:identifier].query and mysql[:identifier].escape
206
+ * Changes to URL Agent means that you can now use: url[:identifier].get for consistency
207
+ * The beginnings of robust logging (much more work needed)
208
+ * * Menu pagination
209
+ * Correctly paginate menu based on message limits
210
+ * Menu has prefix/suffix support
211
+
212
+ ### 20110728 (vishnu@mobme.in)
213
+ * Change request hash to headers so that it does not conflict with request block in the node
214
+ * A pass instruction to switch from request block to process. When passed, the process block receives the input instead. This is mainly for direct activation use cases where the request block receives an input directly from the USSD for the process block to take care of.
215
+ * Message handling, all messages are read from messages/flow_name.yaml
216
+ * Parameterized messages, pass in [:symbol, {:key => "value"}] to either prompt, menu or notify.
217
+ * Works with menu_key
218
+ * A render method for menu
219
+ * An _ (underscore) method for node as an alias to MessageBuilder.to_message
220
+
221
+ ### 20110726 (vishnu@mobme.in)
222
+ * mysql helper
223
+ * Databases in mysql.yaml
224
+ * mysql.query(:identifier, query)
225
+ * request hash is now available to the node which has :flow\_name, :msisdn, :session_id, :input
226
+ * menu_key is now a helper
227
+ * The request phase of the node must take |input| which is the initial input
228
+ * A URL helper library that tries one URL after another and records downtime
229
+ * URLs in urls.yaml
230
+ * url.call(:url_name, {:parameters})
231
+ * em-synchrony url calls
232
+
233
+ ### 20110724 (vishnu@mobme.in)
234
+ * The Renderer Server
235
+ * Loading and running a flow using EM:Synchrony and the Goliath framework
236
+ * Request takes MSISDN, Session ID, Input as parameter
237
+ * A generic Renderer Runner to run the Server under Goliath
238
+ * A bin/ussd-renderer executable
239
+ * Can now switch between nodes with an optional :flow parameter
240
+ * switch :node, :flow => :new_flow.
241
+ * Switching is completely transparent and session and state is still stored in the old flow.
242
+
243
+ ### 20110722 (vishnu@mobme.in)
244
+ * The Renderer component (that loads flows and messages) and manages sessions and state is 90%+ complete.
245
+ * method prepare! to be called at start
246
+ * method apply that takes flow\_name, msisdn, session_id and input as parameter and returns response
247
+ * reload messages and flows dynamically
248
+
249
+ ### 20110720 (vishnu@mobme.in)
250
+ * A flow parser that uses Ruby where appropriate
251
+ * init, request, process, and notify states for nodes
252
+ * notify function for a USSD termination
253
+ * switch function to switch to a different node
254
+ * Asterisk-like context syntax for nodes
255
+ * A simple node implementation with request and process halves
256
+ * Exceptions throughout
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
+
5
+ require 'colloquy'
6
+ require 'colloquy/server'
7
+ require 'colloquy/runner'
8
+
9
+ begin
10
+ Colloquy::Runner.run!(ARGV)
11
+ rescue Exception => e
12
+ p e
13
+ puts e.backtrace
14
+ end
@@ -0,0 +1,22 @@
1
+ active:
2
+ - url
3
+ - calculator
4
+ - art_of_war
5
+ - database
6
+ - active_record
7
+ - special/special_redis: RedisFlow
8
+ - pass
9
+ - metadata
10
+ - hangman
11
+ - prefix_menu
12
+ - crossover
13
+ - pagination
14
+
15
+ load_paths:
16
+ - "./flows"
17
+ - "/tmp"
18
+
19
+ session_store: memory
20
+ maximum_message_length: 160
21
+ maximum_unicode_length: 70
22
+ flow_pool_size: 10 #set higher value in production