gupshup-sdk 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 +7 -0
- data/lib/gupshup.rb +30 -0
- data/lib/gupshup/restclient.rb +15 -0
- data/lib/gupshup/whatsapp.rb +20 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93d703cc1208e0cedb7f376e4e4cbdedbc4f3cd53cf2f03d85760fc8dc92cc73
|
4
|
+
data.tar.gz: 6cbc279e6dbf738e87e5ce2fd9821736fb0cac8f89b27bb6a1258373aefb046e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f980615ac97ee9364a10eb9d1958097f6590b1d2758dcd9dd4adbc30f640f5c4de79253b8cf6f946e6208d8a8e927881c3c32c18c8ec25b4560726d8dab417cc
|
7
|
+
data.tar.gz: 430bbdcdb00f36b75ca190f54c84d041a1d5533644bd8b8fce841940803441822b9695282fee828ca2a2d329f0b0c7c66e0d674413e3bdb5b11219acb3ca95da
|
data/lib/gupshup.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
module Gupshup
|
3
|
+
class Client
|
4
|
+
# Init
|
5
|
+
# @gupshup = Gupshup::Client.new("APIKEY HERE")
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# >> response=@gupshup.sendWhatsApp(from:"917834811114",to:"94778845700",body:"This is to remind you that {{1}} is due by {{2}}.",appName:"Shoutouttest")
|
10
|
+
# {:code=>200, :body=>{"status"=>"submitted", "messageId"=>"45c63e36-2e30-4116-aa85-66a3de6f35fa"}}
|
11
|
+
#
|
12
|
+
# Arguments:
|
13
|
+
# apikey: (String) ShoutOUT Apikey
|
14
|
+
# from: (String) sender ID
|
15
|
+
# to: (Array) receivers phone numbers
|
16
|
+
# body: (String) message body
|
17
|
+
# appName: (String) Gupshup app name
|
18
|
+
attr_reader :apikey
|
19
|
+
def initialize(apikey)
|
20
|
+
@apikey=apikey
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def sendWhatsApp(from:,to:,body:,appName:)
|
25
|
+
|
26
|
+
return WhatspApp.send(self.apikey,from,to,body,appName)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
require 'gupshup/whatsapp'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Gupshup::RestClient
|
2
|
+
def self.post(apikey:,body:,url:)
|
3
|
+
response = HTTP.headers(:apikey=>apikey).post(url,
|
4
|
+
:form => body
|
5
|
+
)
|
6
|
+
puts response.to_s
|
7
|
+
return {:code=>response.code,:body=>response.code==200?JSON.parse(response.to_s):response.to_s}
|
8
|
+
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
require "json"
|
15
|
+
require "http"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Gupshup::WhatspApp
|
2
|
+
|
3
|
+
def self.send(apikey,from,to,body,appName)
|
4
|
+
|
5
|
+
return Gupshup::RestClient.post(
|
6
|
+
body:{
|
7
|
+
'source' => from,
|
8
|
+
'channel':'whatsapp',
|
9
|
+
'message' => body,
|
10
|
+
'destination' => to,
|
11
|
+
'src.name'=>appName
|
12
|
+
},
|
13
|
+
url:"https://api.gupshup.io/sm/api/v1/msg",
|
14
|
+
apikey:apikey
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
require 'gupshup/restclient'
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gupshup-sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ShoutOUT Labs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
description: Gupshup API integration
|
28
|
+
email: support@getshoutout.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/gupshup.rb
|
34
|
+
- lib/gupshup/restclient.rb
|
35
|
+
- lib/gupshup/whatsapp.rb
|
36
|
+
homepage: https://rubygems.org/gems/hola
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubygems_version: 3.1.4
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Gupshup SDK
|
59
|
+
test_files: []
|