freshchat_whatsapp 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/freshchat_whatsapp/api.rb +5 -3
- data/lib/freshchat_whatsapp/client.rb +3 -13
- data/lib/freshchat_whatsapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde4be3ea04e4aaccc7fb5721d605ef0baaa6a5655ddf2109b87db95851f29bb
|
4
|
+
data.tar.gz: afb637de2dedc51348abef1278e80e0994788ec92bd2108eb288cc8c5cc17007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ec2800369347bfd116ec96b0d24bb3add8f500c1f923dcc404990aee13af53a69a26f0896438d124c54b13b7db10a3f0f8699a6972f57c0ee1f7dd1d29ac86d
|
7
|
+
data.tar.gz: a790c828a85332081079cb9244e5128d7cfae5adf425653b5f5c0c311e43fac7e88f51c049f887a147c687e9f37e0a3624597eeddb58defd287711a21bc4d25e
|
@@ -5,8 +5,10 @@ require 'freshchat_whatsapp/actions/check_message_status'
|
|
5
5
|
|
6
6
|
module FreshchatWhatsapp
|
7
7
|
class Api
|
8
|
-
def initialize
|
9
|
-
|
8
|
+
def initialize(base_path=nil,token=nil)
|
9
|
+
fresh_chat_base_path = base_path || FreshchatWhatsapp.configuration.base_path
|
10
|
+
@base_path = fresh_chat_base_path
|
11
|
+
@token = token
|
10
12
|
end
|
11
13
|
|
12
14
|
def send_hsm_message(from_number, to_number, namespace, template_name, language, params)
|
@@ -33,7 +35,7 @@ module FreshchatWhatsapp
|
|
33
35
|
attr_reader :base_path
|
34
36
|
|
35
37
|
def client
|
36
|
-
@client = FreshchatWhatsapp::Client.new
|
38
|
+
@client = FreshchatWhatsapp::Client.new(@base_path, @token)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module FreshchatWhatsapp
|
4
4
|
class Client
|
5
|
-
def initialize(
|
6
|
-
@base_path = FreshchatWhatsapp.configuration.base_path
|
7
|
-
@token = FreshchatWhatsapp.configuration.api_key
|
5
|
+
def initialize(base_path=nil, token=nil, batoken_type = :bearer)
|
6
|
+
@base_path = base_path || FreshchatWhatsapp.configuration.base_path
|
7
|
+
@token = token || FreshchatWhatsapp.configuration.api_key
|
8
8
|
@token_type = token_type
|
9
9
|
end
|
10
10
|
|
@@ -12,11 +12,6 @@ module FreshchatWhatsapp
|
|
12
12
|
full_path = "#{base_path}#{path}"
|
13
13
|
conn = Faraday.new(url: full_path, headers: headers)
|
14
14
|
response = conn.post { |request| request.body = body(payload) }
|
15
|
-
|
16
|
-
unless response.success?
|
17
|
-
raise FreshchatWhatsapp::Errors::RequestError.new('FreshchatWhatsapp API request error.', response.body)
|
18
|
-
end
|
19
|
-
|
20
15
|
JSON.parse(response.body)
|
21
16
|
end
|
22
17
|
|
@@ -24,11 +19,6 @@ module FreshchatWhatsapp
|
|
24
19
|
full_path = "#{base_path}#{path}"
|
25
20
|
conn = Faraday.new(url: full_path, headers: headers)
|
26
21
|
response = conn.get { |request| request.body = body(payload) }
|
27
|
-
|
28
|
-
unless response.success?
|
29
|
-
raise FreshchatWhatsapp::Errors::RequestError.new('FreshchatWhatsapp API request error.', response.body)
|
30
|
-
end
|
31
|
-
|
32
22
|
JSON.parse(response.body)
|
33
23
|
end
|
34
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freshchat_whatsapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvind Vyas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|