wit 3.3.0 → 3.3.1

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +5 -0
  3. data/README.md +3 -3
  4. data/lib/wit.rb +3 -1
  5. data/wit.gemspec +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 329b154a407970ed82314b1e600bab97cccb770d
4
- data.tar.gz: 92c1f766cdf3de796044e2861cb62816970574ba
3
+ metadata.gz: fd594fc892e82bfd4d1a23bff6eb062a3b31a117
4
+ data.tar.gz: a385c71e0165ab8ca866effc5e099fbe48547834
5
5
  SHA512:
6
- metadata.gz: a623fcbc955b0c9d82bdf727bf8219b6087bd44bf696720dbce8cf767803f58d790d92994995901b60c447800a5a270de3edcaf0e34ef3b5ec7b955c0b69f1cb
7
- data.tar.gz: 802f6789388f95542d5f3f84a186e2d606ae415051977d67adce303b3d4a41b71477681fb128023b446fcceef2af73afddc68a2f32121f635960a8ce6eff457d
6
+ metadata.gz: 059661c6167529bc21f5700f7a93db866629cd20bb103b479b625f31982e84a3d97995990eaa27e6ebaf1596aced8df7c85cc5b4126f1a23da1e8446c55eca6d
7
+ data.tar.gz: e934ef82f3b4178b5fe36d681708e0a40a7df88695b5441b6df777abe103c0d9d51f06b5d4459fc9505372667c00c97f0a101dd43dcf7fc77cbe9d905727f91c
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v3.3.1
2
+
3
+ - fixed recursive call when running actions
4
+ - throws an exception if context passed is not a Hash
5
+
1
6
  ## v3.3
2
7
 
3
8
  Unifying action parameters
data/README.md CHANGED
@@ -42,14 +42,14 @@ You need to provide at least an implementation for the special actions `:say`, `
42
42
  A minimal `actions` `Hash` looks like this:
43
43
  ```ruby
44
44
  actions = {
45
- :say => -> (session_id, msg) {
45
+ :say => -> (session_id, context, msg) {
46
46
  p msg
47
47
  },
48
48
  :merge => -> (session_id, context, entities, msg) {
49
49
  return context
50
50
  },
51
- :error => -> (session_id, context) {
52
- p 'Oops I don\'t know what to do.'
51
+ :error => -> (session_id, context, error) {
52
+ p error.message
53
53
  },
54
54
  }
55
55
  ```
data/lib/wit.rb CHANGED
@@ -72,6 +72,7 @@ class Wit
72
72
  end
73
73
 
74
74
  def converse(session_id, msg, context={})
75
+ raise WitException.new 'context should be a Hash' unless context.is_a? Hash
75
76
  params = {}
76
77
  params[:q] = msg unless msg.nil?
77
78
  params[:session_id] = session_id
@@ -116,10 +117,11 @@ class Wit
116
117
  else
117
118
  raise WitException.new "unknown type: #{type}"
118
119
  end
119
- return run_actions session_id, nil, context, max_steps - 1
120
+ return run_actions_ session_id, nil, context, max_steps - 1, user_message
120
121
  end
121
122
 
122
123
  def run_actions(session_id, message, context={}, max_steps=DEFAULT_MAX_STEPS)
124
+ raise WitException.new 'context should be a Hash' unless context.is_a? Hash
123
125
  return run_actions_ session_id, message, context, max_steps, message
124
126
  end
125
127
 
data/wit.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wit'
3
- s.version = '3.3.0'
3
+ s.version = '3.3.1'
4
4
  s.date = Date.today.to_s
5
5
  s.summary = 'Ruby SDK for Wit.ai'
6
6
  s.description = 'Ruby SDK for Wit.ai'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Wit Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby SDK for Wit.ai
14
14
  email: help@wit.ai