frame_payments 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 390427c524406aa69715b0bb8edae7e13ff8a07b0744cfee4904a3ed26ab121c
4
+ data.tar.gz: 5d22279caa8be8244554acbca9bba373018fbfcf7d8c581fa06c77970f474b64
5
+ SHA512:
6
+ metadata.gz: 8d0e7eebd1b8809c134df770e8e6b5b9636fb13af58cdf68c4b37f2e5ddb82b675bfc6bfed3fe0a20f14f5260eeacee2d803ff8a1d8c8c3257add979d895bf81
7
+ data.tar.gz: 6279b04d112c2ac4ff7b2fa85f9007008f646907e7d07297431a3ea5210844305cb82cc6835ca1f98aa41c7376a26c17191ef040e5c31ff60a82fa7dbf0d7b7f
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-03-11
4
+
5
+ ### Added
6
+
7
+ #### Core Features
8
+ - Complete Ruby SDK for Frame Payments API
9
+ - Thread-safe client initialization
10
+ - Comprehensive error handling with specific error types
11
+ - SSL certificate verification (enabled by default)
12
+ - API key validation
13
+ - Configurable timeouts and connection settings
14
+ - Optional request/response logging with sensitive data redaction
15
+
16
+ #### API Resources
17
+ - **Customers**: Create, retrieve, update, delete, list, search, block, and unblock customers
18
+ - **Charge Intents**: Create, retrieve, update, list, authorize, capture, and cancel charge intents
19
+ - **Payment Methods**: Create, retrieve, update, delete, list, attach, and detach payment methods
20
+ - **Refunds**: Create, retrieve, list, and cancel refunds
21
+ - **Invoices**: Create, retrieve, update, delete, list, finalize, pay, and void invoices
22
+ - **Invoice Line Items**: Create, retrieve, update, delete, and list invoice line items
23
+ - **Subscriptions**: Create, retrieve, update, delete, list, cancel, pause, and resume subscriptions
24
+ - **Subscription Phases**: Create, retrieve, update, delete, and list subscription phases
25
+ - **Products**: Create, retrieve, update, delete, and list products
26
+ - **Product Phases**: Create, retrieve, update, delete, and list product phases
27
+ - **Webhook Endpoints**: Create, retrieve, update, delete, list, enable, and disable webhook endpoints
28
+ - **Customer Identity Verifications**: Create, retrieve, list, and verify customer identity verifications
29
+
30
+ #### Features
31
+ - Dynamic attribute access for all API response fields
32
+ - Automatic object type conversion from API responses
33
+ - Pagination support for list endpoints
34
+ - Comprehensive test suite with 100+ tests
35
+ - Full documentation with examples for all resources
36
+ - Error handling with detailed error information
37
+
38
+ ### Security
39
+ - SSL certificate verification enabled by default
40
+ - API key validation before requests
41
+ - Sensitive data redaction in logs (API keys, card numbers, etc.)
42
+ - Secure handling of authentication headers
43
+
44
+ ### Documentation
45
+ - Complete README with usage examples for all resources
46
+ - YARD-style documentation comments
47
+ - Error handling examples
48
+ - Configuration examples
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Sean Winner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,148 @@
1
+ # Production Readiness Review
2
+
3
+ ## ✅ What's Ready
4
+
5
+ 1. **Core Functionality**: All API resources implemented and tested
6
+ 2. **Test Coverage**: 100 tests, 342 assertions, all passing
7
+ 3. **Documentation**: Comprehensive README with examples for all resources
8
+ 4. **Code Organization**: Clean structure with good separation of concerns
9
+ 5. **Error Handling**: Comprehensive error types and handling
10
+ 6. **Dependencies**: Minimal, production-ready dependencies
11
+
12
+ ## 🔴 Critical Issues (Must Fix Before Release)
13
+
14
+ ### 1. SSL Verification Not Applied (SECURITY ISSUE)
15
+ **Location**: `lib/frame/frame_client.rb:50-59`
16
+
17
+ **Issue**: The `verify_ssl_certs` configuration is stored but never actually applied to the Faraday connection.
18
+
19
+ **Fix Required**:
20
+ ```ruby
21
+ def create_connection
22
+ Faraday.new(url: @config[:api_base]) do |faraday|
23
+ faraday.request :json
24
+ faraday.response :json, content_type: /\bjson$/
25
+ faraday.adapter Faraday.default_adapter
26
+
27
+ # Apply SSL verification setting
28
+ faraday.ssl.verify = @config[:verify_ssl_certs]
29
+
30
+ faraday.options.timeout = @config[:read_timeout]
31
+ faraday.options.open_timeout = @config[:open_timeout]
32
+ end
33
+ end
34
+ ```
35
+
36
+ ## ⚠️ Important Issues (Should Fix)
37
+
38
+ ### 2. Missing API Key Validation
39
+ **Issue**: No validation that API key is set before making requests.
40
+
41
+ **Recommendation**: Add validation in `FrameClient#execute_request`:
42
+ ```ruby
43
+ def execute_request(method, path, params, opts)
44
+ unless @config[:api_key]
45
+ raise AuthenticationError.new("API key is required. Set Frame.api_key before making requests.")
46
+ end
47
+ # ... rest of method
48
+ end
49
+ ```
50
+
51
+ ### 3. Logging Not Implemented
52
+ **Issue**: `log_level` and `logger` are in configuration but never used.
53
+
54
+ **Recommendation**: Either implement logging or remove from configuration. If implementing:
55
+ - Log requests/responses at appropriate levels
56
+ - Never log sensitive data (API keys, card numbers, etc.)
57
+ - Make it optional and off by default
58
+
59
+ ### 4. Missing 5xx Error Handling
60
+ **Issue**: Only handles 400, 401, 404, 429 explicitly. 500+ errors might not be handled optimally.
61
+
62
+ **Recommendation**: Ensure all error cases are covered, possibly with retry logic documentation.
63
+
64
+ ### 5. Thread Safety
65
+ **Issue**: `default_client` uses class variable `@default_client` which might not be thread-safe.
66
+
67
+ **Recommendation**: Use `Mutex` or ensure thread-safety for default client initialization.
68
+
69
+ ## 📋 Nice-to-Have Improvements
70
+
71
+ ### 6. Gemspec Metadata
72
+ - ✅ Homepage set
73
+ - ✅ Source code URI set
74
+ - ✅ Changelog URI set
75
+ - ❌ Missing: Issue tracker URI
76
+ - ❌ Missing: Documentation URI (if separate from homepage)
77
+
78
+ ### 7. CHANGELOG
79
+ - Current version is 0.1.0 with "Initial release"
80
+ - Should be updated with all the resources and features added
81
+
82
+ ### 8. Version Number
83
+ - Currently 0.1.0
84
+ - Consider if this should be 0.1.0 (initial release) or higher given the feature set
85
+
86
+ ### 9. README Improvements
87
+ - ✅ Comprehensive examples
88
+ - ✅ Error handling examples
89
+ - ❌ Could add: Installation troubleshooting
90
+ - ❌ Could add: Migration guide (if applicable)
91
+ - ❌ Could add: Common patterns/recipes
92
+
93
+ ### 10. API Key Security
94
+ - ✅ API keys stored in memory (good)
95
+ - ⚠️ Consider: Warning in documentation about not committing API keys
96
+ - ⚠️ Consider: Support for environment variables out of the box
97
+
98
+ ### 11. Response Parsing Edge Cases
99
+ - Handle malformed JSON responses gracefully
100
+ - Handle empty responses
101
+ - Handle non-JSON responses (API might return HTML error pages)
102
+
103
+ ### 12. Rate Limiting
104
+ - RateLimitError is defined but no automatic retry
105
+ - Consider: Exponential backoff utility
106
+ - Consider: Retry configuration
107
+
108
+ ## 🔍 Additional Recommendations
109
+
110
+ 1. **Add integration tests**: Current tests are unit tests with mocked responses. Consider adding optional integration tests against a sandbox.
111
+
112
+ 2. **Add request ID tracking**: Frame API might return request IDs that should be included in errors for support.
113
+
114
+ 3. **Add request/response logging**: Optional detailed logging for debugging (with sensitive data redaction).
115
+
116
+ 4. **Add webhook signature verification**: If Frame provides webhook signatures, add verification utility.
117
+
118
+ 5. **Document thread safety**: Document whether SDK is thread-safe and any limitations.
119
+
120
+ 6. **Add connection pooling**: Consider connection pooling for high-throughput scenarios.
121
+
122
+ 7. **Add telemetry**: Optional telemetry for SDK usage (with opt-in).
123
+
124
+ ## ✅ Recommended Pre-Release Checklist
125
+
126
+ - [ ] Fix SSL verification (CRITICAL)
127
+ - [ ] Add API key validation
128
+ - [ ] Implement or remove logging
129
+ - [ ] Update CHANGELOG with all features
130
+ - [ ] Review and test all error paths
131
+ - [ ] Test with actual Frame API (sandbox)
132
+ - [ ] Review gemspec metadata
133
+ - [ ] Consider version number (0.1.0 vs higher)
134
+ - [ ] Add security best practices to README
135
+ - [ ] Review thread safety
136
+ - [ ] Test in production-like environment
137
+
138
+ ## 🚀 Deployment Recommendation
139
+
140
+ **Do NOT deploy yet** - Fix the SSL verification issue first (CRITICAL security concern).
141
+
142
+ After fixing SSL verification and addressing the "Important Issues", the SDK will be ready for a **beta release (0.1.0)**.
143
+
144
+ For a **production release (1.0.0)**, also address:
145
+ - Thread safety concerns
146
+ - Logging implementation or removal
147
+ - Comprehensive error handling review
148
+ - Integration testing with real API