Class: VoiceRecognitionBing::Authorization

Inherits:
Object
  • Object
show all
Defined in:
lib/voice_recognition_bing/authorization.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.



8
9
10
# File 'lib/voice_recognition_bing/authorization.rb', line 8

def ms_service=(value)
  @ms_service = value
end

Class Method Details

.credentialsObject



9
10
11
# File 'lib/voice_recognition_bing/authorization.rb', line 9

def self.credentials
  new.credentials
end

Instance Method Details

#credentialsObject



13
14
15
16
17
18
19
# File 'lib/voice_recognition_bing/authorization.rb', line 13

def credentials
  return NullCredentials.new unless valid_params

  response = remote_service.authenticate(subscription_key: VoiceRecognitionBing.configuration.subscription_key)

  Credentials.new(extract_token(response))
end