watson-client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/Gemfile.lock +20 -0
- data/LICENCE.txt +21 -0
- data/README.md +30 -3
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/watson/conversation.rb +6 -3
- data/test/watson/conversation.rb +0 -0
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 423c7226a5a9ddbc1953190c62862df443b872fa
|
4
|
+
data.tar.gz: '09acdb56d0c8d28dd438e8d3bf8f1fb71d61485b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3052a73b70db023a56888e0d912ac24b62c9bf4457ffa9663e6c4fbc09e1a4655f5a6b5814f4a2c156d7109cb70243fb39cd21ca2c22e5614c8063d51485fccb
|
7
|
+
data.tar.gz: 683569fbbe08b44bf42ff45154dfae562d56a02b5a8f8dfdefa2d199625a08d4d924c7a5f8adf8b79f76f550604b32afb2503cb886d7fc79f5ad326f151804f7
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
watson-client (0.1.3)
|
5
|
+
excon (~> 0.55.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
excon (0.55.0)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
excon (~> 0.55.0)
|
17
|
+
watson-client!
|
18
|
+
|
19
|
+
BUNDLED WITH
|
20
|
+
1.13.6
|
data/LICENCE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Carlos Torres
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,25 @@
|
|
1
|
-
#
|
2
|
-
API client for watson IPBM services
|
1
|
+
# Watson-client
|
3
2
|
|
4
|
-
# w-ruby
|
5
3
|
API client for watson IPBM services
|
6
4
|
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'watson-client'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install watson-client
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
7
23
|
### Conversation API
|
8
24
|
Initialize your own credentials for Conversation API
|
9
25
|
```ruby
|
@@ -78,3 +94,14 @@ until user_input == 'q' || user_input == 'exit'
|
|
78
94
|
end
|
79
95
|
|
80
96
|
```
|
97
|
+
|
98
|
+
## Contributing
|
99
|
+
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/katorres02/w-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
101
|
+
|
102
|
+
|
103
|
+
## License
|
104
|
+
|
105
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
106
|
+
|
107
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "watson"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/watson/conversation.rb
CHANGED
@@ -12,7 +12,7 @@ module Watson
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def send_message(message = '')
|
15
|
-
return if message.empty?
|
15
|
+
return if message.empty? || message.nil?
|
16
16
|
@message = message
|
17
17
|
params = { input: { text: @message }, alternate_intents: true }
|
18
18
|
params.merge!(@context) unless @context.nil?
|
@@ -30,8 +30,11 @@ module Watson
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def build_response(result)
|
33
|
-
{
|
34
|
-
|
33
|
+
{
|
34
|
+
source: 'conversation', intent: result['intents'][0]['intent'],
|
35
|
+
message: @message, tittle: @message, body: result['output']['text'],
|
36
|
+
context_id: result['context']['conversation_id']
|
37
|
+
}
|
35
38
|
end
|
36
39
|
|
37
40
|
def url
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watson-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Andres Torres Cruz
|
@@ -14,30 +14,30 @@ dependencies:
|
|
14
14
|
name: excon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.55.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.55.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: excon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.55.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.55.0
|
41
41
|
description: REST API client for IBM Watson™ services. Conversation, Retrieve & Rank,
|
42
42
|
Conversation enhanced services are available
|
43
43
|
email: carlosandrestorres28@gmail.com
|
@@ -45,11 +45,17 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
50
|
+
- LICENCE.txt
|
48
51
|
- README.md
|
52
|
+
- bin/console
|
53
|
+
- bin/setup
|
49
54
|
- lib/watson.rb
|
50
55
|
- lib/watson/conversation.rb
|
51
56
|
- lib/watson/conversation_enhanced.rb
|
52
57
|
- lib/watson/retrieve_and_rank.rb
|
58
|
+
- test/watson/conversation.rb
|
53
59
|
homepage: https://github.com/katorres02/w-ruby
|
54
60
|
licenses:
|
55
61
|
- MIT
|
@@ -70,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
76
|
version: '0'
|
71
77
|
requirements: []
|
72
78
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.5.2
|
74
80
|
signing_key:
|
75
81
|
specification_version: 4
|
76
82
|
summary: REST API client for IBM Watson™ services
|