class Totango::Account

Public Class Methods

new(args = {}) click to toggle source
# File lib/totango-api/account.rb, line 4
def initialize(args = {})
  @attributes = Hash.new(nil)
  args.each {|k,v| self.send("#{k}=".to_sym,v)}
end

Public Instance Methods

account_name() click to toggle source
# File lib/totango-api/account.rb, line 23
def account_name
  @attributes["sdr_odn"]
end
account_name=(name) click to toggle source
# File lib/totango-api/account.rb, line 26
def account_name=(name)
  @attributes["sdr_odn"]=name
end
attributes() click to toggle source
# File lib/totango-api/account.rb, line 79
def attributes
  @attributes.delete_if {|k,v| v.nil? }
end
contract_renewal() click to toggle source
# File lib/totango-api/account.rb, line 37
def contract_renewal
  @attributes["sdr_o_Contract Renewal Date"]
end
contract_renewal=(date) click to toggle source
# File lib/totango-api/account.rb, line 40
def contract_renewal=(date)
  @attributes["sdr_o_Contract Renewal Date"] = to_xmlschema(date)
end
contract_value() click to toggle source
# File lib/totango-api/account.rb, line 44
def contract_value
  @attributes["sdr_o_Contract Value"]
end
contract_value=(n) click to toggle source
# File lib/totango-api/account.rb, line 47
def contract_value=(n)
  @attributes["sdr_o_Contract value"] = n.to_i
end
create_date() click to toggle source
# File lib/totango-api/account.rb, line 30
def create_date
  @attributes["sdr_o_Create Date"]
end
create_date=(date) click to toggle source
# File lib/totango-api/account.rb, line 33
def create_date=(date)
  @attributes["sdr_o_Create Date"] = to_xmlschema(date)
end
id() click to toggle source
# File lib/totango-api/account.rb, line 9
def id
  @attributes["sdr_o"]
end
id=(id) click to toggle source
# File lib/totango-api/account.rb, line 12
def id=(id)
  @attributes["sdr_o"] = id
end
licenses() click to toggle source
# File lib/totango-api/account.rb, line 51
def licenses
  @attributes["sdr_o_Licenses"]
end
licenses=(n) click to toggle source
# File lib/totango-api/account.rb, line 54
def licenses=(n)
  @attributes["sdr_o_Licenses"] = n.to_i
end
method_missing(s,*args) click to toggle source
# File lib/totango-api/account.rb, line 83
def method_missing(s,*args)
  m=s.to_s.sub(/=$/,"")
  attr_name = "sdr_o.#{m}"
  return @attributes[attr_name] = "#{args.join(" ")}" if args.length > 0
  raise NoMethodError, "#{s.to_s} for #{self.class}" unless @attributes[attr_name]
  return @attributes[attr_name]
end
ofid() click to toggle source
# File lib/totango-api/account.rb, line 16
def ofid
  @attributes["sdr_ofid"]
end
ofid=(ofid) click to toggle source
# File lib/totango-api/account.rb, line 19
def ofid=(ofid)
  @attributes["sdr_ofid"]=ofid
end
sales_manager() click to toggle source
# File lib/totango-api/account.rb, line 58
def sales_manager
  @attributes["sdr_o_Sales Manager"]
end
sales_manager=(s) click to toggle source
# File lib/totango-api/account.rb, line 61
def sales_manager=(s)
  @attributes["sdr_o_Sales Manager"]=s
end
status() click to toggle source
# File lib/totango-api/account.rb, line 72
def status
  @attributes["sdr_o_Status"]
end
status=(s) click to toggle source
# File lib/totango-api/account.rb, line 75
def status=(s)
  @attributes["sdr_o_Status"]=s
end
success_manager() click to toggle source
# File lib/totango-api/account.rb, line 65
def success_manager
  @attributes["sdr_o_Success Manager"]
end
success_manager=(s) click to toggle source
# File lib/totango-api/account.rb, line 68
def success_manager=(s)
  @attributes["sdr_o_Sucsess Manager"]=s
end

Private Instance Methods

to_xmlschema(date) click to toggle source
# File lib/totango-api/account.rb, line 93
def to_xmlschema(date)
  xml_date = case date.class.to_s
  when String
    DateTime.parse(date)
  when DateTime
    date
  when Time
    date.to_datetime
  when Date
    date.to_datetime
  end

  return xml_date.xmlschema
end