telcosms 0.0.3 → 1.0.0
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 +5 -5
- data/README.md +21 -18
- data/lib/telcosms/version.rb +2 -2
- data/lib/telcosms.rb +19 -15
- data/lib/telcosms_module.rb +28 -0
- data/telcosms-0.0.5.gem +0 -0
- data/telcosms.gemspec +7 -11
- metadata +13 -14
- data/telcosms-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2624317950cb75a589877601dd428700135cc8e7e571579ebd167f1e1eb2d85f
|
4
|
+
data.tar.gz: 05a12a5c9344910a13c9e84b28ed1111b75b9790abb95279e922d948a62796f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99af9ea663f6ab113f91f33c4cd75281c2960fc858b04a5f988c50f71fb8a2cdbbdd71c26bf26ccf169fe391cc384b716e9a0296e35ad55b05da1f15c8b61135
|
7
|
+
data.tar.gz: 0cbe8dc3c52d6db633d335bb18d8d664578db67a1602fc4d6dc3f029424e4458b3bdf4957ba9a37ee6ed24daec16ee3381f5709048645d6b51ae96af88efd623
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Telcosms
|
2
2
|
|
3
|
-
A ruby gem
|
3
|
+
A ruby gem created by [Sergio Maziano](http://github.com/smaziano) for the [TelcoSMS](http://telcosms.co.ao) API that allows your application to send sms to Angolan Numbers.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -19,28 +19,32 @@ Or install it yourself as:
|
|
19
19
|
$ gem install telcosms
|
20
20
|
|
21
21
|
## Setup
|
22
|
-
Make sure you have access to your username and password
|
22
|
+
Make sure you have access to your username and password (can be requested to the TelcoSMS team)
|
23
|
+
and setup as your environment variables.
|
23
24
|
|
24
|
-
|
25
|
+
### Environment variables
|
26
|
+
|Env Variable|Value|
|
27
|
+
|-|-|
|
28
|
+
|TELCOSMS_USERNAME| The username provided by TelcoSMS|
|
29
|
+
|TELCOSMS_PASSWORD| The password provided by TelcoSMS|
|
25
30
|
|
31
|
+
## Usage
|
32
|
+
You need to pass 3 arguments to make it work (number, message, service).
|
26
33
|
```ruby
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
##
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
## username is a string with username given by the Telcosms crew(as best practive, use environment variable).
|
37
|
-
## password is a string with password given by the Telcosms crew(as best practive, use environment variable).
|
38
|
-
## servico is a string with the text that will show up as contact sender.
|
34
|
+
telco = Telcosms.new
|
35
|
+
telco.send(number: '+244923456789', message: 'Hello World\nNext line', service: 'TelcoSMS')
|
36
|
+
```
|
37
|
+
## Schema
|
38
|
+
|field |type|notes|
|
39
|
+
|-|-|-|
|
40
|
+
|number|string|number with or without a country code|
|
41
|
+
|message|string|the message content|
|
42
|
+
|service|string|sender identifier |
|
39
43
|
|
40
44
|
## Help and Docs
|
41
45
|
|
42
46
|
- [TelcoSMS](http://telcosms.co.ao)
|
43
|
-
- [RDOC](http://www.rubydoc.info/gems/telcosms/0.0
|
47
|
+
- [RDOC](http://www.rubydoc.info/gems/telcosms/1.0.0)
|
44
48
|
|
45
49
|
## Development
|
46
50
|
|
@@ -58,5 +62,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/smazia
|
|
58
62
|
|
59
63
|
## License
|
60
64
|
|
61
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
62
|
-
|
65
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/telcosms/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0
|
1
|
+
module TelcosmsModule
|
2
|
+
VERSION = "1.0.0"
|
3
3
|
end
|
data/lib/telcosms.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
require_relative "telcosms_module"
|
2
|
+
|
3
|
+
class Telcosms
|
4
|
+
include TelcosmsModule
|
5
|
+
|
6
|
+
def initialize(username: set_username, password: set_password, service: nil)
|
7
|
+
@username = username
|
8
|
+
@password = password
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def set_username
|
13
|
+
ENV.fetch('TELCOSMS_USERNAME')
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_password
|
17
|
+
ENV.fetch('TELCOSMS_PASSWORD')
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "telcosms/version"
|
2
|
+
require "httparty"
|
3
|
+
|
4
|
+
module TelcosmsModule
|
5
|
+
class Error < StandardError; end
|
6
|
+
include HTTParty
|
7
|
+
follow_redirects false
|
8
|
+
base_uri "196.216.53.194:9501"
|
9
|
+
|
10
|
+
def send(number:, message:, service:)
|
11
|
+
content = set_headers
|
12
|
+
text = URI::Parser.new
|
13
|
+
request = HTTParty.post("#{host}/api?action=sendmessage&username=#{@username}&password=#{@password}&recipient=#{number}&messagetype=SMS:TEXT&messagedata=#{text.escape(message)}&originator=#{service}", content)
|
14
|
+
return request
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def set_headers
|
19
|
+
content = {}
|
20
|
+
headers = {'Content-Type' => "application/json"}
|
21
|
+
content[:headers] = headers
|
22
|
+
content
|
23
|
+
end
|
24
|
+
|
25
|
+
def host
|
26
|
+
"http://196.216.53.194:9501"
|
27
|
+
end
|
28
|
+
end
|
data/telcosms-0.0.5.gem
ADDED
Binary file
|
data/telcosms.gemspec
CHANGED
@@ -1,31 +1,27 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'telcosms/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "telcosms"
|
8
|
-
spec.version =
|
7
|
+
spec.version = TelcosmsModule::VERSION
|
9
8
|
spec.authors = ["Sergio Maziano"]
|
10
9
|
spec.email = ["sergio.maziano@gmail.com"]
|
11
10
|
|
12
|
-
spec.summary = %q{A Ruby gem for TelcoSMS API(http://telcosms.co.ao) made by
|
13
|
-
spec.description = %q{A Ruby gem to connect your application with the TelcoSMS API(http://telcosms.co.ao) to allow your application to send sms through Angolan numbers}
|
11
|
+
spec.summary = %q{A Ruby gem for TelcoSMS API(http://telcosms.co.ao) made by Sergio Maziano(http://github.com/smaziano)}
|
12
|
+
spec.description = %q{A Ruby gem to connect your application with the TelcoSMS API's (http://telcosms.co.ao) to allow your application to send sms through Angolan numbers}
|
14
13
|
spec.homepage = "https://github.com/smaziano/telcosms"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
21
19
|
|
22
|
-
|
23
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
20
|
spec.bindir = "exe"
|
25
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
22
|
spec.require_paths = ["lib"]
|
27
23
|
|
28
24
|
spec.add_development_dependency "bundler", "~> 1.12"
|
29
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
-
spec.add_dependency 'httparty', "~> 0.
|
26
|
+
spec.add_dependency 'httparty', "~> 0.18.1"
|
31
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telcosms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Maziano
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,15 +44,15 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.18.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
55
|
-
description: A Ruby gem to connect your application with the TelcoSMS API(http://telcosms.co.ao)
|
54
|
+
version: 0.18.1
|
55
|
+
description: A Ruby gem to connect your application with the TelcoSMS API's (http://telcosms.co.ao)
|
56
56
|
to allow your application to send sms through Angolan numbers
|
57
57
|
email:
|
58
58
|
- sergio.maziano@gmail.com
|
@@ -70,14 +70,14 @@ files:
|
|
70
70
|
- bin/setup
|
71
71
|
- lib/telcosms.rb
|
72
72
|
- lib/telcosms/version.rb
|
73
|
-
-
|
73
|
+
- lib/telcosms_module.rb
|
74
|
+
- telcosms-0.0.5.gem
|
74
75
|
- telcosms.gemspec
|
75
76
|
homepage: https://github.com/smaziano/telcosms
|
76
77
|
licenses:
|
77
78
|
- MIT
|
78
|
-
metadata:
|
79
|
-
|
80
|
-
post_install_message:
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
81
|
rdoc_options: []
|
82
82
|
require_paths:
|
83
83
|
- lib
|
@@ -92,9 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
95
|
+
rubygems_version: 3.1.4
|
96
|
+
signing_key:
|
98
97
|
specification_version: 4
|
99
|
-
summary: A Ruby gem for TelcoSMS API(http://telcosms.co.ao) made by
|
98
|
+
summary: A Ruby gem for TelcoSMS API(http://telcosms.co.ao) made by Sergio Maziano(http://github.com/smaziano)
|
100
99
|
test_files: []
|
data/telcosms-0.0.2.gem
DELETED
Binary file
|