smsrb 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 +36 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/examples/simple_sms_zenvia.rb +16 -0
- data/lib/smsrb.rb +50 -0
- data/lib/smsrb/version.rb +3 -0
- data/smsrb.gemspec +25 -0
- data/spec/sms_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2a7bad34b0853525f9d023986225598b30833ff0
|
4
|
+
data.tar.gz: a632ba3db5bcf0beb0a0ad9995c54474e306fb43
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1eec1fb9e12c7008f98a1887988667cde1370e4bd49b316d6b69d68e1350718cd75ad1d9beff38fddccacba042c06c53b8031a4f3002e4f21498efb24d1f3c21
|
7
|
+
data.tar.gz: 184af147c2f978143f58faee0555d6fd41dc44a01d5fdb1c14e77b6d9eb415eba6ea2c77fd7b629c58105d8f7104faca6c640ab6554ad66ea769d0a7c89b0037
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
36
|
+
.DS_Store
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
smsrb (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
domain_name (0.5.24)
|
11
|
+
unf (>= 0.0.5, < 1.0.0)
|
12
|
+
http-cookie (1.0.2)
|
13
|
+
domain_name (~> 0.5)
|
14
|
+
mime-types (2.6.1)
|
15
|
+
netrc (0.10.3)
|
16
|
+
rake (10.4.2)
|
17
|
+
rest-client (1.8.0)
|
18
|
+
http-cookie (>= 1.0.2, < 2.0)
|
19
|
+
mime-types (>= 1.16, < 3.0)
|
20
|
+
netrc (~> 0.7)
|
21
|
+
rspec (3.0.0)
|
22
|
+
rspec-core (~> 3.0.0)
|
23
|
+
rspec-expectations (~> 3.0.0)
|
24
|
+
rspec-mocks (~> 3.0.0)
|
25
|
+
rspec-core (3.0.4)
|
26
|
+
rspec-support (~> 3.0.0)
|
27
|
+
rspec-expectations (3.0.4)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-mocks (3.0.4)
|
31
|
+
rspec-support (~> 3.0.0)
|
32
|
+
rspec-support (3.0.4)
|
33
|
+
unf (0.1.4)
|
34
|
+
unf_ext
|
35
|
+
unf_ext (0.0.7.1)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
bundler (~> 1.5)
|
42
|
+
rake
|
43
|
+
rest-client
|
44
|
+
rspec
|
45
|
+
smsrb!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Filipe Monteiro
|
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,29 @@
|
|
1
|
+
# Smsrb
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'smsrb'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install smsrb
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/smsrb/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'smsrb'
|
2
|
+
|
3
|
+
class SimpleSmsZenvia
|
4
|
+
|
5
|
+
def self.send
|
6
|
+
Smsrb::Zenvia.config({account: "SUA_CONTA", password: "SUA_SENHA"})
|
7
|
+
msg_body = {}
|
8
|
+
msg_body[:from] = "teste"
|
9
|
+
msg_body[:to] = "TELEFONE_COM_DDI_E_DDD"
|
10
|
+
msg_body[:msg] = "testando gem"
|
11
|
+
Smsrb::Zenvia.send(msg_body)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
SimpleSmsZenvia.send
|
data/lib/smsrb.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require "smsrb/version"
|
2
|
+
require "rest-client"
|
3
|
+
require "base64"
|
4
|
+
|
5
|
+
module Smsrb
|
6
|
+
|
7
|
+
class Sms
|
8
|
+
@account = ""
|
9
|
+
@password = ""
|
10
|
+
@base_url = ""
|
11
|
+
|
12
|
+
def self.config(options = {})
|
13
|
+
@account = options[:account]
|
14
|
+
@password = options[:password]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.send(message_options)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class Zenvia < Sms
|
24
|
+
@base_url = "https://api-rest.zenvia360.com.br/services"
|
25
|
+
|
26
|
+
def self.send(message_options)
|
27
|
+
message_payload = payload_from_options(message_options)
|
28
|
+
basic_auth_str = "Basic #{basic_auth}"
|
29
|
+
url = "#{@base_url}/send-sms"
|
30
|
+
response = RestClient.post url, message_payload.to_json, {accept: "application/json", content_type: "application/json", :Authorization => basic_auth_str}
|
31
|
+
results = JSON.parse(response.to_str)
|
32
|
+
results
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.basic_auth
|
36
|
+
Base64.strict_encode64("#{@account}:#{@password}")
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.payload_from_options(message_options)
|
40
|
+
payload = {sendSmsRequest: {}}
|
41
|
+
payload[:sendSmsRequest][:from] = message_options[:from]
|
42
|
+
payload[:sendSmsRequest][:to] = message_options[:to]
|
43
|
+
payload[:sendSmsRequest][:msg] = message_options[:msg]
|
44
|
+
payload
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Your code goes here...
|
50
|
+
end
|
data/smsrb.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'smsrb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "smsrb"
|
8
|
+
spec.version = Smsrb::VERSION
|
9
|
+
spec.authors = ["Filipe Monteiro"]
|
10
|
+
spec.email = ["dev@pipeline.com.br"]
|
11
|
+
spec.summary = %q{Gem for send text messages}
|
12
|
+
spec.description = %q{Gem for send text messages}
|
13
|
+
spec.homepage = "https://github.com/pipelinebr/sms-rb"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rest-client"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
data/spec/sms_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'smsrb'
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smsrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Filipe Monteiro
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-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.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rest-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Gem for send text messages
|
70
|
+
email:
|
71
|
+
- dev@pipeline.com.br
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- examples/simple_sms_zenvia.rb
|
83
|
+
- lib/smsrb.rb
|
84
|
+
- lib/smsrb/version.rb
|
85
|
+
- smsrb.gemspec
|
86
|
+
- spec/sms_spec.rb
|
87
|
+
- spec/spec_helper.rb
|
88
|
+
homepage: https://github.com/pipelinebr/sms-rb
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Gem for send text messages
|
112
|
+
test_files:
|
113
|
+
- spec/sms_spec.rb
|
114
|
+
- spec/spec_helper.rb
|