class MsRestAzure::TopicCredentials

Class that provides access to authentication token.

Attributes

topic_key[R]

@return [String] the topic key

Public Class Methods

new(topic_key) click to toggle source

Creates and initialize new instance of the TopicCredentials class. @param topic_key [String] topic key

# File lib/ms_rest_azure/credentials/topic_credentials.rb, line 21
def initialize(topic_key)
  fail ArgumentError, 'Topic key cannot be nil' if topic_key.nil?
  fail ArgumentError, 'Topic key must be of type string' if topic_key.class.to_s != 'String'
  @topic_key = topic_key
end

Public Instance Methods

sign_request(request) click to toggle source
Calls superclass method
# File lib/ms_rest_azure/credentials/topic_credentials.rb, line 27
def sign_request(request)
  super(request)

  if (request.respond_to?(:request_headers))
    request.request_headers['aeg-sas-key'] = @topic_key
  elsif request.respond_to?(:headers)
    request.headers['aeg-sas-key'] = @topic_key
  else
    fail ArgumentError, 'Incorrect request object was provided'
  end
end