class Menthol::Profile

Attributes

providers[R]

Public Class Methods

configure(config_file_path) click to toggle source
# File lib/menthol/profile.rb, line 12
def self.configure(config_file_path)
  configuration = YAML.load(File.read(config_file_path))

  providers = configuration.map do |c|
    Menthol.const_get(c["provider"]).new(
      c["name"],
      c["username"],
      c["password"],
      c["accounts"]
    )
  end

  new(providers)
end
new(providers) click to toggle source
# File lib/menthol/profile.rb, line 6
def initialize(providers)
  @providers = providers
end

Public Instance Methods

amount() click to toggle source
# File lib/menthol/profile.rb, line 31
def amount
  @providers.map(&:amount).reduce(Money.new(0, "THB"), &:+)
end
sync_all!() click to toggle source
# File lib/menthol/profile.rb, line 27
def sync_all!
  @providers.each(&:sync!)
end