Class: Train::Transports::Helpers::Azure::SubscriptionIdFileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/helpers/azure/subscription_id_file_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subscription_id, credentials) ⇒ SubscriptionIdFileParser

Returns a new instance of SubscriptionIdFileParser.



7
8
9
10
11
12
# File 'lib/train/transports/helpers/azure/subscription_id_file_parser.rb', line 7

def initialize(subscription_id, credentials)
  @subscription_id = subscription_id
  @credentials     = credentials

  validate!
end

Instance Attribute Details

#subscription_idObject (readonly)

Returns the value of attribute subscription_id.



5
6
7
# File 'lib/train/transports/helpers/azure/subscription_id_file_parser.rb', line 5

def subscription_id
  @subscription_id
end

Instance Method Details

#validate!Object



14
15
16
17
18
# File 'lib/train/transports/helpers/azure/subscription_id_file_parser.rb', line 14

def validate!
  if @credentials.sections.empty? || @credentials[subscription_id].empty?
    raise "No credentials found for subscription number #{subscription_id}"
  end
end