Skip to content

Commit

Permalink
[*] 1.2.1 - UTF-8 fixed for some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Gugic committed Sep 22, 2016
1 parent 0640293 commit 56f2f6a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ uer.delete('contacts') # will remove user entities for given session

#Changelog

* 1.2.1 - fixed UTF-8 in text-requests
* 1.2.0 - added configurable session_id and full userEntities support
* 1.1.4 - removed unused dependency and updated default API version
* 1.1.3 - fixed non-correctly serialized parameters in new contexts during query send process
Expand Down
2 changes: 1 addition & 1 deletion lib/api-ai-ruby/constants.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ApiAiRuby
class Constants
VERSION = '1.2.0'
VERSION = '1.2.1'
DEFAULT_BASE_URL = 'https://api.api.ai/v1/'
DEFAULT_API_VERSION = '20150910'
DEFAULT_CLIENT_LANG = 'en'
Expand Down
1 change: 1 addition & 0 deletions lib/api-ai-ruby/crud/user_entity_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class UserEntitiesRequest < ApiAiRuby::RequestQuery

def initialize(client, options = {})
super client, options
@headers['Content-Type'] = 'application/json; charset=UTF-8'
@crud_base_uri = client.api_base_url + 'userEntities'
@uri = @crud_base_uri
end
Expand Down
1 change: 1 addition & 0 deletions lib/api-ai-ruby/request/text_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class TextRequest < ApiAiRuby::RequestQuery
def initialize (client, options={})
options[:lang] = client.api_lang
super client, options
@headers['Content-Type'] = 'application/json; charset=UTF-8'
end
end
end
11 changes: 7 additions & 4 deletions spec/api-ai-ruby/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
expect(response[:result][:action]).to eq 'greeting'
end

it 'should correct work with utf-8 entities' do
response = @client.text_request '你好'
expect(response[:result][:resolvedQuery]).to eq '你好'
end
it 'should use input contexts' do
response = @client.text_request 'Hello', :resetContexts => true
expect(response[:result][:action]).to eq 'greeting'
Expand All @@ -36,7 +40,9 @@
end

it 'should send voiceData to API' do
expect(@client.voice_request(File.new(fixture_path + '/hello.wav'))[:result][:resolvedQuery]).to eq 'hello'
# expect(@client.voice_request(File.new(fixture_path + '/hello.wav'))[:result][:resolvedQuery]).to eq 'hello'
# asr was disabled for non-premium users
expect {@client.voice_request(File.new(fixture_path + '/hello.wav'))}.to raise_error(ApiAiRuby::RequestError)
end

it 'should correctly set contexts with parameters' do
Expand Down Expand Up @@ -98,8 +104,5 @@
@uer.delete('dwarfs')
expect{@uer.retrieve('dwarfs')}.to raise_error(ApiAiRuby::RequestError)
end

end


end

0 comments on commit 56f2f6a

Please sign in to comment.