globelabs_sms_rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 035a8a9d378055cfb745d15cb9a2e6e5ee20dba5
4
- data.tar.gz: e9710e91b2fac491ec32e383efde6a81eb5053d1
3
+ metadata.gz: 9c4fa018ecebd6cec6f579da8182801214d18dbe
4
+ data.tar.gz: 7a254f354d6c54dc7901a33d07c3ae2ef5414148
5
5
  SHA512:
6
- metadata.gz: f6c7e558105cc8982753c7fff2fe073e4e61640da951bafc8694110787c391e54c26f423c93026e4cfd9bafa6844d0ed698e329ac4baa2bb98755da8e0fa3d0a
7
- data.tar.gz: 0ec7dfa0f87d69b61628782d25b0081c0be4c05351cbce31ff49971436da0edce5f3c0d80c4f218f6948830bb9a7ca708aa38e74991d1e2fc62e47df5ddf47f4
6
+ metadata.gz: 8d26f6ca5c3e16104fc1a29ae775b921ddfd647ab9b19de16ef45357e98417062acd1a1ddaae09aac4ca9ea97103f7dd71ed7b166fc0fe0798311e76be4a31a0
7
+ data.tar.gz: 86a719d06405f9a64c95402a04b8fcb396bc92694b1d4be8e1ea76be8ca62ce8d489aafb05cc71ad3ccd2cd2a4f61854145f7d75cb4a44c5d773b7998d491ac0
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at denmark@nueca.net. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in globelabs_sms_rails.gemspec
4
+ gemspec
5
+ gem 'rake'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Den Mark Meralpis
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,30 @@
1
+ ## Installation
2
+
3
+ Add this line to your application's Gemfile:
4
+
5
+ ```ruby
6
+ gem 'globelabs_sms_rails'
7
+ ```
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install globelabs_sms_rails
16
+
17
+ After install the gem, generate an initializer and configure it
18
+
19
+ $ rails g globelabs_sms_rails:install
20
+
21
+
22
+ ## Usage
23
+ ```ruby
24
+ sms = GlobelabsSmsRails.compose("Your message")
25
+ sms.send_to("63917XXXXXXX")
26
+ ```
27
+
28
+ ## License
29
+
30
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'rspec/core/rake_task'
2
+ require "bundler/gem_tasks"
3
+
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "globelabs_sms_rails"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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 'globelabs_sms_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "globelabs_sms_rails"
8
+ spec.version = GlobelabsSmsRails::VERSION
9
+ spec.authors = ["Nujian Den Mark Meralpis"]
10
+ spec.email = ["meralpisdenmark@gmail.com"]
11
+ spec.summary = %q{Sending SMS using Globe Labs API.}
12
+ spec.description = %q{A way of sending sms using Globe Labs API}
13
+ spec.homepage = "https://github.com/denmarkmeralpis"
14
+ spec.license = "MIT"
15
+ spec.bindir = "exe"
16
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.14"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency 'rspec'
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ module GlobelabsSmsRails
2
+ # module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ desc "Creates GlobelabsSmsRails initializer for your application"
6
+
7
+ def copy_initializer
8
+ template "globelabs_sms_rails_initializer.rb", "config/initializers/globelabs_sms_rails.rb"
9
+
10
+ puts "Install complete! Configure the file in config/initializers/globelabs_sms_rails.rb"
11
+ end
12
+ end
13
+ # end
14
+ end
@@ -0,0 +1,7 @@
1
+ GlobelabsSmsRails.configure do |config|
2
+ config.app_id = '' # add your globelabs app app_id
3
+ config.app_secret = '' # add your globelabs app app_secret
4
+ config.passphrase = '' # add the given passphrase(provided by globe telecom)
5
+ config.short_code = '' # add the app short code
6
+ config.api_version = 'v1'
7
+ end
@@ -0,0 +1,13 @@
1
+ require "uri"
2
+ require "net/https"
3
+ require "json"
4
+
5
+ module GlobelabsSmsRails
6
+ class HttpProvider
7
+
8
+ def self.send_now(addr, msg)
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module GlobelabsSmsRails
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,51 @@
1
+ require "globelabs_sms_rails/version"
2
+
3
+ module GlobelabsSmsRails
4
+
5
+ class << self
6
+ attr_accessor :configuration
7
+ end
8
+
9
+ def self.configure
10
+ self.configuration ||= Configuration.new
11
+ yield(configuration)
12
+ end
13
+
14
+ class Configuration
15
+ attr_accessor :short_code, :app_id, :app_secret, :passphrase, :api_version, :message, :address
16
+
17
+ def initialize
18
+ @short_code = ''
19
+ @app_id = ''
20
+ @app_secret = ''
21
+ @api_version = 'v1'
22
+ @passphrase = ''
23
+ @message = ''
24
+ @address = ''
25
+ end
26
+ end
27
+
28
+ def self.compose(msg)
29
+ @message = msg
30
+ end
31
+
32
+ def self.send_to(address)
33
+ @address = address
34
+ if @address.nil? || @message.nil?
35
+ raise 'Address or message is nil'
36
+ else
37
+ data = {
38
+ address: @address,
39
+ message: @message,
40
+ app_id: self.configuration.app_id,
41
+ app_secret: self.configuration.app_secret,
42
+ passphrase: self.configuration.passphrase
43
+ }
44
+ uri = URI.parse("https://devapi.globelabs.com.ph/smsmessaging/#{self.configuration.api_version}/outbound/#{self.configuration.short_code}/requests")
45
+ res = Net::HTTP.post_form(uri, data)
46
+ puts "#{data}"
47
+ return JSON.parse(res.body).merge(http_code: res.code)
48
+ end
49
+ end
50
+
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globelabs_sms_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nujian Den Mark Meralpis
@@ -58,7 +58,21 @@ email:
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
- files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - globelabs_sms_rails.gemspec
71
+ - lib/generators/globelabs_sms_rails/install_generator.rb
72
+ - lib/generators/templates/globelabs_sms_rails_initializer.rb
73
+ - lib/globelabs_sms_rails.rb
74
+ - lib/globelabs_sms_rails/http_provider.rb
75
+ - lib/globelabs_sms_rails/version.rb
62
76
  homepage: https://github.com/denmarkmeralpis
63
77
  licenses:
64
78
  - MIT