Class: VoiceRecognitionBing::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/voice_recognition_bing/service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ms_service=(value) ⇒ Object (writeonly)

Sets the attribute ms_service

Parameters:

  • value

    the value to set the attribute ms_service to.



4
5
6
# File 'lib/voice_recognition_bing/service.rb', line 4

def ms_service=(value)
  @ms_service = value
end

Class Method Details

.recognize(content, credentials) ⇒ Object



6
7
8
# File 'lib/voice_recognition_bing/service.rb', line 6

def self.recognize(content, credentials)
  new.recognize(content, credentials)
end

Instance Method Details

#recognize(content, credentials) ⇒ Object

Raises:



10
11
12
13
14
15
16
# File 'lib/voice_recognition_bing/service.rb', line 10

def recognize(content, credentials)
  raise InvalidCredentials unless credentials.valid?

  response = remote_service.recognize(content: content, token: credentials.token)

  parse_result(response)
end