smsconnect 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/lib/smsconnect.rb +63 -0
- data/lib/smsconnect/version.rb +3 -0
- data/smsconnect.gemspec +22 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1c72f87c7585790b91620ccf0285c85abe11ce62
|
4
|
+
data.tar.gz: 0c6a5fad3d5ee9b9703d1a4ce1dd2ef09f3adba9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 08fee47c21187c9288eaea2c66fe66d0ab7c3cf035ce7b7985b97f7cff9ea7aa0c688a966757178f134c9b4a1dadc3f657c1820d4e32f37facf68b711534916f
|
7
|
+
data.tar.gz: b85bef5527af271a610184c832f206ce3282875f1eb0f9ed7ee33bbee1b5388e8b344120c24f399809d73fe9c53f750c7042ccbf1cdf3a4e7cb8ebfb0732fc02
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Pavel Ryznar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 pryznar
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Smsconnect
|
2
|
+
|
3
|
+
<img align="right" src="http://www.smsbrana.cz/images/logo.png">
|
4
|
+
|
5
|
+
Send and receive SMS with node.js (for Czech Republic)
|
6
|
+
|
7
|
+
[Registration](http://www.smsbrana.cz/registrace.html)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'smsconnect'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install smsconnect
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
### Inbox
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'smsconnect'
|
31
|
+
|
32
|
+
sms = Smsconnect::Smsconnect.new({'login'=>'<your_login>', 'password' => '<your_password>'})
|
33
|
+
sms.inbox
|
34
|
+
```
|
35
|
+
|
36
|
+
### Send SMS
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'smsconnect'
|
40
|
+
|
41
|
+
sms = Smsconnect::Smsconnect.new({'login'=>'<your_login>', 'password' => '<your_password>'})
|
42
|
+
sms.send('<phone_number>', '<text_sms>')
|
43
|
+
```
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
1. Fork it ( https://github.com/[my-github-username]/smsconnect/fork )
|
48
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/smsconnect.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "smsconnect/version"
|
2
|
+
require 'digest'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
module Smsconnect
|
7
|
+
class Smsconnect
|
8
|
+
|
9
|
+
API_SCRIPT = "http://api.smsbrana.cz/smsconnect/http.php?"
|
10
|
+
|
11
|
+
def initialize(settings)
|
12
|
+
@settings = settings
|
13
|
+
end
|
14
|
+
|
15
|
+
def salt(length)
|
16
|
+
SecureRandom.hex(length)
|
17
|
+
end
|
18
|
+
|
19
|
+
def getAuth
|
20
|
+
if @settings['login'].nil? && @settings['password'].nil?
|
21
|
+
return false
|
22
|
+
else
|
23
|
+
t = Time.new
|
24
|
+
time = t.strftime("%Y%m%d") + "T" + t.strftime("%H%M%S")
|
25
|
+
salt = self.salt(10)
|
26
|
+
|
27
|
+
result = {}
|
28
|
+
result['login'] = @settings['login']
|
29
|
+
result['time'] = time
|
30
|
+
result['salt'] = salt
|
31
|
+
result['hash'] = Digest::MD5.hexdigest(@settings['password'] + time + salt)
|
32
|
+
|
33
|
+
return result
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def inbox
|
38
|
+
data = self.getAuth
|
39
|
+
data['action'] = 'inbox'
|
40
|
+
data = data.map{|k,v| "#{k}=#{v}"}.join('&')
|
41
|
+
url = URI.parse(API_SCRIPT + data)
|
42
|
+
req = Net::HTTP::Get.new(url.to_s)
|
43
|
+
res = Net::HTTP.start(url.host, url.port) {|http|
|
44
|
+
http.request(req)
|
45
|
+
}
|
46
|
+
puts res.body
|
47
|
+
end
|
48
|
+
|
49
|
+
def send(number, text)
|
50
|
+
data = self.getAuth
|
51
|
+
data['action'] = 'send_sms'
|
52
|
+
data['number'] = number
|
53
|
+
data['message'] = text.gsub(/ /, '+')
|
54
|
+
data = data.map{|k,v| "#{k}=#{v}"}.join('&')
|
55
|
+
url = URI.parse(API_SCRIPT + data)
|
56
|
+
req = Net::HTTP::Get.new(url.to_s)
|
57
|
+
res = Net::HTTP.start(url.host, url.port) {|http|
|
58
|
+
http.request(req)
|
59
|
+
}
|
60
|
+
puts res.body
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/smsconnect.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'smsconnect/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "smsconnect"
|
8
|
+
spec.version = Smsconnect::VERSION
|
9
|
+
spec.authors = ["Pavel Ryznar"]
|
10
|
+
spec.email = ["pryznar@gmail.com"]
|
11
|
+
spec.summary = %q{Send and receive SMS with node.js (for Czech Republic)}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smsconnect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pavel Ryznar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- pryznar@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/smsconnect.rb
|
55
|
+
- lib/smsconnect/version.rb
|
56
|
+
- smsconnect.gemspec
|
57
|
+
homepage: ''
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.4.2
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Send and receive SMS with node.js (for Czech Republic)
|
81
|
+
test_files: []
|