serwer_sms 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 +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/serwer_sms.rb +33 -0
- data/lib/serwer_sms/configuration.rb +33 -0
- data/lib/serwer_sms/version.rb +3 -0
- data/serwer_sms.gemspec +23 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8715cb998e6c708e70e300a7eb3adc7c5b43c1b7
|
4
|
+
data.tar.gz: 0fa981083c3b0772b38eca1621855e6a7af6b5a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30155f0657a46df9483ff85446af8d4220d80004a613edea0bb7b8c4c54db7e4949c2fdfccf92793c5f929765fec93fc31d7ae622bea00d88f280ed8419f372d
|
7
|
+
data.tar.gz: d2bcf228de271e750305e03d15189bd624be34d45a310ab2169586c8884f3ec0562dbfd738b02b71794204ef34880e1d9967f1de9ad32047ef581965448a460d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Krzysiek Szczuka
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# SerwerSMS
|
2
|
+
|
3
|
+
Very simple gem for sending SMSes via serwersms.pl
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'serwer_sms'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install serwer_sms
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Configuration
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
SerwerSMS.setup do |config|
|
27
|
+
config.username = 'YOUR_LOGIN'
|
28
|
+
config.password = 'YOUR_PASSWORD'
|
29
|
+
config.details = 0 # optional, default is 1
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
### Sending messages
|
34
|
+
|
35
|
+
SerwerSMS.send('phone_number', 'message text')
|
36
|
+
|
37
|
+
## TODO
|
38
|
+
|
39
|
+
* `sender` option
|
40
|
+
* other options from http://dev.serwersms.pl/wysylanie-wiadomosci-sms-o-jednakowej-tresci-1
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
1. Fork it ( https://github.com/ksz2k/serwer_sms/fork )
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "serwer_sms"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/serwer_sms.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "serwer_sms/version"
|
2
|
+
require "serwer_sms/configuration"
|
3
|
+
|
4
|
+
module SerwerSMS
|
5
|
+
extend SerwerSMS::Configuration
|
6
|
+
|
7
|
+
def self.api_addr
|
8
|
+
"https://api2.serwersms.pl/"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.send(number, body)
|
12
|
+
params = {
|
13
|
+
'phone' => number,
|
14
|
+
'text' => body
|
15
|
+
}
|
16
|
+
req('messages/send_sms', params)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.req(action, params = {})
|
20
|
+
req_params = {
|
21
|
+
'username' => username,
|
22
|
+
'password' => password,
|
23
|
+
'details' => details
|
24
|
+
}.merge(params)
|
25
|
+
uri = URI.parse("#{api_addr}messages/send_sms")
|
26
|
+
https = Net::HTTP.new(uri.host,uri.port)
|
27
|
+
https.use_ssl = true
|
28
|
+
req = Net::HTTP::Post.new(uri.path,{'Content-Type' => 'application/json'})
|
29
|
+
req.body = req_params.to_json
|
30
|
+
res = https.request(req)
|
31
|
+
JSON.parse(res.body)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module SerwerSMS
|
2
|
+
module Configuration
|
3
|
+
|
4
|
+
def setup(&_block)
|
5
|
+
yield(self)
|
6
|
+
end
|
7
|
+
|
8
|
+
def username
|
9
|
+
@username
|
10
|
+
end
|
11
|
+
|
12
|
+
def username=(l)
|
13
|
+
@username = l
|
14
|
+
end
|
15
|
+
|
16
|
+
def password
|
17
|
+
@password
|
18
|
+
end
|
19
|
+
|
20
|
+
def password=(p)
|
21
|
+
@password = p
|
22
|
+
end
|
23
|
+
|
24
|
+
def details
|
25
|
+
@details || 1
|
26
|
+
end
|
27
|
+
|
28
|
+
def details=(d)
|
29
|
+
@details = d
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/serwer_sms.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'serwer_sms/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "serwer_sms"
|
8
|
+
spec.version = SerwerSMS::VERSION
|
9
|
+
spec.authors = ["Krzysiek Szczuka"]
|
10
|
+
spec.email = ["kszczuka@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Very simple gem for sending SMSes via serwersms.pl}
|
13
|
+
spec.homepage = "https://github.com/ksz2k/serwer_sms"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serwer_sms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Krzysiek Szczuka
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-21 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.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
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
|
+
- kszczuka@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rspec"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- lib/serwer_sms.rb
|
58
|
+
- lib/serwer_sms/configuration.rb
|
59
|
+
- lib/serwer_sms/version.rb
|
60
|
+
- serwer_sms.gemspec
|
61
|
+
homepage: https://github.com/ksz2k/serwer_sms
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.6
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Very simple gem for sending SMSes via serwersms.pl
|
85
|
+
test_files: []
|