class Valuefirst::Config

Attributes

default_sender[RW]
password[RW]
url[RW]
username[RW]
version[RW]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/valuefirst/config.rb, line 5
def initialize(opts = {})
  @username = opts[:username]
  @password = opts[:password]
  @default_sender = opts[:default_sender]
  @url      = opts[:url] || "http://api.myvaluefirst.com/psms/servlet/psms.Eservice2"
  @version  = opts[:version] || '1.2'
end

Public Instance Methods

validate() click to toggle source
# File lib/valuefirst/config.rb, line 13
def validate
  errors = []
  errors << "Invalid username" if @username.nil? || @username.empty? 
  errors << "Invalid password" if @password.nil? || @password.empty?
  errors << "API version not supported" unless @version == '1.2'
  unless errors.empty?
    raise ArgumentError, "#{errors.join(', ')}"
  end
end