hunger_unifonic 0.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 +7 -0
- data/lib/hunger_unifonic.rb +21 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6760a07c57b7c18350b19253d79b6daff3d4ab9
|
4
|
+
data.tar.gz: a44ae7ff6a5a301d95fef3189c783cc914e16858
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75799e70039c722dc736eb662ccc25a27b7659290e469b7f30d1989517b8dbe81766026a1bc1b95d9c2d3fcb5d5e662e0ada12b7fa2a35aa6abaae201bae186a
|
7
|
+
data.tar.gz: a3326f7e226f084ce9656e43b1cd5b14c120beb2770549a2ca0b8a33e2c6feb84389114018a18f12302d495d1d881705df80601dedecb60d6853c93b4fc92f08
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
module HungerUnifonic
|
4
|
+
def self.send_sms(credentials, mobile_number, message,sender,options = nil)
|
5
|
+
username = credentials['username']
|
6
|
+
password = credentials['password']
|
7
|
+
mobile = mobile_number.gsub(/[^a-z,0-9]/, "")
|
8
|
+
url = URI("#{credentials['server']}/sendSms?userid=#{username}&password=#{password}&to=#{mobile}&from=#{sender}&format=json&messageBodyEncoding=UTF8&msg=#{message}")
|
9
|
+
http = Net::HTTP.new(url.host, url.port)
|
10
|
+
request = Net::HTTP::Get.new(url)
|
11
|
+
response = http.request(request)
|
12
|
+
puts response.read_body
|
13
|
+
if response.code.to_i.in? 200..299 && response.body[0] == "Success"
|
14
|
+
message_id = response.body[3]
|
15
|
+
return {message_id: message_id , code: 0}
|
16
|
+
else
|
17
|
+
return {error: response.body, code: response.code.to_i}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hunger_unifonic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ibrahim saeed
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: ibrahim.saeed@hungerstation.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/hunger_unifonic.rb
|
20
|
+
homepage: https://github.com/ebe222/hunger_unifonic
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.5.2.1
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: hungerstation unifonic sms sender
|
43
|
+
test_files: []
|