RecastAI 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b9ee47c0d5c8ac19e66cfbd069917110ea911ce
4
- data.tar.gz: 5b27cf60f513f98ff8fb7eb2ee6fb45da611b49f
3
+ metadata.gz: 5bd00fcd2dad601053a8585da753577bc188f3f9
4
+ data.tar.gz: 368ba31c7546a30b1cf1ec4b760b8eb990d9bbd0
5
5
  SHA512:
6
- metadata.gz: 021bf33ec47a98ad8fa7422705a0f568252862a8eac53f41a05a501dea9a15cbab4c497e611b1af4c6777ecb50caeacb19741baad5f2272c3aea3322e47f0be1
7
- data.tar.gz: 39d3f16649f4e226f9f5d443641d5758f46b75d5c3b04b2eb33d81f5ba40e5f2116d61e7cdfc22aa16f28892702f14e010144121e0333f54f76635ba2ff4a5fe
6
+ metadata.gz: 6fb22be21192ea61ad0af2ff28ada4af1f2b1e098a13c2048cd03ab5c29781417cdd0376c234c34da11f994a67f5101e45cb26189141b89719b30938c723d609
7
+ data.tar.gz: d16ff53ae6e8085c88e20b63234dbb57ec30712f8c82769f42a542e78ce5a2609c6e8b80a009b8aada84f310b627c4230aafcfe7b1ba193af91df01687c0ca44
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- RecastAI (1.0.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 'RecastAI'
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, it implements the following methods:
150
+ The Recast.AI Error is thrown when receiving an non-200 response from Recast.AI.
161
151
 
162
- * message(\*) *Returns the message of the error*
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
 
@@ -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', 400)) if token.nil?
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, response.code)) if response.code != 200
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', 400)) if token.nil?
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, response.code)) if response.code != 200
50
+ raise(RecastError.new(response.message)) if response.code != 200
51
51
 
52
52
  Response.new(response.body)
53
53
  end
@@ -1,11 +1,4 @@
1
1
  module RecastAI
2
- class RecastError < StandardError
3
- attr_reader :message
4
- attr_reader :code
5
-
6
- def initialize(message, code)
7
- @message = message
8
- @code = code
9
- end
2
+ class RecastError < Exception
10
3
  end
11
4
  end
@@ -3,7 +3,7 @@ module RecastAI
3
3
  # Versioning
4
4
  MAJOR = '1'.freeze
5
5
  MINOR = '0'.freeze
6
- MICRO = '1'.freeze
6
+ MICRO = '2'.freeze
7
7
  VERSION = "#{MAJOR}.#{MINOR}.#{MICRO}".freeze
8
8
 
9
9
  # Endpoints
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RecastAI
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Renvoisé