waysms 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/waysms.rb +38 -0
  3. metadata +45 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cbfc7b05912a33df8c4f169e0c189ba8e22a3bdb
4
+ data.tar.gz: 29c91dd8638654769b70e8a8ea8d62275b539b0d
5
+ SHA512:
6
+ metadata.gz: ae67c2ad213468f739dc3f483c8597f72ed4a9f2bc9eabe165d9620fd8d3d0383fcdb88650c30f23fed50e45405acd0aaaf61b4fdbe2d2f386a8ad50849cd9cf
7
+ data.tar.gz: 427500d2e958a5ca1f2f40d2efae879fc758c63b71b17871cc549f70d34d8913d159590273527a001e97df326db897ed3c367d1174cefed10115c5f03b87d632
@@ -0,0 +1,38 @@
1
+ require "rubygems"
2
+ require "mechanize"
3
+
4
+ module WaySms
5
+ class SmsSender
6
+ def initialize(user_phone, password)
7
+ @sender = user_phone
8
+ @password = password
9
+ end
10
+
11
+ def send(recipient, message)
12
+ agent = Mechanize.new
13
+ main_page = agent.get("http://www.way2sms.com")
14
+ dummy_site = main_page.form("dummy").action
15
+ page = agent.get(dummy_site + "content/index.html")
16
+
17
+ login_form = page.form("lgnFrm")
18
+ login_form.username = @sender
19
+ login_form.password = @password
20
+ page = agent.submit(login_form)
21
+
22
+ token_form = page.form("ebFrm")
23
+ token_id = token_form["Token"]
24
+
25
+ page = agent.get dummy_site + "sendSMS?Token=" + token_id
26
+
27
+ page.forms.any? { |form| form.name == "smsFrm" }
28
+
29
+ compose_form = page.form("smsFrm")
30
+ compose_form.field_with(:name => "mobile").value = recipient
31
+ compose_form["message"] = message
32
+ compose_form.action = "/smstoss.action?Token=" + token_id
33
+ button = compose_form.button_with(:name => "Send")
34
+ page = agent.submit(compose_form, button)
35
+ puts "Message Send successfully"
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: waysms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Senthil Kumar Bhaskaran
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple, way2sms application that enables you send message through Way2sms
14
+ email:
15
+ - senthil.jruby@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/waysms.rb
21
+ homepage: http://itssenthiljruby.herokuapp.com
22
+ licenses:
23
+ - Free
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.3
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Unoffical Way2sms Ruby application
45
+ test_files: []