RecastAI 1.0.1 → 1.0.2
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -15
- data/lib/recastai/client.rb +4 -4
- data/lib/recastai/errors.rb +1 -8
- data/lib/recastai/utils.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd00fcd2dad601053a8585da753577bc188f3f9
|
4
|
+
data.tar.gz: 368ba31c7546a30b1cf1ec4b760b8eb990d9bbd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fb22be21192ea61ad0af2ff28ada4af1f2b1e098a13c2048cd03ab5c29781417cdd0376c234c34da11f994a67f5101e45cb26189141b89719b30938c723d609
|
7
|
+
data.tar.gz: d16ff53ae6e8085c88e20b63234dbb57ec30712f8c82769f42a542e78ce5a2609c6e8b80a009b8aada84f310b627c4230aafcfe7b1ba193af91df01687c0ca44
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
RecastAI (1.0.
|
4
|
+
RecastAI (1.0.1)
|
5
5
|
httmultiparty (~> 0.3)
|
6
6
|
httparty (~> 0.13)
|
7
7
|
|
@@ -57,7 +57,7 @@ DEPENDENCIES
|
|
57
57
|
RecastAI!
|
58
58
|
awesome_print (~> 1.6)
|
59
59
|
rspec (~> 3.4)
|
60
|
-
simplecov
|
60
|
+
simplecov (~> 0.11)
|
61
61
|
webmock (~> 1.24)
|
62
62
|
|
63
63
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -46,21 +46,11 @@ gem install RecastAI-*.gem
|
|
46
46
|
### Gem
|
47
47
|
|
48
48
|
```ruby
|
49
|
-
require '
|
49
|
+
require 'recastai'
|
50
50
|
|
51
51
|
client = RecastAI::Client.new(YOUR_TOKEN)
|
52
52
|
response = client.text_request(YOUR_TEXT)
|
53
|
-
|
54
|
-
if response.intent == YOUR_EXPECTED_INTENT
|
55
|
-
# Do your code...
|
56
|
-
end
|
57
|
-
```
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
require 'RecastAI'
|
61
|
-
|
62
|
-
client = RecastAI::Client.new(YOUR_TOKEN)
|
63
|
-
response = client.file_request(File.new(File.join(File.dirname(__FILE__), YOUR_FILE)))
|
53
|
+
#response = client.file_request(File.new(File.join(File.dirname(__FILE__), YOUR_FILE)))
|
64
54
|
|
65
55
|
if response.intent == YOUR_EXPECTED_INTENT
|
66
56
|
# Do your code...
|
@@ -157,10 +147,9 @@ In addition to this method, more attributes are generated depending of the natur
|
|
157
147
|
|
158
148
|
### RecastAI::RecastError
|
159
149
|
|
160
|
-
The Recast.AI Error is thrown when receiving an non-200 response from Recast.AI
|
150
|
+
The Recast.AI Error is thrown when receiving an non-200 response from Recast.AI.
|
161
151
|
|
162
|
-
|
163
|
-
* code(\*) *Returns the error code*
|
152
|
+
As it inherits from ::Exception, it implements the default expection methods.
|
164
153
|
|
165
154
|
## More
|
166
155
|
|
data/lib/recastai/client.rb
CHANGED
@@ -18,13 +18,13 @@ module RecastAI
|
|
18
18
|
# - RecastError
|
19
19
|
def text_request(text, options = {})
|
20
20
|
token = options[:token] || @token
|
21
|
-
raise(RecastError.new('Token is missing'
|
21
|
+
raise(RecastError.new('Token is missing')) if token.nil?
|
22
22
|
|
23
23
|
response = HTTParty.post(Utils::API_ENDPOINT,
|
24
24
|
body: { 'text' => text },
|
25
25
|
headers: { 'Authorization' => "Token #{token}" }
|
26
26
|
)
|
27
|
-
raise(RecastError.new(response.message
|
27
|
+
raise(RecastError.new(response.message)) if response.code != 200
|
28
28
|
|
29
29
|
Response.new(response.body)
|
30
30
|
end
|
@@ -41,13 +41,13 @@ module RecastAI
|
|
41
41
|
# - RecastError
|
42
42
|
def file_request(file, options = {})
|
43
43
|
token = options[:token] || @token
|
44
|
-
raise(RecastError.new('Token is missing'
|
44
|
+
raise(RecastError.new('Token is missing')) if token.nil?
|
45
45
|
|
46
46
|
response = HTTMultiParty.post(Utils::API_ENDPOINT,
|
47
47
|
body: { 'voice' => File.new(file) },
|
48
48
|
headers: { 'Authorization' => "Token #{token}" }
|
49
49
|
)
|
50
|
-
raise(RecastError.new(response.message
|
50
|
+
raise(RecastError.new(response.message)) if response.code != 200
|
51
51
|
|
52
52
|
Response.new(response.body)
|
53
53
|
end
|
data/lib/recastai/errors.rb
CHANGED
data/lib/recastai/utils.rb
CHANGED