najdi-sms 0.0.2 → 0.0.3
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.
- data/bin/najdi-sms +50 -0
- metadata +6 -4
data/bin/najdi-sms
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), "/../lib")
|
|
4
|
+
require "optparse"
|
|
5
|
+
require "najdi-sms"
|
|
6
|
+
require "pp"
|
|
7
|
+
|
|
8
|
+
options = {
|
|
9
|
+
username: "",
|
|
10
|
+
password: "",
|
|
11
|
+
number: "",
|
|
12
|
+
message: "",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
optparse = OptionParser.new do|opts|
|
|
16
|
+
opts.on('-h', '--help', 'Display this screen') do
|
|
17
|
+
puts opts
|
|
18
|
+
exit
|
|
19
|
+
end
|
|
20
|
+
opts.on('-u', '--user USERNAME', 'Najdi.si username') do |u|
|
|
21
|
+
options[:username] = u
|
|
22
|
+
end
|
|
23
|
+
opts.on('-p', '--pass PASSWORD', 'Najdi.si password') do |p|
|
|
24
|
+
options[:password] = p
|
|
25
|
+
end
|
|
26
|
+
opts.on('-n', '--number PHONE_NUMBER', 'Phone number (041000000)') do |n|
|
|
27
|
+
options[:number] = n
|
|
28
|
+
end
|
|
29
|
+
opts.on('-m', '--message MESSAGE', 'Message text') do |m|
|
|
30
|
+
options[:message] = m
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
optparse.parse!
|
|
35
|
+
|
|
36
|
+
if options.values.map {|v| (v.nil? or v.empty? or v=="")? 0: 1 }.inject(0) {|s,v| s+v } != 4
|
|
37
|
+
puts "All field are mandatory. See: najdi-sms -h"
|
|
38
|
+
exit
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
NajdiSms.send_sms(
|
|
42
|
+
options[:username],
|
|
43
|
+
options[:password],
|
|
44
|
+
options[:number],
|
|
45
|
+
options[:message]
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# TODO: Errors handling?
|
|
49
|
+
puts "Sent."
|
|
50
|
+
|
metadata
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: najdi-sms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Jan Berdajs
|
|
9
|
+
- Oto Brglez
|
|
9
10
|
autorequire:
|
|
10
11
|
bindir: bin
|
|
11
12
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
13
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: mechanize
|
|
@@ -30,11 +31,13 @@ dependencies:
|
|
|
30
31
|
description: Send SMSes through najdi.si (slovenian site).
|
|
31
32
|
email:
|
|
32
33
|
- mrbrdo@gmail.com
|
|
33
|
-
executables:
|
|
34
|
+
executables:
|
|
35
|
+
- najdi-sms
|
|
34
36
|
extensions: []
|
|
35
37
|
extra_rdoc_files: []
|
|
36
38
|
files:
|
|
37
39
|
- lib/najdi-sms.rb
|
|
40
|
+
- bin/najdi-sms
|
|
38
41
|
homepage: https://github.com/mrbrdo/najdi-sms
|
|
39
42
|
licenses: []
|
|
40
43
|
post_install_message:
|
|
@@ -60,4 +63,3 @@ signing_key:
|
|
|
60
63
|
specification_version: 3
|
|
61
64
|
summary: Send SMSes through najdi.si (slovenian site).
|
|
62
65
|
test_files: []
|
|
63
|
-
has_rdoc:
|