whatsapp-cloud-api-ruby 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/.rubocop.yml +82 -0
- data/CHANGELOG.md +92 -0
- data/Gemfile +21 -0
- data/README.md +735 -0
- data/Rakefile +41 -0
- data/TEMPLATE_TOOLS_GUIDE.md +121 -0
- data/WHATSAPP_24_HOUR_GUIDE.md +134 -0
- data/examples/advanced_features.rb +350 -0
- data/examples/basic_messaging.rb +137 -0
- data/examples/media_management.rb +254 -0
- data/examples/template_management.rb +391 -0
- data/lib/whatsapp_cloud_api/client.rb +317 -0
- data/lib/whatsapp_cloud_api/errors.rb +330 -0
- data/lib/whatsapp_cloud_api/resources/calls.rb +173 -0
- data/lib/whatsapp_cloud_api/resources/contacts.rb +191 -0
- data/lib/whatsapp_cloud_api/resources/conversations.rb +104 -0
- data/lib/whatsapp_cloud_api/resources/media.rb +206 -0
- data/lib/whatsapp_cloud_api/resources/messages.rb +381 -0
- data/lib/whatsapp_cloud_api/resources/phone_numbers.rb +86 -0
- data/lib/whatsapp_cloud_api/resources/templates.rb +284 -0
- data/lib/whatsapp_cloud_api/types.rb +263 -0
- data/lib/whatsapp_cloud_api/version.rb +5 -0
- data/lib/whatsapp_cloud_api.rb +69 -0
- data/scripts/.env.example +18 -0
- data/scripts/kapso_template_finder.rb +91 -0
- data/scripts/sdk_setup.rb +405 -0
- data/scripts/test.rb +60 -0
- metadata +254 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 81089457e33a693901a8f2f4871baa5b069e638b980d92d46fbb26570b21442d
|
4
|
+
data.tar.gz: c6e942f8a46974bb7611bc38fcbe2abe06dee5b89ee1e687bcc1f5ee535ebdcd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a9cb14b0ce3717d8d066ccf3364c9ed1947ba94143db06b4fc19c7b5506127197243ff8ca14fe7b110baf1ab634f6384f5d457ef946db9200c620ad054f35da
|
7
|
+
data.tar.gz: 9e8d37c9c75b0e8807a19819b187ed5d130d025ab56b1f23c6a1461186d4d216c581526a9e4ee55765eca005a7fdce4bf241f1d92a41738ecaab577ee42e24da
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# RuboCop configuration for WhatsApp Cloud API Ruby SDK
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 3.0
|
7
|
+
NewCops: enable
|
8
|
+
Exclude:
|
9
|
+
- 'vendor/**/*'
|
10
|
+
- 'bin/**/*'
|
11
|
+
- 'spec/fixtures/**/*'
|
12
|
+
|
13
|
+
# Metrics
|
14
|
+
Layout/LineLength:
|
15
|
+
Max: 120
|
16
|
+
AllowedPatterns: ['\A#']
|
17
|
+
|
18
|
+
Metrics/MethodLength:
|
19
|
+
Max: 25
|
20
|
+
Exclude:
|
21
|
+
- 'spec/**/*'
|
22
|
+
|
23
|
+
Metrics/ClassLength:
|
24
|
+
Max: 150
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*'
|
27
|
+
|
28
|
+
Metrics/BlockLength:
|
29
|
+
Max: 25
|
30
|
+
Exclude:
|
31
|
+
- 'spec/**/*'
|
32
|
+
- '*.gemspec'
|
33
|
+
- 'Rakefile'
|
34
|
+
|
35
|
+
Metrics/AbcSize:
|
36
|
+
Max: 20
|
37
|
+
Exclude:
|
38
|
+
- 'spec/**/*'
|
39
|
+
|
40
|
+
# Style
|
41
|
+
Style/Documentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/StringLiterals:
|
45
|
+
EnforcedStyle: single_quotes
|
46
|
+
|
47
|
+
Style/StringLiteralsInInterpolation:
|
48
|
+
EnforcedStyle: single_quotes
|
49
|
+
|
50
|
+
Style/FrozenStringLiteralComment:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Style/ClassAndModuleChildren:
|
54
|
+
EnforcedStyle: compact
|
55
|
+
|
56
|
+
# Layout
|
57
|
+
Layout/MultilineMethodCallIndentation:
|
58
|
+
EnforcedStyle: indented
|
59
|
+
|
60
|
+
Layout/FirstArrayElementIndentation:
|
61
|
+
EnforcedStyle: consistent
|
62
|
+
|
63
|
+
Layout/FirstHashElementIndentation:
|
64
|
+
EnforcedStyle: consistent
|
65
|
+
|
66
|
+
# Naming
|
67
|
+
Naming/FileName:
|
68
|
+
Exclude:
|
69
|
+
- 'whatsapp-cloud-api-ruby.gemspec'
|
70
|
+
|
71
|
+
# RSpec specific rules
|
72
|
+
RSpec/ExampleLength:
|
73
|
+
Max: 15
|
74
|
+
|
75
|
+
RSpec/MultipleExpectations:
|
76
|
+
Max: 5
|
77
|
+
|
78
|
+
RSpec/NestedGroups:
|
79
|
+
Max: 4
|
80
|
+
|
81
|
+
RSpec/DescribeClass:
|
82
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.0.0] - 2025-01-09
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Initial release of WhatsApp Cloud API Ruby SDK
|
13
|
+
- Complete WhatsApp Cloud API support with all message types
|
14
|
+
- Support for text, image, audio, video, document, sticker, location, and contact messages
|
15
|
+
- Interactive message support (buttons, lists, product catalogs)
|
16
|
+
- Template message creation and management
|
17
|
+
- Media upload, download, and management
|
18
|
+
- Phone number registration and verification
|
19
|
+
- Call management and permissions (via Kapso proxy)
|
20
|
+
- Conversation history and management (via Kapso proxy)
|
21
|
+
- Contact management with metadata and tagging (via Kapso proxy)
|
22
|
+
- Comprehensive error handling with categorization and retry hints
|
23
|
+
- Debug logging with configurable levels
|
24
|
+
- Automatic retry logic with exponential backoff
|
25
|
+
- Rate limiting detection and handling
|
26
|
+
- Support for both Meta Graph API and Kapso proxy
|
27
|
+
- Webhook signature verification utilities
|
28
|
+
- Extensive documentation and examples
|
29
|
+
- Test suite with VCR cassettes
|
30
|
+
- Ruby 2.7+ compatibility
|
31
|
+
|
32
|
+
### Features
|
33
|
+
|
34
|
+
#### Core Messaging
|
35
|
+
- Send text messages with URL preview support
|
36
|
+
- Send media messages (images, audio, video, documents, stickers)
|
37
|
+
- Send location and contact messages
|
38
|
+
- Send interactive button and list messages
|
39
|
+
- Send template messages with parameter substitution
|
40
|
+
- Message reactions (add/remove)
|
41
|
+
- Message read status and typing indicators
|
42
|
+
|
43
|
+
#### Media Management
|
44
|
+
- Upload media files with automatic MIME type detection
|
45
|
+
- Download media with authentication handling
|
46
|
+
- Get media metadata (size, type, SHA256)
|
47
|
+
- Delete media files
|
48
|
+
- Save media directly to files
|
49
|
+
- Support for different authentication strategies
|
50
|
+
|
51
|
+
#### Template Management
|
52
|
+
- List, create, update, and delete message templates
|
53
|
+
- Template builders for marketing, utility, and authentication templates
|
54
|
+
- Component validation and example handling
|
55
|
+
- Support for all template types (text, media, interactive)
|
56
|
+
|
57
|
+
#### Advanced Features (Kapso Proxy)
|
58
|
+
- Message history queries with filtering
|
59
|
+
- Conversation management and status updates
|
60
|
+
- Contact management with metadata and search
|
61
|
+
- Call history and management
|
62
|
+
- Analytics and reporting
|
63
|
+
- Data export/import capabilities
|
64
|
+
|
65
|
+
#### Error Handling
|
66
|
+
- Comprehensive error categorization (14+ categories)
|
67
|
+
- Intelligent retry recommendations
|
68
|
+
- Rate limiting detection with retry-after support
|
69
|
+
- Detailed error context and debugging information
|
70
|
+
- Custom error classes for different scenarios
|
71
|
+
|
72
|
+
#### Developer Experience
|
73
|
+
- Extensive documentation with code examples
|
74
|
+
- Debug logging with request/response tracing
|
75
|
+
- Configurable HTTP client with connection pooling
|
76
|
+
- Type-safe response objects
|
77
|
+
- Comprehensive test suite
|
78
|
+
- Ruby best practices and conventions
|
79
|
+
|
80
|
+
### Dependencies
|
81
|
+
- faraday (~> 2.0) - HTTP client
|
82
|
+
- faraday-multipart (~> 1.0) - Multipart form support
|
83
|
+
- mime-types (~> 3.0) - MIME type detection
|
84
|
+
- dry-validation (~> 1.10) - Input validation
|
85
|
+
|
86
|
+
### Development Dependencies
|
87
|
+
- rspec (~> 3.0) - Testing framework
|
88
|
+
- webmock (~> 3.18) - HTTP request mocking
|
89
|
+
- vcr (~> 6.0) - HTTP interaction recording
|
90
|
+
- rubocop (~> 1.50) - Code style checking
|
91
|
+
- simplecov (~> 0.22) - Code coverage
|
92
|
+
- yard (~> 0.9) - Documentation generation
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in whatsapp-cloud-api-ruby.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'rake', '~> 13.0'
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem 'rspec', '~> 3.12'
|
12
|
+
gem 'webmock', '~> 3.18'
|
13
|
+
gem 'vcr', '~> 6.1'
|
14
|
+
gem 'simplecov', '~> 0.22'
|
15
|
+
gem 'rubocop', '~> 1.50'
|
16
|
+
gem 'rubocop-rspec', '~> 2.20'
|
17
|
+
gem 'yard', '~> 0.9'
|
18
|
+
gem 'pry', '~> 0.14'
|
19
|
+
gem 'pry-byebug', '~> 3.10'
|
20
|
+
gem 'dotenv', '~> 2.8' # For loading .env files in examples
|
21
|
+
end
|