whatsapp 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d1c6365b09aa5197f2dc79fd584583f309905d645f56c07d7619724ea93482b
4
- data.tar.gz: ed07d639aedf79be73694ba18f8cc30436016faa0944ab8f1a55df0b717461e7
3
+ metadata.gz: 536440b28d75243958b82ea41651b44c34dee77dfbdeaa57ee0b6ad55b683836
4
+ data.tar.gz: 04c56ea459763511156f581ec97b3aec10dea9d482144e2fc8560b362ad4b8c3
5
5
  SHA512:
6
- metadata.gz: 914a341fd2501771a139df58bccfdfc0f2f96dda1523045ac7cd2dc5ea99e34024f7f54c149e3080355404c4bb9ded0ff4bd2c2b3a8169fa7b51c79be6544281
7
- data.tar.gz: 9653f6b4f0c5c2e78319f1764a05fcbd66c0440acda02a8eb2233a5d5c518a9590609a69a2f94073f6118c4b2cb4dd62a9c1e790c5318e3678f467089aa26586
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 = "/api/check_contacts.php"
6
+ PATH = "/v1/contacts"
7
7
 
8
- def initialize(client, numbers)
8
+ def initialize(client, contacts)
9
9
  @client = client
10
- @numbers = numbers
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, :numbers
19
+ attr_reader :client, :contacts
20
20
 
21
21
  def payload
22
22
  {
23
- payload: {
24
- blocking: "wait",
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 = "/api/rest_send.php"
6
+ PATH = "/v1/messages"
7
7
 
8
- def initialize(client, username, namespace, element_name, params)
8
+ def initialize(client, wa_id, namespace, element_name, params)
9
9
  @client = client
10
- @username = username
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, :username, :namespace, :element_name, :params
22
+ attr_reader :client, :wa_id, :namespace, :element_name, :params
23
23
 
24
24
  def payload
25
25
  {
26
- payload: {
27
- to: username,
28
- hsm: {
29
- namespace: namespace,
30
- element_name: element_name,
31
- localizable_params: params
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 = "/api/rest_send.php"
6
+ PATH = "/v1/messages"
7
7
 
8
- def initialize(client, username, body)
9
- @client = client
10
- @username = username
11
- @body = 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, :username, :body
20
+ attr_reader :client, :wa_id, :body
21
21
 
22
22
  def payload
23
23
  {
24
- payload: {
25
- to: username,
24
+ recipient_type: "individual",
25
+ to: wa_id,
26
+ type: "text",
27
+ text: {
26
28
  body: body
27
29
  }
28
30
  }
@@ -18,8 +18,8 @@ module Whats
18
18
  response = check_contacts([number])
19
19
 
20
20
  result = \
21
- response["payload"]["results"].reduce({}) do |temp, hash|
22
- temp.merge(hash["input_number"] => hash)
21
+ response["contacts"].reduce({}) do |temp, hash|
22
+ temp.merge(hash["input"] => hash)
23
23
  end
24
24
 
25
25
  result[number]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Whats
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
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.3
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-03-23 00:00:00.000000000 Z
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.3
218
+ rubygems_version: 2.7.6
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: WhatsApp Enterprise API interface.