Method: TWSMS#initialize

Defined in:
lib/twsms.rb

#initialize(username, password) ⇒ TWSMS

Returns a new instance of TWSMS.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/twsms.rb', line 16

def initialize(username, password)
  @uname, @upwd = username, password
  # Before renamed, its name is: @send_options

  @send_options = {
    :type => "now",
    :popup => "",
    :mo => "Y".upcase,
    :vldtime => "86400",
    :modate => "",
    :dlvtime => "",
    :wapurl => "",
    :encoding => "big5"
  }
  
  @query_options = {
    :type => "now",
    :msgid => "",
    :monumber => "",
    :sdate => "",
    :edate => ""
  }
  
  # Before renamed, its name is: @@errors

  @@send_errors = {
    -1.to_s.to_sym => "Send failed",
    -2.to_s.to_sym => "Username or password is invalid",
    -3.to_s.to_sym => "Popup tag error",
    -4.to_s.to_sym => "Mo tag error",
    -5.to_s.to_sym => "Encoding tag error",
    -6.to_s.to_sym => "Mobile tag error",
    -7.to_s.to_sym => "Message tag error",
    -8.to_s.to_sym => "vldtime tag error",
    -9.to_s.to_sym => "dlvtime tag error",
    -10.to_s.to_sym => "You have no point",
    -11.to_s.to_sym => "Your account has been blocked",
    -12.to_s.to_sym => "Type tag error",
    -13.to_s.to_sym => "You can't send SMS message by dlvtime tag if you use wap push",
    -14.to_s.to_sym => "Source IP has no permission",
    -99.to_s.to_sym => "System error!! Please contact the administrator, thanks!!"
  }
  
  @@query_errors = {
    0.to_s.to_sym => "Message already been sent or reserving message has been deleted",
    -1.to_s.to_sym => "Could not find the message id or ",
    -2.to_s.to_sym => "Username or password is invalid",
    -3.to_s.to_sym => "The reserving message does send yet",
    -4.to_s.to_sym => "Type tag error",
    -5.to_s.to_sym => "The target mobile did not callback",
    -6.to_s.to_sym => "Failed on sent message to the operator",
    -7.to_s.to_sym => "No short code",
    -8.to_s.to_sym => "No return message",
    -9.to_s.to_sym => "sdate or edate setting error",
    -10.to_s.to_sym => "No record of ",
    -11.to_s.to_sym => "Your account has been blocked",
    -12.to_s.to_sym => "Your message maybe invalid",
  }
end