Class: YSM::Config

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

Constant Summary collapse

HeaderKeys =
[:username, :password, :license, :masterAccountID, :accountID]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



13
14
15
16
17
18
19
20
21
22
# File 'lib/ysm4r/client.rb', line 13

def initialize(options={})
  @sandbox = false
  IO.foreach(filename) do |line|
	next if line =~ /^#/
    name, value = line.split('=')
    value = (options[name] || value.strip)
    instance_variable_set(atsym(name), value)
  end
  @sandbox = ['True', 'true', '1'].include?(@sandbox.strip)
end

Instance Attribute Details

#sandboxObject (readonly)

Returns the value of attribute sandbox.



11
12
13
# File 'lib/ysm4r/client.rb', line 11

def sandbox
  @sandbox
end

Instance Method Details

#makeHeadersObject



24
25
26
27
28
29
# File 'lib/ysm4r/client.rb', line 24

def makeHeaders
  HeaderKeys.map do |key|
    Service::HeaderHandler.new(
      key.to_s, instance_variable_get(atsym(key)))
  end
end