helliomessaging_sms 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83232f131baa32c87143345532d6f48ad373ff91
4
+ data.tar.gz: 89b866d3aade733cda8b9c16ca7adfce313442c4
5
+ SHA512:
6
+ metadata.gz: b0cace689c5957282e9f9ad1f2ed89cfc2159fc1bc17ec934d094f2f17b841cbf68becef5265c5f4f2e8af893aa3bcf541fa2e844536de98f10cfc414791aed1
7
+ data.tar.gz: 4b3a73d4ba186e3f2b737108987683c1d1c8ccbec8b22094003757de02333ff766dc26813548df13633c9c2c1394a9187046759eb7a7262ec793a6a3304312e3
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in smsgh_sms.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 Albert A. Ninyeh
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,61 @@
1
+ # helliomessaging_sms
2
+
3
+ This is a ruby wrapper that abstracts Hellio Messaging SMS API. This gem has extra features and simplicity which makes it seamlessly easy to Send Bulk SMS, Check Balance and Receive delivery report.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'helliomessaging_sms'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install helliomessaging_sms
18
+
19
+ ## Usage
20
+
21
+ Create an Account with Hellio Messaging via https://helliomessaging.com and head to your account settings to generate your API credentials which could be the old Username and Password sort of authentication or using a Consumer Key and an Application Serect.
22
+
23
+ If you are using the old API (V1) then
24
+
25
+ helliomessaging_sms.api_username = "YOUR_USERNAME"
26
+ helliomessaging_sms.api_password = "YOUR_PASSWORD"
27
+
28
+ If you are using the new API (V2) then
29
+
30
+ helliomessaging_sms.api_consumer_id = "YOUR_CONSUMER_KEY"
31
+ helliomessaging_sms.api_application_secret = "YOUR_APPLICATION_SECRET"
32
+
33
+ Optionally set global Sender ID
34
+
35
+ helliomessaging_sms.api_senderid = "YOUR_SENDERID"
36
+
37
+ Sending an SMS Message
38
+
39
+ helliomessaging_sms.push(:to => 'PHONE-NUMBER', :msg => "Your SMS Message goes here")
40
+
41
+ How to override the global SENDER ID config
42
+
43
+ helliomessaging_sms.push(:to => 'PHONE-NUMBER', :msg => "Your SMS Message goes here", :from => "SENDERID")
44
+
45
+ Sample Results Returned
46
+
47
+ {:status=>200, :notice=>"OK: 62357215"}
48
+
49
+ Any returned status code other than 200 is a failed response.
50
+
51
+ ## About Hellio Messaing
52
+
53
+ Hellio Messaing is the premier messaging company in Ghana. Find out more about them at https://helliomessaing.com
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/helliomessaging_sms/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Albert A. Ninyeh"]
6
+ gem.email = ["albert@sarayu.co"]
7
+ gem.description = %q{This is a ruby wrapper that abstracts Hellio Messaging SMS API. This gem has extra features and simplicity which makes it seamlessly easy to Send Bulk SMS, Check Balance and Receive delivery report.}
8
+ gem.summary = %q{Send SMS via Hellio Messaging's API}
9
+ gem.homepage = "https://github.com/nukturnal/helliomessaging_sms"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "helliomessaging_sms"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = HellioMessaging::VERSION
17
+ gem.add_dependency "curb-fu", "~> 0"
18
+ gem.add_dependency "nokogiri"
19
+ end
@@ -0,0 +1,53 @@
1
+ require "helliomessaging_sms/version"
2
+ require 'cgi'
3
+ require 'curb-fu'
4
+ require 'nokogiri'
5
+
6
+ module HellioMessaging
7
+ @@api_username = nil
8
+ @@api_password = nil
9
+ @@api_client_id = nil
10
+ @@api_client_secret = nil
11
+ @@api_senderid = "HELLIOMESSAGINGAPI"
12
+
13
+ # Expects :msg, :to and an optional :from param
14
+ # The :from param defaults to @@api_senderid when its omitted
15
+ def self.push(options={})
16
+
17
+ sender_id = options[:from].nil? ? @@api_senderid : options[:from]
18
+ response = nil
19
+ message = options[:msg]
20
+
21
+ raise ArgumentError, ':msg and :to params expected' if message.nil? || options[:to].nil?
22
+
23
+ message = Nokogiri::HTML.parse(message).text
24
+
25
+ if @@api_username != nil && @@api_password != nil
26
+ response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms?'}, { :from => sender_id, :to => options[:to], :text => message, :username => @@api_username, :password => @@api_password })
27
+ end
28
+
29
+ if @@api_client_id != nil && @@api_client_secret != nil
30
+ response = CurbFu.get({:host => 'app.helliomessaging.com/api', :path => '/sms?', :protocol => 'http'}, { :From => sender_id, :To => options[:to], :Content => message, :ClientId => @@api_client_id, :ClientSecret => @@api_client_secret })
31
+ end
32
+
33
+ {:status => response.status, :notice => response.body}
34
+
35
+ end
36
+
37
+
38
+ def self.api_username=(api_username); @@api_username = api_username; end
39
+ def self.api_username; @@api_username; end
40
+
41
+ def self.api_password=(api_password); @@api_password = api_password; end
42
+ def self.api_password; @@api_password; end
43
+
44
+ def self.api_client_id=(api_client_id); @@api_client_id = api_client_id; end
45
+ def self.api_client_id; @@api_client_id; end
46
+
47
+ def self.api_client_secret=(api_client_secret); @@api_client_secret = api_client_secret; end
48
+ def self.api_client_secret; @@api_client_secret; end
49
+
50
+ def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end
51
+ def self.api_senderid; @@api_senderid; end
52
+
53
+ end
@@ -0,0 +1,3 @@
1
+ module HellioMessaging
2
+ VERSION = "1.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: helliomessaging_sms
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Albert A. Ninyeh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: curb-fu
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: This is a ruby wrapper that abstracts Hellio Messaging SMS API. This
42
+ gem has extra features and simplicity which makes it seamlessly easy to Send Bulk
43
+ SMS, Check Balance and Receive delivery report.
44
+ email:
45
+ - albert@sarayu.co
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - Gemfile
52
+ - LICENSE
53
+ - README.md
54
+ - Rakefile
55
+ - helliomessaging_sms.gemspec
56
+ - lib/helliomessaging_sms.rb
57
+ - lib/helliomessaging_sms/version.rb
58
+ homepage: https://github.com/nukturnal/helliomessaging_sms
59
+ licenses: []
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.6.11
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Send SMS via Hellio Messaging's API
81
+ test_files: []