Class: SMS::ParanClient

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

Instance Method Summary collapse

Methods included from ClientMethods

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

Instance Method Details

#deliver(to, msg) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sms_client/client/paran_client.rb', line 25

def deliver(to, msg)
  return false unless super

  page = @agent.get("http://mailsms.paran.com/send.html")
  page = page.form_with(:name => "smsForm") do |form|
    form.call = to
    form.phoneNum = from
    form.msg = msg
  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
23
# File 'lib/sms_client/client/paran_client.rb', line 5

def (id, password)      
  id, domain = id.split("@")
  page = @agent.get("http://www.paran.com")
  page = page.form_with(:name => "fmLogin") do |form|
    form.action = "http://main.paran.com/mainAction.do?method=paranMainLogin"
    form.wbUserid = id
    form.wbPasswd = password
    form.wbDomain = domain        
  end.click_button
  page = @agent.get("http://main.paran.com/paran/login_proc.jsp")
  page = @agent.get("http://mailsms.paran.com/")
  if page.search("#smsinfo a").first.content =~ /(\d+).*/
    @remains = $1.to_i
  end
  super
rescue Exception => e
  SMS.log.debug e if SMS.log
  false
end