whatsapp_pair_client 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 +7 -0
- data/bin/whatsapp-pair +24 -0
- data/lib/whatsapp_pair_client.rb +38 -0
- metadata +39 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6a7db6054f989d740458948b2d454d4c7f62c4b5ccaac67a8642cf61c6030f08
|
|
4
|
+
data.tar.gz: 13ceff9de6b061a930f1fd2679dc6b9c4ad1467b0f7b1ef442eb70fdace1a30e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6218933f9412b6be3be8631cd97e84540c78f5b7f5d5c765fa24d8a8b33ec04cc89f91e6898598343951e656714f66f9a15ae3cf9327932abbee9ffc2fc5e031
|
|
7
|
+
data.tar.gz: 6f450794a99452eee393936878b65fc92cb8473b02d7a3dabe77c01dac615370ef8df34313af61059176f2230e8ec1421a9e9dc27eef70849c82d0e2e141d64f
|
data/bin/whatsapp-pair
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "whatsapp_pair_client"
|
|
4
|
+
|
|
5
|
+
print "Enter your WhatsApp number with country code: "
|
|
6
|
+
number = STDIN.gets.chomp
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
|
|
10
|
+
response = WhatsappPairClient.generate_pair(number)
|
|
11
|
+
|
|
12
|
+
puts "Pair Code: #{response}"
|
|
13
|
+
|
|
14
|
+
if response.include?("Already connected")
|
|
15
|
+
puts "Connected to WhatsApp success"
|
|
16
|
+
exit 0
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
WhatsappPairClient.wait_login
|
|
20
|
+
|
|
21
|
+
rescue => e
|
|
22
|
+
puts "Error: #{e.message}"
|
|
23
|
+
exit 1
|
|
24
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "uri"
|
|
3
|
+
|
|
4
|
+
module WhatsappPairClient
|
|
5
|
+
|
|
6
|
+
BASE_URL = "https://fluffy-happiness-ezl1.onrender.com"
|
|
7
|
+
|
|
8
|
+
def self.get(path)
|
|
9
|
+
uri = URI("#{BASE_URL}#{path}")
|
|
10
|
+
Net::HTTP.get(uri)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.generate_pair(number)
|
|
14
|
+
get("/generate-pair?number=#{URI.encode_www_form_component(number)}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.wait_login
|
|
18
|
+
loop do
|
|
19
|
+
status = get("/status")
|
|
20
|
+
|
|
21
|
+
puts "Status: #{status}"
|
|
22
|
+
|
|
23
|
+
if status.strip == "connected"
|
|
24
|
+
puts "Connected to WhatsApp success"
|
|
25
|
+
exit 0
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if status.downcase.include?("closed")
|
|
29
|
+
puts "Connection closed"
|
|
30
|
+
exit 1
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
puts "Waiting for login..."
|
|
34
|
+
sleep 5
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: whatsapp_pair_client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Your Name
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-09 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
executables:
|
|
13
|
+
- whatsapp-pair
|
|
14
|
+
extensions: []
|
|
15
|
+
extra_rdoc_files: []
|
|
16
|
+
files:
|
|
17
|
+
- bin/whatsapp-pair
|
|
18
|
+
- lib/whatsapp_pair_client.rb
|
|
19
|
+
licenses:
|
|
20
|
+
- MIT
|
|
21
|
+
metadata: {}
|
|
22
|
+
rdoc_options: []
|
|
23
|
+
require_paths:
|
|
24
|
+
- lib
|
|
25
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
requirements: []
|
|
36
|
+
rubygems_version: 3.6.2
|
|
37
|
+
specification_version: 4
|
|
38
|
+
summary: WhatsApp Baileys pairing API client
|
|
39
|
+
test_files: []
|