shoutout_lite 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 87a4ba9d49bdca17a6edf1649dc0ce8850c79a71bbeba0a35917d74484cf6faf
4
+ data.tar.gz: 2fb3a98f77caadfe406c1383d1c3e1cd051ac23f87fd1d008752abd4cea5eea3
5
+ SHA512:
6
+ metadata.gz: 97329649922643aa6eb779948dff8ef91c5f9e40921b2f23b7e52d9945a4ba6c1e68bb3af47fb22d0870fdfe7d09076e2e84c43ac87c65e2248802b96d457789
7
+ data.tar.gz: 5adf14dd35cd7f9f056d21779d335e97acebca8d5f2eeeeaf499feacccf9a6fafba60d3d510dc580718e2ca5d61160822bb308eca551bbfc8e2edf5d574fb116
data/lib/shoutout.rb ADDED
@@ -0,0 +1,27 @@
1
+
2
+ class Shoutout
3
+ # Init
4
+ # shoutout=Shoutout.new("APIKEY HERE")
5
+ #
6
+ #
7
+ # Example:
8
+ # >> response=shoutout.sendSms(from:"ShoutTEST",to:"94778811111",body:"This is a test message")
9
+ # {"status"=>"1001", "description"=>"submit success", "cost"=>1, "responses"=>[{"destination"=>"94778811111", "reference_id"=>"ca31e340-c8f2-11eb-94b7-45623297139f", "status"=>"1001", "cost"=>1}]}
10
+ #
11
+ # Arguments:
12
+ # apikey: (String) ShoutOUT Apikey
13
+ # from: (String) sender ID
14
+ # to: (Array) receivers phone numbers
15
+ # body: (String) message body
16
+ attr_reader :apikey
17
+ def initialize(apikey)
18
+ @apikey=apikey
19
+ end
20
+
21
+
22
+ def sendSms(from:,to:,body:)
23
+ return SMS.send(self.apikey,from,to,body)
24
+ end
25
+ end
26
+
27
+ require 'shoutout/sms'
@@ -0,0 +1,35 @@
1
+ class RestClient
2
+
3
+ # def self.postJson(apikey:,body:,url:)
4
+ # puts body.to_json
5
+ # puts url
6
+ # uri = URI.parse(url)
7
+
8
+ # header = {'Content-Type': 'application/json','Authorization': "Apikey #{apikey}"}
9
+
10
+ # # Create the HTTP objects
11
+ # http = Net::HTTP.new(uri.host, uri.port)
12
+ # request = Net::HTTP::Post.new(uri.request_uri)
13
+ # request.content_type="application/json"
14
+ # request["Authorization"] = "Apikey #{apikey}"
15
+ # request.body = body.to_json
16
+
17
+ # # Send the request
18
+ # response = http.request(request)
19
+ # puts response.body
20
+ # return response
21
+ # end
22
+
23
+ def self.postJson(apikey:,body:,url:)
24
+ response = HTTP.auth("Apikey #{apikey}").post(url,
25
+ :json => body
26
+ )
27
+
28
+ return JSON.parse(response.to_s)
29
+
30
+ end
31
+
32
+ end
33
+
34
+ require "json"
35
+ require "http"
@@ -0,0 +1,24 @@
1
+ class Shoutout::SMS
2
+
3
+ def self.send(apikey,from,to,body)
4
+
5
+ return RestClient.postJson(
6
+ body:{
7
+ 'source' => from,
8
+ 'transports':['sms'],
9
+ 'content' => {
10
+ 'sms'=>body
11
+ },
12
+ 'destinations' => [to]},
13
+ url:"https://api.getshoutout.com/coreservice/messages",
14
+ apikey:apikey
15
+
16
+ )
17
+
18
+
19
+
20
+ end
21
+ end
22
+
23
+
24
+ require 'shoutout/restclient'
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shoutout_lite
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ShoutOUT Labs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: ShoutOUT SMS API integration
14
+ email: support@getshoutout.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/shoutout.rb
20
+ - lib/shoutout/restclient.rb
21
+ - lib/shoutout/sms.rb
22
+ homepage: https://rubygems.org/gems/hola
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.1.4
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: ShoutOUT SMS API
45
+ test_files: []