globelabs-sms 0.1.0

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: 7e9001ed58f95b67024f5babd4207da63d361491
4
+ data.tar.gz: 369fb1821c70c6b2e38eac793312d9a61c11ce1b
5
+ SHA512:
6
+ metadata.gz: f1a60ba7adb2d8ff0c33d310c4857c0c72edcf6f940d8284c937ecdc0fc3fe489e0c5493fedca55fe9487e5c4e7958e6992328ad18535b652926d2151a259f04
7
+ data.tar.gz: 0f52570d460bdf6b2ad186daeebe27d55393b67981dbe760cc33c351df9ce3ccf36621c5861daf883a03b1fd31a37fc717f22485fb72d6ea6400d78e77987f78
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/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ before_install:
4
+ - gem update bundler
5
+
6
+ rvm:
7
+ - 2.2.0
8
+
9
+ script: bundle exec rake spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in globelabs-sms.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # ruby-globelabs-sms
2
+ Simple wrapper for [Globe Labs](http://www.globelabs.com.ph/) SMS api
3
+
4
+ [![Build Status](https://travis-ci.org/BernardTolosajr/ruby-globelabs-sms.svg)](https://travis-ci.org/BernardTolosajr/ruby-globelabs-sms.svg)
5
+
6
+ ```ruby
7
+ gem 'globelabs-sms'
8
+ ```
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install globelabs-sms
17
+
18
+ ## Usage
19
+
20
+ ```ruby
21
+ require 'globelabs-sms'
22
+
23
+ sms = Globelabs::SMS.new
24
+
25
+ options = {
26
+ message: 'hello',
27
+ address: '0915xxxxxx',
28
+ sender_address: '1292',
29
+ access_token: 'iwexlwioj23jksdf'
30
+ }
31
+
32
+ response = sms.send_to options
33
+ ```
34
+
35
+ ## Development
36
+
37
+ 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.
38
+
39
+ 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).
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/[my-github-username]/globelabs-sms/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
48
+ =======
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 "globelabs/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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
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/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "globelabs-sms"
8
+ spec.version = Globelabs::SMS::VERSION
9
+ spec.authors = ['Bernard Tolosa']
10
+ spec.email = ["bernardotolosajr@gmail.com"]
11
+
12
+ spec.summary = 'Simple wrapper for globelabs SMS'
13
+ spec.description = 'Simple wrapper for globelabs SMS'
14
+ spec.homepage = ''
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
+ if spec.respond_to?(:metadata)
22
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
23
+ end
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.9'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_dependency 'faraday', '~> 0.9'
28
+ spec.add_dependency 'multi_json', '~> 1.3'
29
+ spec.add_development_dependency 'webmock'
30
+ end
@@ -0,0 +1,9 @@
1
+ require 'faraday'
2
+
3
+ module Globelabs
4
+ class Connection < Faraday::Connection
5
+ def initialize
6
+ super 'https://devapi.globelabs.com.ph'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ require 'globelabs/sms/version'
2
+ require 'globelabs/connection'
3
+ require 'multi_json'
4
+
5
+ module Globelabs
6
+ class SMS
7
+ attr_reader :connection
8
+
9
+ def initialize
10
+ @connection = Globelabs::Connection.new
11
+ end
12
+
13
+ def send_to(options = {})
14
+ url = "/smsmessaging/v1/outbound/#{options[:sender_address]}/requests?access_token=#{options[:access_token]}"
15
+ @connection.post do |req|
16
+ req.url url
17
+ req.headers['Content-Type'] = 'application/json'
18
+ req.body = MultiJson.dump({
19
+ message: options[:message],
20
+ address: options[:address]
21
+ })
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ module Globelabs
2
+ class SMS
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: globelabs-sms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bernard Tolosa
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-30 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
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: multi_json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
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: Simple wrapper for globelabs SMS
84
+ email:
85
+ - bernardotolosajr@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - globelabs-sms.gemspec
99
+ - lib/globelabs/connection.rb
100
+ - lib/globelabs/sms.rb
101
+ - lib/globelabs/sms/version.rb
102
+ homepage: ''
103
+ licenses: []
104
+ metadata:
105
+ allowed_push_host: https://rubygems.org
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.6
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Simple wrapper for globelabs SMS
126
+ test_files: []