Skip to content
Browse files

initial for gem create

  • Loading branch information...
1 parent caecd48 commit 4f22c3fc54d08010ce4727c420480d2fa555605b @BeenaShetty committed Jul 19, 2013
Showing with 117 additions and 2 deletions.
  1. +17 −0 .gitignore
  2. +5 −0 Gemfile
  3. +22 −0 LICENSE.txt
  4. +1 −0 Rakefile
  5. +7 −0 lib/send_sms.rb
  6. +10 −2 { → lib/send_sms}/remote.rb
  7. 0 { → lib/send_sms}/sms.rb
  8. +3 −0 lib/send_sms/version.rb
  9. +23 −0 send_sms.gemspec
  10. +25 −0 spec/sms_spec.rb
  11. +4 −0 spec/spec_helper.rb
View
17 .gitignore
@@ -0,0 +1,17 @@
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
View
5 Gemfile
@@ -0,0 +1,5 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in send_sms.gemspec
+gemspec
+gem 'rspec'
View
22 LICENSE.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Beena Shetty
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
1 Rakefile
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
View
7 lib/send_sms.rb
@@ -0,0 +1,7 @@
+require "send_sms/version"
+require "send_sms/remote"
+require "send_sms/sms"
+
+module SendSms
+ # Your code goes here...
+end
View
12 remote.rb → lib/send_sms/remote.rb
@@ -33,9 +33,17 @@ def fetch(http,path,header,data=nil,method=:get,limit=10)
cookie ||= header['Cookie']
referer ||= header['Referer']
if method == :get
- response = http.get(path,header.delete_if {|i,j| j.nil? })
+ begin
+ response = http.get(path,header.delete_if {|i,j| j.nil? })
+ rescue
+ return "Url not found"
+ end
else
- response = http.post(path,data,header.delete_if {|i,j| j.nil? })
+ begin
+ response = http.post(path,data,header.delete_if {|i,j| j.nil? })
+ rescue
+ return "Url not found"
+ end
cookie ||= response['set-cookie']
end
case response.code
View
0 sms.rb → lib/send_sms/sms.rb
File renamed without changes.
View
3 lib/send_sms/version.rb
@@ -0,0 +1,3 @@
+module SendSms
+ VERSION = "0.0.1"
+end
View
23 send_sms.gemspec
@@ -0,0 +1,23 @@
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'send_sms/version'
+
+Gem::Specification.new do |spec|
+ spec.name = "send_sms"
+ spec.version = SendSms::VERSION
+ spec.authors = ["Beena Shetty"]
+ spec.email = ["beena.shetty@desidime.com"]
+ spec.description = %q{TODO: Write a gem description}
+ spec.summary = %q{TODO: Write a gem summary}
+ spec.homepage = ""
+ spec.license = "MIT"
+
+ spec.files = `git ls-files`.split($/)
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
+ spec.require_paths = ["lib"]
+
+ spec.add_development_dependency "bundler", "~> 1.3"
+ spec.add_development_dependency "rake"
+end
View
25 spec/sms_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+describe SendSms do
+ it "To check if url is invalid" do
+ sms= SMS.new("http://160by2.c")
+ sms.cookie.should == "Url not found"
+ #s.login("9920822386", "beena$")
+ #sms =s.send_message('sa65sdf65645','9920822386', 'HELLO!!!!!!!!!!!!!!')
+ #sms
+ end
+
+ it "Valid url" do
+ sms= SMS.new("http://160by2.com")
+ sms.cookie.should == nil
+ end
+
+ it "Valid login" do
+ sms= SMS.new("http://160by2.com")
+ if sms.cookie.should == nil
+ test =sms.login("9920822386", "beena$")
+ valid = /LastLoginCookie/ =~ test[0]
+ valid.should_not == nil
+
+ end
+ end
+end
View
4 spec/spec_helper.rb
@@ -0,0 +1,4 @@
+require 'rubygems'
+require 'bundler/setup'
+
+require 'send_sms'

0 comments on commit 4f22c3f

Please sign in to comment.
Something went wrong with that request. Please try again.