vindi-rails-integrations 0.1.1 → 0.2.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 +4 -4
- data/README.md +1 -0
- data/lib/tasks/vindi/tasks.rake +23 -0
- data/lib/vindi/integrations/diagnostics.rb +53 -0
- data/lib/vindi/integrations/version.rb +1 -1
- data/lib/vindi-rails-integrations.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dd230e91c45c3972312a8c56b152b87b6cd5160cd306456cdf3404ce90b74b9
|
|
4
|
+
data.tar.gz: 9b0cb8eec04493f2f3547c6d8a05b8b409c70ff18d42e1e9d53c99dfa781e1be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 43fabc5a71557ac8ca880d9d7be71cea5908a6c9d76b24e94d28feddc1720748a649afecd0202434c77403e11c2b8587114a3983be330162e8b72a11bc2cb915
|
|
7
|
+
data.tar.gz: b92a4cf06a918e309e842ca9de25aee365c7b477455bbdb4646d30963bf45cdfa5dfad425d4b2c9aa97403b6a5adcb5cc994b609689c3b390235918f6c4cd250
|
data/README.md
CHANGED
|
@@ -36,6 +36,7 @@ bundle exec rails generate vindi:sync User
|
|
|
36
36
|
This generates a database migration to add `vindi_customer_id` and includes the `Vindi::Synchronizable` concern into your model.
|
|
37
37
|
|
|
38
38
|
### 3. Rake Tasks
|
|
39
|
+
- **`bundle exec rake vindi:status`**: Verifies API configuration, environment, credentials (safely masked), and tests connection to Vindi.
|
|
39
40
|
- **`bundle exec rake vindi:audit model=User`**: Reconciles database records against the Vindi API to detect missing or mismatched records.
|
|
40
41
|
- **`bundle exec rake vindi:test_webhook event=bill_paid`**: Simulates sending a webhook event payload directly to your local endpoint.
|
|
41
42
|
|
data/lib/tasks/vindi/tasks.rake
CHANGED
|
@@ -19,6 +19,29 @@ namespace :vindi do
|
|
|
19
19
|
payload = build_simulated_payload(event_type)
|
|
20
20
|
send_simulated_webhook(url, token, payload)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
desc "Verify Vindi API credentials and connectivity"
|
|
24
|
+
task status: :environment do
|
|
25
|
+
results = Vindi::Integrations::Diagnostics.run
|
|
26
|
+
print_status_report(results)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def print_status_report(results)
|
|
31
|
+
puts "=== Vindi Integration Status ==="
|
|
32
|
+
puts "Environment: #{results[:environment]}"
|
|
33
|
+
puts "API URL: #{results[:api_url]}"
|
|
34
|
+
puts "API Key: #{results[:api_key]}"
|
|
35
|
+
puts "Webhook: #{results[:webhook_token]}"
|
|
36
|
+
puts "--------------------------------"
|
|
37
|
+
|
|
38
|
+
if results[:connectivity][:status] == "Connected"
|
|
39
|
+
puts "Connectivity: SUCCESS"
|
|
40
|
+
else
|
|
41
|
+
puts "Connectivity: FAILED"
|
|
42
|
+
puts "Error: #{results[:connectivity][:error]}"
|
|
43
|
+
end
|
|
44
|
+
puts "================================"
|
|
22
45
|
end
|
|
23
46
|
|
|
24
47
|
def audit_records(klass)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Vindi
|
|
4
|
+
module Integrations
|
|
5
|
+
class Diagnostics
|
|
6
|
+
def self.run
|
|
7
|
+
new.run
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def run
|
|
11
|
+
{
|
|
12
|
+
api_url: api_url,
|
|
13
|
+
environment: environment_type,
|
|
14
|
+
api_key: masked_api_key,
|
|
15
|
+
webhook_token: masked_webhook_token,
|
|
16
|
+
connectivity: test_connectivity
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def api_url
|
|
23
|
+
Vindi.configuration.api_url
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def environment_type
|
|
27
|
+
api_url.to_s.include?("sandbox") ? "Sandbox" : "Production"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def masked_api_key
|
|
31
|
+
mask(Vindi.configuration.api_key)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def masked_webhook_token
|
|
35
|
+
mask(ENV["VINDI_WEBHOOK_TOKEN"])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def mask(secret)
|
|
39
|
+
return "Not configured" if secret.nil? || secret.empty?
|
|
40
|
+
return "*****" if secret.length <= 4
|
|
41
|
+
|
|
42
|
+
"*****#{secret[-4..-1]}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_connectivity
|
|
46
|
+
Vindi::Customer.list(page: 1, per_page: 1)
|
|
47
|
+
{ status: "Connected", error: nil }
|
|
48
|
+
rescue StandardError => e
|
|
49
|
+
{ status: "Failed", error: e.message }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "vindi"
|
|
4
4
|
require_relative "vindi/integrations/version"
|
|
5
|
+
require_relative "vindi/integrations/diagnostics"
|
|
5
6
|
require_relative "vindi/integrations/railtie" if defined?(Rails)
|
|
6
7
|
require_relative "vindi/integrations/concerns/synchronizable" if defined?(ActiveRecord)
|
|
7
8
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vindi-rails-integrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wesley Lima
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: vindi-rails
|
|
@@ -153,6 +153,7 @@ files:
|
|
|
153
153
|
- lib/tasks/vindi/tasks.rake
|
|
154
154
|
- lib/vindi-rails-integrations.rb
|
|
155
155
|
- lib/vindi/integrations/concerns/synchronizable.rb
|
|
156
|
+
- lib/vindi/integrations/diagnostics.rb
|
|
156
157
|
- lib/vindi/integrations/railtie.rb
|
|
157
158
|
- lib/vindi/integrations/version.rb
|
|
158
159
|
homepage: https://github.com/wesleyskap/vindi-rails-integrations
|