Class: SMS::XpeedClient

Inherits:
Object
  • Object
show all
Includes:
ClientMethods
Defined in:
lib/sms_client/client/xpeed_client.rb

Instance Method Summary collapse

Methods included from ClientMethods

#available?, #from, #from=, #initialize, #remains, #to_s

Instance Method Details

#deliver(to, msg) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sms_client/client/xpeed_client.rb', line 24

def deliver(to, msg)
  return false unless super
  
  page = @agent.get("http://imory10.xpeed.com/imory/sms/mobile/mobile2.php")
  page.encoding = "EUC-KR"
  page.form_with(:name => "phone_form") do |form|
    form.action = "http://imory10.xpeed.com/imory/sms/mobile/msg_send.php"
    form.msg = msg
    form.remainFreeStr=""
    form.msglen = ""
    form.rCount = "1"
    form.phone = from
    form.recv = to
    form.sendTime = "now"
    form.resvFlag = "N"
    form.sendCount = "1"
  end.submit
  
  true
end

#login(id, password) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sms_client/client/xpeed_client.rb', line 5

def (id, password)
  page = @agent.get("http://imory.xpeed.com/member.im?cmd=loginForm")
  page = page.form_with(:name => "loginForm") do |form|
    form.mbrId = id
    form.mbrPasswd = password
  end.submit

  page = page.forms.first.submit
  page = @agent.get("http://imory10.xpeed.com/imory/sms/mobile/mobile2.php")

  page.form_with(:name => "phone_form") do |form|
    @remains = form.remainFreeStr.split(":").last.to_i
  end
  super
rescue Exception => e
  SMS.log.debug e if SMS.log
  false
end