class Train::Transports::Helpers::Azure::SubscriptionNumberFileParser

Public Class Methods

new(index, credentials) click to toggle source
# File lib/train/transports/helpers/azure/subscription_number_file_parser.rb, line 5
def initialize(index, credentials)
  @index       = index
  @credentials = credentials

  validate!
end

Public Instance Methods

subscription_id() click to toggle source
# File lib/train/transports/helpers/azure/subscription_number_file_parser.rb, line 22
def subscription_id
  @subscription_id ||= @credentials.sections[@index - 1]
end
validate!() click to toggle source
# File lib/train/transports/helpers/azure/subscription_number_file_parser.rb, line 12
def validate!
  if @index == 0
    raise "Index must be greater than 0."
  end

  if @index > @credentials.sections.length
    raise "Your credentials file only contains #{@credentials.sections.length} subscriptions. You specified number #{@index}."
  end
end