tww-ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 06c357b6798f98e9ac19f847cdbfc1c4ee80fc28
4
+ data.tar.gz: 3a69fb3fddd9c57cabb3d784abb489f4ba8abd43
5
+ SHA512:
6
+ metadata.gz: 7d7288bc50f4367f28a14a3d47c4c559e0c3d1f0c1bfa7f315c3741834fddb21368d892f7777dceff803953b86ca009798731a9a7b4bcee65c2d9b539f07ec5e
7
+ data.tar.gz: 8615197e37d5197801d2e2dd22af17c0b778cd201751a2f8420e78e0b368c757a2955c1fe216a4bfed39a32dc5b1bda0a50c98b45973017a1258946442bec6b1
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec"
10
+ gem "rdoc"
11
+ gem "bundler"
12
+ gem "jeweler"
13
+ gem "simplecov"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ diff-lcs (1.1.3)
7
+ faraday (0.8.8)
8
+ multipart-post (~> 1.2.0)
9
+ git (1.2.6)
10
+ github_api (0.10.1)
11
+ addressable
12
+ faraday (~> 0.8.1)
13
+ hashie (>= 1.2)
14
+ multi_json (~> 1.4)
15
+ nokogiri (~> 1.5.2)
16
+ oauth2
17
+ hashie (2.0.5)
18
+ highline (1.6.20)
19
+ httpauth (0.2.0)
20
+ jeweler (1.8.8)
21
+ builder
22
+ bundler (~> 1.0)
23
+ git (>= 1.2.5)
24
+ github_api (= 0.10.1)
25
+ highline (>= 1.6.15)
26
+ nokogiri (= 1.5.10)
27
+ rake
28
+ rdoc
29
+ json (1.8.1)
30
+ jwt (0.1.8)
31
+ multi_json (>= 1.5)
32
+ multi_json (1.8.2)
33
+ multi_xml (0.5.5)
34
+ multipart-post (1.2.0)
35
+ nokogiri (1.5.10)
36
+ oauth2 (0.9.2)
37
+ faraday (~> 0.8)
38
+ httpauth (~> 0.2)
39
+ jwt (~> 0.1.4)
40
+ multi_json (~> 1.0)
41
+ multi_xml (~> 0.5)
42
+ rack (~> 1.2)
43
+ rack (1.5.2)
44
+ rake (10.1.0)
45
+ rdoc (3.12.2)
46
+ json (~> 1.4)
47
+ rspec (2.8.0)
48
+ rspec-core (~> 2.8.0)
49
+ rspec-expectations (~> 2.8.0)
50
+ rspec-mocks (~> 2.8.0)
51
+ rspec-core (2.8.0)
52
+ rspec-expectations (2.8.0)
53
+ diff-lcs (~> 1.1.2)
54
+ rspec-mocks (2.8.0)
55
+ simplecov (0.7.1)
56
+ multi_json (~> 1.0)
57
+ simplecov-html (~> 0.7.1)
58
+ simplecov-html (0.7.1)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ bundler (~> 1.0)
65
+ jeweler (~> 1.8.7)
66
+ rdoc (~> 3.12)
67
+ rspec (~> 2.8.0)
68
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Araan Branco
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/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # TWW Ruby
2
+
3
+ ### Download and Install
4
+ ```
5
+ gem install tww-ruby
6
+ ```
7
+
8
+ or on your Gemfile:
9
+ ```
10
+ gem "tww-ruby"
11
+ ```
12
+
13
+ and
14
+ ```
15
+ bundle install
16
+ ```
17
+
18
+ create tww config initializer
19
+ ```
20
+ rails g tww:install
21
+ ```
22
+
23
+ after config file created, you should define config params:
24
+
25
+ ```ruby
26
+
27
+ require 'tww'
28
+
29
+ TWW.configure do |config|
30
+ config.numUser = 'YOUR TWW NUMBER USER'
31
+ config.password = 'YOUR TWW PASSWORD'
32
+ end
33
+
34
+ ```
35
+
36
+ ### Usage
37
+
38
+ ```ruby
39
+
40
+ require 'tww'
41
+
42
+ # Sending a SMS
43
+
44
+ sms = TWW::Sms.new('you-id', 'test message!', 5521999999999)
45
+ sms.forward =>
46
+
47
+ ```
48
+
49
+
50
+ ### Contributing to tww-ruby
51
+
52
+ 1. Fork the project.
53
+ 2. Start a feature/bugfix branch.
54
+ 3. Commit and push until you are happy with your contribution.
55
+ 4. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
56
+
57
+
58
+ Copyright (c) 2012 ARAAN BRANCO. See LICENSE.txt for
59
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "tww-ruby"
18
+ gem.homepage = "http://github.com/araanbranco/tww-ruby"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Send sms with TWW}
21
+ gem.description = %Q{ Ruby API for send sms with TWW}
22
+ gem.email = "araan666@gmail.com"
23
+ gem.authors = ["araanbranco"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "tww-ruby #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,14 @@
1
+ require 'rails/generators/base'
2
+
3
+ module TWW
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def zenvia_initializer
10
+ copy_file 'tww.rb', 'config/initializers/tww.rb'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ require 'tww'
2
+
3
+ TWW.configure do |config|
4
+ config.numUser = 'YOUR TWW NUMBER USER'
5
+ config.password = 'YOUR TWW PASSWORD'
6
+ end
data/lib/tww/base.rb ADDED
@@ -0,0 +1,22 @@
1
+ # encoding: UTF-8
2
+ require 'net/http'
3
+ require 'uri'
4
+
5
+ module TWW
6
+ module Base
7
+ URL = 'https://webservices.twwwireless.com.br/reluzcap/wsreluzcap.asmx/EnviaSMS'
8
+
9
+ private
10
+
11
+ def send_message(id_sms, message, cel)
12
+ Net::HTTP.post_form URI(URL),
13
+ {
14
+ :NumUsu => TWW.configuration.numUser
15
+ :Senha => TWW.configuration.password
16
+ :SeuNum => id_sms,
17
+ :Celular => cel,
18
+ :Mensagem => message
19
+ }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Zenvia
2
+ class Configuration
3
+ attr_accessor :account, :code, :dispatch, :from
4
+
5
+ def initialize
6
+ @account = ''
7
+ @code = ''
8
+ @dispatch = ''
9
+ @from = ''
10
+ end
11
+ end
12
+
13
+ class << self
14
+ attr_accessor :configuration
15
+ end
16
+
17
+ def self.configure
18
+ self.configuration ||= Configuration.new
19
+ yield configuration
20
+ end
21
+
22
+ end
data/lib/tww/sms.rb ADDED
@@ -0,0 +1,17 @@
1
+ module TWW
2
+ class Sms
3
+ include Base
4
+
5
+ attr_accessor :message, :cel
6
+
7
+ def initialize(id_sms, message, cel)
8
+ @id_sms = id_sms
9
+ @message = message
10
+ @cel = cel
11
+ end
12
+
13
+ def forward
14
+ send_message(@id_sms, @message, @cel)
15
+ end
16
+ end
17
+ end
data/lib/tww.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+
3
+ require_relative 'tww/base'
4
+ require_relative 'tww/configuration'
5
+ require_relative 'tww/sms'
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'tww-ruby'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "TWWRuby" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
data/tww-ruby.gemspec ADDED
@@ -0,0 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "tww-ruby"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["araanbranco"]
12
+ s.date = "2015-10-14"
13
+ s.description = " Ruby API for send sms with TWW"
14
+ s.email = "araan666@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/generators/tww/install/install_generator.rb",
29
+ "lib/generators/tww/install/templates/tww.rb",
30
+ "lib/tww.rb",
31
+ "lib/tww/base.rb",
32
+ "lib/tww/configuration.rb",
33
+ "lib/tww/sms.rb",
34
+ "spec/spec_helper.rb",
35
+ "spec/tww-ruby_spec.rb",
36
+ "tww-ruby.gemspec"
37
+ ]
38
+ s.homepage = "http://github.com/araanbranco/tww-ruby"
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = "1.8.25"
42
+ s.summary = "Send sms with TWW"
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
49
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
50
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
51
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
52
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
55
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
58
+ s.add_dependency(%q<simplecov>, [">= 0"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
62
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
65
+ s.add_dependency(%q<simplecov>, [">= 0"])
66
+ end
67
+ end
68
+
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tww-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - araanbranco
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.8.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jeweler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.7
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.8.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: " Ruby API for send sms with TWW"
84
+ email: araan666@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - LICENSE.txt
89
+ - README.md
90
+ files:
91
+ - ".document"
92
+ - ".rspec"
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - VERSION
99
+ - lib/generators/tww/install/install_generator.rb
100
+ - lib/generators/tww/install/templates/tww.rb
101
+ - lib/tww.rb
102
+ - lib/tww/base.rb
103
+ - lib/tww/configuration.rb
104
+ - lib/tww/sms.rb
105
+ - spec/spec_helper.rb
106
+ - spec/tww-ruby_spec.rb
107
+ - tww-ruby.gemspec
108
+ homepage: http://github.com/araanbranco/tww-ruby
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.4.8
129
+ signing_key:
130
+ specification_version: 3
131
+ summary: Send sms with TWW
132
+ test_files: []