Class: SMS::LgtClient

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

Instance Method Summary collapse

Methods included from ClientMethods

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

Instance Method Details

#deliver(to, msg) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/sms_client/client/lgt_client.rb', line 28

def deliver(to, msg)
  return false unless super

  page = @agent.get("http://cworld.ez-i.co.kr/mylgt2007/web2phone.asp")
  page = page.iframes.first.click
  page = page.form_with(:name =>"phone") do |form|
    form.message = msg
    form.aliasphone = from
    form.asRphone = to
    form.multiRphone = to
    form.sendcheck = "Y"
    form.price = "20"
    form.phonecount = "0"
    form.namezmoney = "0"
  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
24
25
26
# File 'lib/sms_client/client/lgt_client.rb', line 5

def (id, password)
  @agent.get("http://www.lgtelecom.com/index.jsp") do |page|
    result = page.form_with(:name => "frm_login") do |form|
      form. = id
      form. = password
    end.submit

    result = result.form_with(:name => "encForm").submit
  end

  page = @agent.get("http://www.lgtelecom.com/SmsLoginCmd.lgtservice")
  page = page.form_with(:name => "smsForm") do |form|
    form.action = "http://www.lgtelecom.com/jsp/mp/smsLogin.jsp"
  end.submit
  page = page.forms.first.submit
  page = @agent.get("http://cworld.ez-i.co.kr/mylgt2007/web2phone.asp")
  @remains = page.search(".mysms2_1 .accent").first.content.to_i
  super
rescue Exception => e
  SMS.log.debug e if SMS.log
  false
end