Class: MatterhornWhymper::Configuration

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

Overview

MatterhornWhymper::Configuration ===

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

——————————————————————————— methodes —



67
68
69
# File 'lib/matterhorn_whymper.rb', line 67

def initialize
  @mhw_config = {}
end

Instance Method Details

#add_api(options, mh_i = 'default') ⇒ Object



79
80
81
# File 'lib/matterhorn_whymper.rb', line 79

def add_api(options, mh_i = 'default')
  @mhw_config[mh_i.to_sym][:api] = validate_options(options)
end

#add_endpoint(options, mh_i = 'default') ⇒ Object



75
76
77
# File 'lib/matterhorn_whymper.rb', line 75

def add_endpoint(options, mh_i = 'default')
  @mhw_config[mh_i.to_sym][:endpoint] = validate_options(options)
end

#add_matterhorn_instance(name = 'default') ⇒ Object



71
72
73
# File 'lib/matterhorn_whymper.rb', line 71

def add_matterhorn_instance(name = 'default')
  @mhw_config[name.to_sym] = {}
end

#api(mh_i = :default) ⇒ Object



94
95
96
# File 'lib/matterhorn_whymper.rb', line 94

def api(mh_i = :default)
  @mhw_config[mh_i][:api]
end

#endpoint(mh_i = :default) ⇒ Object



90
91
92
# File 'lib/matterhorn_whymper.rb', line 90

def endpoint(mh_i = :default)
  @mhw_config[mh_i][:endpoint]
end

#set_default_matterhorn_instance(mh_i) ⇒ Object



83
84
85
86
87
# File 'lib/matterhorn_whymper.rb', line 83

def set_default_matterhorn_instance(mh_i)
  unless @mhw_config[mh_i.to_sym].nil?
    @mhw_config[:default] = @mhw_config[mh_i.to_sym]
  end
end