whatsapp 0.1.3 → 0.1.4
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 +4 -4
- data/lib/whats/actions/check_contacts.rb +6 -8
- data/lib/whats/actions/send_hsm_message.rb +13 -11
- data/lib/whats/actions/send_message.rb +10 -8
- data/lib/whats/api.rb +2 -2
- data/lib/whats/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 536440b28d75243958b82ea41651b44c34dee77dfbdeaa57ee0b6ad55b683836
|
4
|
+
data.tar.gz: 04c56ea459763511156f581ec97b3aec10dea9d482144e2fc8560b362ad4b8c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d12f0270c4756b365455bbb4f418776304a6854a34ea10c02216630490b38487fed95668e35781d72d6a7119f46ee781620e7334dae71db693016ffc50b481
|
7
|
+
data.tar.gz: 5a7efdd9178548d72470e2d0a3efe96543238c0b11b6aeed0720518f5ed6f02e915b518386d1c99cb763be0b748b23ed158001dd851b635ccd15da9add5a2c5d
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module Whats
|
4
4
|
module Actions
|
5
5
|
class CheckContacts
|
6
|
-
PATH = "/
|
6
|
+
PATH = "/v1/contacts"
|
7
7
|
|
8
|
-
def initialize(client,
|
8
|
+
def initialize(client, contacts)
|
9
9
|
@client = client
|
10
|
-
@
|
10
|
+
@contacts = contacts
|
11
11
|
end
|
12
12
|
|
13
13
|
def call
|
@@ -16,14 +16,12 @@ module Whats
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
attr_reader :client, :
|
19
|
+
attr_reader :client, :contacts
|
20
20
|
|
21
21
|
def payload
|
22
22
|
{
|
23
|
-
|
24
|
-
|
25
|
-
users: numbers
|
26
|
-
}
|
23
|
+
blocking: "wait",
|
24
|
+
contacts: contacts
|
27
25
|
}
|
28
26
|
end
|
29
27
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module Whats
|
4
4
|
module Actions
|
5
5
|
class SendHsmMessage
|
6
|
-
PATH = "/
|
6
|
+
PATH = "/v1/messages"
|
7
7
|
|
8
|
-
def initialize(client,
|
8
|
+
def initialize(client, wa_id, namespace, element_name, params)
|
9
9
|
@client = client
|
10
|
-
@
|
10
|
+
@wa_id = wa_id
|
11
11
|
@namespace = namespace
|
12
12
|
@element_name = element_name
|
13
13
|
@params = params
|
@@ -19,17 +19,19 @@ module Whats
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
attr_reader :client, :
|
22
|
+
attr_reader :client, :wa_id, :namespace, :element_name, :params
|
23
23
|
|
24
24
|
def payload
|
25
25
|
{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
type: "hsm",
|
27
|
+
recipient_type: "individual",
|
28
|
+
to: wa_id,
|
29
|
+
hsm: {
|
30
|
+
namespace: namespace,
|
31
|
+
element_name: element_name,
|
32
|
+
fallback_lg: "pt",
|
33
|
+
fallback_lc: "BR",
|
34
|
+
localizable_params: params
|
33
35
|
}
|
34
36
|
}
|
35
37
|
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module Whats
|
4
4
|
module Actions
|
5
5
|
class SendMessage
|
6
|
-
PATH = "/
|
6
|
+
PATH = "/v1/messages"
|
7
7
|
|
8
|
-
def initialize(client,
|
9
|
-
@client
|
10
|
-
@
|
11
|
-
@body
|
8
|
+
def initialize(client, wa_id, body)
|
9
|
+
@client = client
|
10
|
+
@wa_id = wa_id
|
11
|
+
@body = body
|
12
12
|
end
|
13
13
|
|
14
14
|
def call
|
@@ -17,12 +17,14 @@ module Whats
|
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
|
-
attr_reader :client, :
|
20
|
+
attr_reader :client, :wa_id, :body
|
21
21
|
|
22
22
|
def payload
|
23
23
|
{
|
24
|
-
|
25
|
-
|
24
|
+
recipient_type: "individual",
|
25
|
+
to: wa_id,
|
26
|
+
type: "text",
|
27
|
+
text: {
|
26
28
|
body: body
|
27
29
|
}
|
28
30
|
}
|
data/lib/whats/api.rb
CHANGED
@@ -18,8 +18,8 @@ module Whats
|
|
18
18
|
response = check_contacts([number])
|
19
19
|
|
20
20
|
result = \
|
21
|
-
response["
|
22
|
-
temp.merge(hash["
|
21
|
+
response["contacts"].reduce({}) do |temp, hash|
|
22
|
+
temp.merge(hash["input"] => hash)
|
23
23
|
end
|
24
24
|
|
25
25
|
result[number]
|
data/lib/whats/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Soares
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.7.
|
218
|
+
rubygems_version: 2.7.6
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: WhatsApp Enterprise API interface.
|