zenvia_s4m 0.3
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 +4 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/zenvia_s4m.rb +15 -0
- data/lib/zenvia_s4m/config.rb +13 -0
- data/lib/zenvia_s4m/send_sms.rb +43 -0
- data/lib/zenvia_s4m/version.rb +3 -0
- data/zenvia_s4m.gemspec +26 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ce8bed463afa60d1371ba497cc5acb73996eca33
|
4
|
+
data.tar.gz: fcaff0d10c5b2ee7fef5e0e72473f46dcb57c7f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4ea034e563869565f4f44b0f5af8c3c0a5ce4559ed73cdd3c39f14f6cbc5eea5d6398eba11963e988eded346a09cfdef9ed4d6762b665a7b214cfcd55fa8f2fe
|
7
|
+
data.tar.gz: e487cbf06966ae07fd705c2e91510a1cc26c45e63f5898ccf6a2ce2b621b884c5b6e6543b0d0f05eb727a34cef0b6b78af265a4d9c70e195291a9086b81c96da
|
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) 2015 Eduardo Alencar
|
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
|
+
# ZenviaS4m
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zenvia_s4m`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
# zenvia SMS
|
13
|
+
gem 'zenvia_s4m', '0.3', git: "git://github.com/lebas/zenvia_s4m.git"
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
|
21
|
+
In app/config/application.rb :
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
ZenviaS4m::configure do |config|
|
25
|
+
config.account = 'xxxxxxxxxx.xxx'
|
26
|
+
config.code = 'mycode'
|
27
|
+
config.url = 'http://www.zenvia360.com.br/GatewayIntegration/msgSms.do'
|
28
|
+
config.log = false
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
list = { phone: '5521988887777', message: 'Bazinga', sms_id: '12333'}
|
36
|
+
zen = ZenviaS4m::SendSms.new(list).send
|
37
|
+
puts zen
|
38
|
+
```
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zenvia_s4m.
|
49
|
+
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
54
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "zenvia_s4m"
|
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/zenvia_s4m.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "zenvia_s4m/version"
|
2
|
+
module ZenviaS4m
|
3
|
+
|
4
|
+
def self.config
|
5
|
+
Config.instance
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.configure(&block)
|
9
|
+
block.call(self.config)
|
10
|
+
end
|
11
|
+
|
12
|
+
autoload :Config, 'zenvia_s4m/config'
|
13
|
+
autoload :SendSms, 'zenvia_s4m/send_sms'
|
14
|
+
autoload :Version, 'zenvia_s4m/version'
|
15
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module ZenviaS4m
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
class SendSms
|
6
|
+
def initialize(params)
|
7
|
+
@params = params
|
8
|
+
@res = nil
|
9
|
+
puts @params if ZenviaS4m.config.log
|
10
|
+
#self.check_params
|
11
|
+
@info_SMS = {
|
12
|
+
account: ZenviaS4m.config.account,
|
13
|
+
code: ZenviaS4m.config.code,
|
14
|
+
dispatch: 'send',
|
15
|
+
to: @params[:phone],
|
16
|
+
msg: @params[:message],
|
17
|
+
id: @params[:sms_id],
|
18
|
+
callbackOption: 1
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_schedule(date)
|
23
|
+
#dd/mm/aaaa hh:mm:ss
|
24
|
+
@info_SMS[:schedule] = date unless date.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
def send
|
28
|
+
puts @info_SMS if ZenviaS4m.config.log
|
29
|
+
puts ZenviaS4m.config.url if ZenviaS4m.config.log
|
30
|
+
@res = RestClient.post ZenviaS4m.config.url, @info_SMS
|
31
|
+
end
|
32
|
+
|
33
|
+
def return_codeSMS
|
34
|
+
@res
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_params
|
38
|
+
@params[:message] = @params[:message][0,150] unless @params[:message].nil?
|
39
|
+
@params[:phone] = @params[:phone] unless @params[:phone].nil?
|
40
|
+
@params[:sms_id] = @params[:sms_id] unless @pamars[:sms_id].nil?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/zenvia_s4m.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zenvia_s4m/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zenvia_s4m"
|
8
|
+
spec.version = ZenviaS4m::VERSION
|
9
|
+
spec.authors = ["Eduardo Alencar"]
|
10
|
+
spec.email = ["lebas66@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Integração com o serviço de envio de SMS da Zenvia.}
|
13
|
+
spec.description = %q{Integração com o serviço de envio de SMS da Zenvia.}
|
14
|
+
spec.homepage = "http://solution4mac.com.br"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_dependency "rest-client"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zenvia_s4m
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.3'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eduardo Alencar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-28 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
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: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Integração com o serviço de envio de SMS da Zenvia.
|
70
|
+
email:
|
71
|
+
- lebas66@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- lib/zenvia_s4m.rb
|
86
|
+
- lib/zenvia_s4m/config.rb
|
87
|
+
- lib/zenvia_s4m/send_sms.rb
|
88
|
+
- lib/zenvia_s4m/version.rb
|
89
|
+
- zenvia_s4m.gemspec
|
90
|
+
homepage: http://solution4mac.com.br
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.6
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Integração com o serviço de envio de SMS da Zenvia.
|
114
|
+
test_files: []
|