chagol 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +4 -0
- data/README.md +24 -0
- data/Rakefile +2 -0
- data/chagol.gemspec +17 -0
- data/lib/chagol.rb +29 -0
- data/lib/chagol/version.rb +3 -0
- metadata +53 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Chagol
|
2
|
+
|
3
|
+
Chagol is a ruby gem that you can use to send text messages to any
|
4
|
+
mobile phone in India using a service provider like way2sms or 160by2.
|
5
|
+
It can be used from the command line as well as from other ruby scripts
|
6
|
+
and applications.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
$ gem install chagol
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
This will be updated once I come up with a design for the command line
|
15
|
+
script.
|
16
|
+
|
17
|
+
## Contributing
|
18
|
+
|
19
|
+
1. Fork it
|
20
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
21
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
22
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
23
|
+
5. Create new Pull Request
|
24
|
+
6. Or suggest features and improvements
|
data/Rakefile
ADDED
data/chagol.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/chagol/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Nikhil Bhardwaj"]
|
6
|
+
gem.email = ["root@NikhilBhardwaj.in"]
|
7
|
+
gem.description = %q{Chagol can send messages to any Indian mobile no}
|
8
|
+
gem.summary = %q{It can be used as a standalone command line tool or with other ruby libraries.}
|
9
|
+
gem.homepage = "https://github.com/nikhilbhardwaj/chagol"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "chagol"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Chagol::VERSION
|
17
|
+
end
|
data/lib/chagol.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "chagol/version"
|
2
|
+
require "net/http"
|
3
|
+
|
4
|
+
module Chagol
|
5
|
+
class SmsSender
|
6
|
+
def initialize(user_phone, password, provider = "way2sms")
|
7
|
+
@sender = user_phone
|
8
|
+
@password = password
|
9
|
+
@provider = provider
|
10
|
+
end
|
11
|
+
|
12
|
+
def send(recipient,message)
|
13
|
+
uri = URI("http://ubaid.tk/sms/sms.aspx")
|
14
|
+
params = { uid: @sender,
|
15
|
+
pwd: @password,
|
16
|
+
phone: recipient,
|
17
|
+
msg: message,
|
18
|
+
provider: @provider
|
19
|
+
}
|
20
|
+
uri.query = URI.encode_www_form(params)
|
21
|
+
response = Net::HTTP.get_response(uri)
|
22
|
+
if response.is_a?(Net::HTTPSuccess) && response.body == "1"
|
23
|
+
puts "Message Sent"
|
24
|
+
else
|
25
|
+
puts "Something Went Wrong. Error Code = #{response.body}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chagol
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nikhil Bhardwaj
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Chagol can send messages to any Indian mobile no
|
15
|
+
email:
|
16
|
+
- root@NikhilBhardwaj.in
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- chagol.gemspec
|
27
|
+
- lib/chagol.rb
|
28
|
+
- lib/chagol/version.rb
|
29
|
+
homepage: https://github.com/nikhilbhardwaj/chagol
|
30
|
+
licenses: []
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 1.8.24
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: It can be used as a standalone command line tool or with other ruby libraries.
|
53
|
+
test_files: []
|