way2sms 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.
- checksums.yaml +7 -0
- data/lib/way2sms.rb +33 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 14f6e082117a7af1fb47f499770bd71d5be9077f
|
4
|
+
data.tar.gz: 2342532de7d3fc914cf3766b1912f5cfb36fa517
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bcf641868d21b4f273ab0604c62a6236b1bd7cb0de0845308f945975ceed88423bcf58bf7ea58699740c75fd4160ee2afbd2d684fdff572de3f8e8098ea8e32
|
7
|
+
data.tar.gz: 3760bc6ce3237715a1e0ebc5a26dd37956c84c7de57e90b20b603b1f9257ee235cc8bd735fd56f130172aec82d6bb449ac4e6185caa03331a54bd364a9e62fbe
|
data/lib/way2sms.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'cgi'
|
3
|
+
|
4
|
+
class Way2sms
|
5
|
+
def initialize(uname, pwd)
|
6
|
+
puts "way2sms gem initialized"
|
7
|
+
login_url = 'http://site25.way2sms.com/Login1.action'
|
8
|
+
|
9
|
+
params = "username=" + uname + "&password=" + pwd
|
10
|
+
uri = URI.parse(login_url)
|
11
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
12
|
+
response = http.post(uri.request_uri, params)
|
13
|
+
@cookie = response['Set-Cookie'].split(';').first
|
14
|
+
end
|
15
|
+
|
16
|
+
def send_sms(to, message)
|
17
|
+
cookie = @cookie
|
18
|
+
puts cookie
|
19
|
+
token = cookie.split('~').last
|
20
|
+
|
21
|
+
sms_url = "http://site25.way2sms.com/smstoss.action"
|
22
|
+
ref = "http://site25.way2sms.com/sendSMS?Token=" + token
|
23
|
+
|
24
|
+
uri = URI.parse(sms_url)
|
25
|
+
mess = "ssaction=ss&Token=" + token + "&mobile=" + to.to_s + "&message=" + CGI.escape(message)
|
26
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
27
|
+
ct = "application/x-www-form-urlencoded"
|
28
|
+
ua = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"
|
29
|
+
head = {"Cookie" => cookie, "Referer" => ref, "Content-Type" => ct, "User-Agent" => ua}
|
30
|
+
http.post(uri.request_uri, mess, head)
|
31
|
+
puts "SMS sent succesfully"
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: way2sms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nanda Kumar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple way to send sms using way2sms account
|
14
|
+
email: nandaceg007@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/way2sms.rb
|
20
|
+
homepage: http://rubygems.org/gems/way2sms
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Send SMS across India !
|
44
|
+
test_files: []
|