Class: Totango::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/totango-api/account.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Account

Returns a new instance of Account.



4
5
6
7
# 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(s, *args) ⇒ Object

Raises:

  • (NoMethodError)


83
84
85
86
87
88
89
# 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

Instance Method Details

#account_nameObject



23
24
25
# File 'lib/totango-api/account.rb', line 23

def 
  @attributes["sdr_odn"]
end

#account_name=(name) ⇒ Object



26
27
28
# File 'lib/totango-api/account.rb', line 26

def (name)
  @attributes["sdr_odn"]=name
end

#attributesObject



79
80
81
# File 'lib/totango-api/account.rb', line 79

def attributes
  @attributes.delete_if {|k,v| v.nil? }
end

#contract_renewalObject



37
38
39
# File 'lib/totango-api/account.rb', line 37

def contract_renewal
  @attributes["sdr_o_Contract Renewal Date"]
end

#contract_renewal=(date) ⇒ Object



40
41
42
# File 'lib/totango-api/account.rb', line 40

def contract_renewal=(date)
  @attributes["sdr_o_Contract Renewal Date"] = to_xmlschema(date)
end

#contract_valueObject



44
45
46
# File 'lib/totango-api/account.rb', line 44

def contract_value
  @attributes["sdr_o_Contract Value"]
end

#contract_value=(n) ⇒ Object



47
48
49
# File 'lib/totango-api/account.rb', line 47

def contract_value=(n)
  @attributes["sdr_o_Contract value"] = n.to_i
end

#create_dateObject



30
31
32
# File 'lib/totango-api/account.rb', line 30

def create_date
  @attributes["sdr_o_Create Date"]
end

#create_date=(date) ⇒ Object



33
34
35
# File 'lib/totango-api/account.rb', line 33

def create_date=(date)
  @attributes["sdr_o_Create Date"] = to_xmlschema(date)
end

#idObject



9
10
11
# File 'lib/totango-api/account.rb', line 9

def id
  @attributes["sdr_o"]
end

#id=(id) ⇒ Object



12
13
14
# File 'lib/totango-api/account.rb', line 12

def id=(id)
  @attributes["sdr_o"] = id
end

#licensesObject



51
52
53
# File 'lib/totango-api/account.rb', line 51

def licenses
  @attributes["sdr_o_Licenses"]
end

#licenses=(n) ⇒ Object



54
55
56
# File 'lib/totango-api/account.rb', line 54

def licenses=(n)
  @attributes["sdr_o_Licenses"] = n.to_i
end

#ofidObject



16
17
18
# File 'lib/totango-api/account.rb', line 16

def ofid
  @attributes["sdr_ofid"]
end

#ofid=(ofid) ⇒ Object



19
20
21
# File 'lib/totango-api/account.rb', line 19

def ofid=(ofid)
  @attributes["sdr_ofid"]=ofid
end

#sales_managerObject



58
59
60
# File 'lib/totango-api/account.rb', line 58

def sales_manager
  @attributes["sdr_o_Sales Manager"]
end

#sales_manager=(s) ⇒ Object



61
62
63
# File 'lib/totango-api/account.rb', line 61

def sales_manager=(s)
  @attributes["sdr_o_Sales Manager"]=s
end

#statusObject



72
73
74
# File 'lib/totango-api/account.rb', line 72

def status
  @attributes["sdr_o_Status"]
end

#status=(s) ⇒ Object



75
76
77
# File 'lib/totango-api/account.rb', line 75

def status=(s)
  @attributes["sdr_o_Status"]=s
end

#success_managerObject



65
66
67
# File 'lib/totango-api/account.rb', line 65

def success_manager
  @attributes["sdr_o_Success Manager"]
end

#success_manager=(s) ⇒ Object



68
69
70
# File 'lib/totango-api/account.rb', line 68

def success_manager=(s)
  @attributes["sdr_o_Sucsess Manager"]=s
end