whatsapp_notifier 0.7.0 → 0.8.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/lib/generators/whatsapp_notifier/install_service_generator.rb +2 -0
- data/lib/whatsapp_notifier/client.rb +12 -0
- data/lib/whatsapp_notifier/providers/web_automation.rb +33 -0
- data/lib/whatsapp_notifier/services/web_automation/history.test.ts +695 -0
- data/lib/whatsapp_notifier/services/web_automation/history.ts +323 -0
- data/lib/whatsapp_notifier/services/web_automation/inbound.test.ts +209 -2
- data/lib/whatsapp_notifier/services/web_automation/inbound.ts +138 -16
- data/lib/whatsapp_notifier/services/web_automation/index.ts +81 -12
- data/lib/whatsapp_notifier/services/web_automation/media.test.ts +175 -9
- data/lib/whatsapp_notifier/services/web_automation/media.ts +94 -4
- data/lib/whatsapp_notifier/services/web_automation/send.test.ts +20 -0
- data/lib/whatsapp_notifier/services/web_automation/send.ts +17 -0
- data/lib/whatsapp_notifier/version.rb +1 -1
- data/lib/whatsapp_notifier/web_adapter.rb +85 -5
- data/lib/whatsapp_notifier.rb +12 -0
- data/spec/client_spec.rb +28 -1
- data/spec/generators/install_service_generator_spec.rb +1 -1
- data/spec/providers/web_automation_spec.rb +61 -3
- data/spec/web_adapter_spec.rb +232 -1
- data/spec/whatsapp_notifier_spec.rb +27 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e65ad0d6844d9762bccd0a929a9d70613a0e9fb145564b75c35f196fc87e4088
|
|
4
|
+
data.tar.gz: 109a415b4a618aac44d5ce9da4f886590a600e8bdb9168ada01e740e9b5add9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45cbd20b37120dd2b533db5fa28b31dddbbbb00a06538c5a8c75cccd458d2f598c9d2089b898ed890b8cb88693613849d8ca036743d96bbba0d482cf121c70b4
|
|
7
|
+
data.tar.gz: e63080fe514ff18d3f225baebeefef3856b10f83d80087c7c7a33e3b50cc5a150cdc4a964646520a5f866685c13dd08c14f0a8888bed93fc2df5403676eab93a
|
|
@@ -39,6 +39,18 @@ module WhatsAppNotifier
|
|
|
39
39
|
provider_for(provider || @configuration.provider).delete_media(message_id: message_id, metadata: metadata)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def refetch_media(message_id:, chat_id:, metadata: {}, provider: nil)
|
|
43
|
+
provider_for(provider || @configuration.provider).refetch_media(message_id: message_id, chat_id: chat_id, metadata: metadata)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def list_chats(metadata: {}, provider: nil)
|
|
47
|
+
provider_for(provider || @configuration.provider).list_chats(metadata: metadata)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def fetch_history(chat_id:, limit: 50, metadata: {}, provider: nil)
|
|
51
|
+
provider_for(provider || @configuration.provider).fetch_history(chat_id: chat_id, limit: limit, metadata: metadata)
|
|
52
|
+
end
|
|
53
|
+
|
|
42
54
|
def logout(metadata: {}, provider: nil)
|
|
43
55
|
provider_for(provider || @configuration.provider).logout(metadata: metadata)
|
|
44
56
|
end
|
|
@@ -82,6 +82,39 @@ module WhatsAppNotifier
|
|
|
82
82
|
adapter.delete_media(message_id: message_id, metadata: metadata)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
# On-demand media re-download (added in v0.8.0) — same guard idiom as
|
|
86
|
+
# fetch_media so older adapters fail with a clear ConfigurationError
|
|
87
|
+
# rather than NoMethodError.
|
|
88
|
+
def refetch_media(message_id:, chat_id:, metadata: {})
|
|
89
|
+
raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
|
|
90
|
+
|
|
91
|
+
adapter = configuration.web_adapter
|
|
92
|
+
raise ConfigurationError, "web_adapter does not support media refetch (upgrade to a refetch_media-capable adapter)" unless adapter.respond_to?(:refetch_media)
|
|
93
|
+
|
|
94
|
+
adapter.refetch_media(message_id: message_id, chat_id: chat_id, metadata: metadata)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Chat-history helpers are optional adapter capabilities (added in
|
|
98
|
+
# v0.8.0) — same guard idiom as fetch_media so older adapters fail with
|
|
99
|
+
# a clear ConfigurationError rather than NoMethodError.
|
|
100
|
+
def list_chats(metadata: {})
|
|
101
|
+
raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
|
|
102
|
+
|
|
103
|
+
adapter = configuration.web_adapter
|
|
104
|
+
raise ConfigurationError, "web_adapter does not support chat listing (upgrade to a list_chats-capable adapter)" unless adapter.respond_to?(:list_chats)
|
|
105
|
+
|
|
106
|
+
adapter.list_chats(metadata: metadata)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def fetch_history(chat_id:, limit: 50, metadata: {})
|
|
110
|
+
raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
|
|
111
|
+
|
|
112
|
+
adapter = configuration.web_adapter
|
|
113
|
+
raise ConfigurationError, "web_adapter does not support history replay (upgrade to a fetch_history-capable adapter)" unless adapter.respond_to?(:fetch_history)
|
|
114
|
+
|
|
115
|
+
adapter.fetch_history(chat_id: chat_id, limit: limit, metadata: metadata)
|
|
116
|
+
end
|
|
117
|
+
|
|
85
118
|
def logout(metadata: {})
|
|
86
119
|
raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
|
|
87
120
|
|