patch_retention 0.1.5 → 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/.env.development +5 -0
- data/.env.example +5 -0
- data/.env.test.example +5 -0
- data/.rubocop.yml +33 -21
- data/.ruby-version +1 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +20 -0
- data/CLAUDE.md +248 -0
- data/DEPENDENCY_UPDATE_REPORT.md +89 -0
- data/Gemfile +0 -12
- data/Gemfile.lock +44 -12
- data/README.md +189 -3
- data/Rakefile +1 -1
- data/docs/decisions/001-api-implementation.md +66 -0
- data/docs/patterns/testing-patterns.md +152 -0
- data/docs/references/github-actions.md +100 -0
- data/docs/references/troubleshooting.md +122 -0
- data/docs/wip/session-2025-05-26.md +66 -0
- data/lib/patch_retention/configuration.rb +1 -1
- data/lib/patch_retention/contacts.rb +1 -1
- data/lib/patch_retention/events/create.rb +1 -1
- data/lib/patch_retention/events.rb +1 -1
- data/lib/patch_retention/memberships.rb +59 -0
- data/lib/patch_retention/products.rb +62 -0
- data/lib/patch_retention/util.rb +2 -2
- data/lib/patch_retention/version.rb +1 -1
- data/lib/patch_retention.rb +4 -4
- data/patch_retention.gemspec +56 -0
- data/script/setup_test_env +44 -0
- metadata +219 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e16f62b32c1b6105c7635ba9f00ccd20ccb7e59f131ab035ff9033a96224547
|
4
|
+
data.tar.gz: e251e05872d84438356695555fc6ae4ec56949e574e83306389f7de03ab2a310
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ca9e71b4a393356b22e8d680cd8a25f95a1cc901de1cdd6a9fdeaebe7a33ae9183af2b76f883058614b5cbd2b3fff97c8a0ef243651e5ebbe20468fae98374
|
7
|
+
data.tar.gz: ef2307ff81839c5343c98e7f03eb7e6c39e77df272524358327fbe7b13b216f7fa7d6b6dd8b834e211a058c7d793c3e1c7cccaa683333cf33a086d95fe5ee701
|
data/.env.development
ADDED
data/.env.example
ADDED
data/.env.test.example
ADDED
data/.rubocop.yml
CHANGED
@@ -1,28 +1,40 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
TargetRubyVersion: 3.1
|
3
|
+
NewCops: enable
|
4
|
+
Exclude:
|
5
|
+
- 'bin/**/*'
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'spec/fixtures/**/*'
|
8
|
+
- 'tmp/**/*'
|
9
|
+
- 'pkg/**/*'
|
10
|
+
|
11
|
+
inherit_gem:
|
12
|
+
rubocop-shopify: rubocop.yml
|
13
|
+
|
14
|
+
# Gem specific overrides
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Exclude:
|
17
|
+
- 'spec/**/*'
|
18
|
+
- '*.gemspec'
|
19
|
+
|
20
|
+
# Allow longer lines in specs for readability
|
21
|
+
Layout/LineLength:
|
22
|
+
Max: 120
|
23
|
+
Exclude:
|
24
|
+
- 'spec/**/*'
|
7
25
|
|
8
|
-
|
9
|
-
|
10
|
-
|
26
|
+
# Documentation is good but not required for all classes in a gem
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
11
29
|
|
30
|
+
# Allow compact module/class definitions for simple cases
|
12
31
|
Style/ClassAndModuleChildren:
|
13
|
-
EnforcedStyle: compact
|
14
|
-
|
15
|
-
Metrics/MethodLength:
|
16
|
-
Max: 30
|
17
|
-
|
18
|
-
Style/ModuleFunction:
|
19
32
|
Enabled: false
|
20
33
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Layout/LineLength:
|
25
|
-
Max: 120
|
34
|
+
# String literals
|
35
|
+
Style/StringLiterals:
|
36
|
+
EnforcedStyle: double_quotes
|
26
37
|
|
27
|
-
|
28
|
-
|
38
|
+
# Frozen string literal
|
39
|
+
Style/FrozenStringLiteralComment:
|
40
|
+
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.6
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.1.6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2025-05-26
|
4
|
+
|
5
|
+
### Added
|
6
|
+
- Products API support with create, update, and find methods
|
7
|
+
- Memberships API support with create, update, and find methods
|
8
|
+
- Dotenv integration for environment variable management in development/test
|
9
|
+
- GitHub Actions CI/CD workflows for automated testing and releases
|
10
|
+
- Rubocop integration with Shopify style guide for code consistency
|
11
|
+
- Ruby 3.1+ requirement (minimum Ruby version)
|
12
|
+
- Comprehensive RSpec test coverage with VCR for API recording
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Updated all existing code to comply with Shopify's Rubocop style guide
|
16
|
+
- Enhanced documentation with detailed usage examples for new endpoints
|
17
|
+
- Improved test configuration with environment variable support
|
18
|
+
|
19
|
+
### Security
|
20
|
+
- Fixed rexml vulnerability by requiring version >= 3.3.9
|
21
|
+
- Removed test credentials from repository, using .env.test.example instead
|
22
|
+
|
3
23
|
### [0.1.3] - 2024-02-05
|
4
24
|
|
5
25
|
- Support proxying to a different host
|
data/CLAUDE.md
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
# Patch Retention Ruby Gem - Development Guidelines
|
2
|
+
|
3
|
+
## Project Overview
|
4
|
+
This is a Ruby gem that provides a wrapper for the Patch Retention API. The gem follows Ruby best practices and uses Zeitwerk for autoloading.
|
5
|
+
|
6
|
+
**Ruby Version**: 3.1.6 (minimum 3.1.0)
|
7
|
+
**Testing**: RSpec with VCR for HTTP request recording/playback
|
8
|
+
|
9
|
+
## About Memory
|
10
|
+
|
11
|
+
### Session Knowledge Management
|
12
|
+
- **Document discoveries**: During any session, keep files in `/docs` updated with findings and new knowledge acquired about the API, gem patterns, etc. These docs serve as institutional memory for developers and future Claude sessions
|
13
|
+
- **Decision logs**: Record architectural decisions, trade-offs made, and rationale behind implementation choices in `/docs/decisions/`
|
14
|
+
- **Pattern documentation**: When you discover or establish new patterns, document them in `/docs/patterns/` with examples and use cases
|
15
|
+
- **Gotcha tracking**: Maintain a running list of common pitfalls, edge cases, and their solutions in `/docs/references/troubleshooting.md`
|
16
|
+
|
17
|
+
### Cross-Session Continuity
|
18
|
+
- **Context anchoring**: Start each session by reviewing recent documentation updates to understand what was learned previously
|
19
|
+
- **Progress tracking**: Maintain work-in-progress notes in `/docs/wip/` to help future sessions pick up where you left off
|
20
|
+
- **Code archaeology**: When working with unfamiliar code, document your understanding of its purpose, history, and dependencies
|
21
|
+
- **Test insights**: Document why certain tests exist, what they're protecting against, and any unusual testing strategies discovered
|
22
|
+
|
23
|
+
### Institutional Knowledge Capture
|
24
|
+
- **Domain expertise**: As you learn about customer retention, membership management, or event tracking patterns, capture this domain knowledge
|
25
|
+
- **Integration wisdom**: Document how the Patch Retention API works, its quirks, limitations, and best practices
|
26
|
+
- **Performance learnings**: Record performance bottlenecks discovered, optimization strategies that worked, and their impact
|
27
|
+
- **Security considerations**: Maintain notes about security patterns, API authentication, and data handling best practices
|
28
|
+
|
29
|
+
### Memory Organization Principles
|
30
|
+
- **Connect to existing knowledge**: Link new discoveries to established patterns in the gem codebase
|
31
|
+
- **Stay organized**: Use consistent file naming and directory structure in `/docs` for easy retrieval
|
32
|
+
- **Limit cognitive load**: Break complex topics into digestible chunks with clear hierarchies
|
33
|
+
- **Active reinforcement**: Reference and build upon documented knowledge in subsequent sessions
|
34
|
+
- **Version awareness**: Note which API version or gem version knowledge applies to, especially during API updates
|
35
|
+
|
36
|
+
### Knowledge Sources to Leverage
|
37
|
+
- **Code comments**: Read and contribute to inline documentation
|
38
|
+
- **Git history**: Use commit messages and PR descriptions to understand the evolution of features
|
39
|
+
- **Test suites**: Tests often reveal API behaviors and edge cases not obvious in implementation code
|
40
|
+
- **Configuration files**: Environment variables and initializers reveal API capabilities and constraints
|
41
|
+
- **External documentation**: Patch Retention API docs, Ruby gem best practices, and HTTP client documentation provide context for implementation decisions
|
42
|
+
|
43
|
+
## API Overview
|
44
|
+
Patch Retention is a customer retention platform that helps businesses manage contacts, products, memberships, and events. The API uses:
|
45
|
+
- Base URL: `https://api.patchretention.com/v2`
|
46
|
+
- Authentication: Bearer token (client_secret) with X-Account-Id header (client_id)
|
47
|
+
- Content-Type: application/json
|
48
|
+
|
49
|
+
## Key Components
|
50
|
+
|
51
|
+
### 1. Contacts
|
52
|
+
- Manages customer/contact information
|
53
|
+
- Supports CRUD operations (Create, Read, Update, Delete)
|
54
|
+
- Find or create functionality with query parameters
|
55
|
+
- Fields: first_name, last_name, email, phone, address, city, state, zip, country, company, job_title
|
56
|
+
|
57
|
+
### 2. Events
|
58
|
+
- Tracks customer activities and interactions
|
59
|
+
- Event types follow dot notation (e.g., 'order.finished')
|
60
|
+
- Supports primary key details for event linking
|
61
|
+
- Can upsert contact details when creating events
|
62
|
+
- Includes custom data payload
|
63
|
+
|
64
|
+
### 3. Products (NEW - Updated)
|
65
|
+
- Manages product catalog
|
66
|
+
- Required fields: name, price (in cents), status (PUBLISHED/UNPUBLISHED)
|
67
|
+
- Optional fields: description, membership (boolean), tags, external_id, external_data
|
68
|
+
- Returns product with unique ID (e.g., "prod_xxxxxxxxxxxxxx")
|
69
|
+
- **New methods added**:
|
70
|
+
- `update`: PATCH endpoint to modify product details
|
71
|
+
- `find`: GET endpoint to retrieve a specific product
|
72
|
+
|
73
|
+
### 4. Memberships (NEW - Updated)
|
74
|
+
- Links contacts to products with time boundaries
|
75
|
+
- Required fields: contact_id, product_id
|
76
|
+
- Optional fields: start_at, end_at (ISO8601 timestamps), external_id, external_data, tags
|
77
|
+
- Returns membership with unique ID (e.g., "mem_xxxxxxxxxxxxxx")
|
78
|
+
- **New methods added**:
|
79
|
+
- `update`: PATCH endpoint to modify membership details
|
80
|
+
- `find`: GET endpoint to retrieve a specific membership
|
81
|
+
|
82
|
+
## Code Structure
|
83
|
+
```
|
84
|
+
lib/
|
85
|
+
├── patch_retention.rb # Main module with configuration and connection
|
86
|
+
├── patch_retention/
|
87
|
+
│ ├── configuration.rb # Configuration management
|
88
|
+
│ ├── contacts.rb # Contacts API wrapper
|
89
|
+
│ ├── contacts/ # Contact sub-operations
|
90
|
+
│ │ ├── delete.rb
|
91
|
+
│ │ ├── find.rb
|
92
|
+
│ │ ├── find_or_create.rb
|
93
|
+
│ │ └── update.rb
|
94
|
+
│ ├── events.rb # Events API wrapper
|
95
|
+
│ ├── events/ # Event sub-operations
|
96
|
+
│ │ ├── create.rb
|
97
|
+
│ │ └── find.rb
|
98
|
+
│ ├── memberships.rb # NEW: Memberships API wrapper
|
99
|
+
│ ├── products.rb # NEW: Products API wrapper
|
100
|
+
│ ├── util.rb # Utility methods
|
101
|
+
│ └── version.rb # Gem version
|
102
|
+
```
|
103
|
+
|
104
|
+
## Configuration
|
105
|
+
The gem supports both global and per-call configuration:
|
106
|
+
- Global: Environment variables or configure block
|
107
|
+
- Per-call: Pass custom Configuration instance to any API method
|
108
|
+
|
109
|
+
## Error Handling
|
110
|
+
- All API methods rescue Faraday::Error and raise PatchRetention::Error
|
111
|
+
- Error messages include context about the operation
|
112
|
+
|
113
|
+
## Testing
|
114
|
+
- Run tests with: `rake spec`
|
115
|
+
- Test files located in `spec/` directory
|
116
|
+
|
117
|
+
## Development Notes
|
118
|
+
1. The gem uses Faraday for HTTP requests
|
119
|
+
2. All API responses are parsed as JSON
|
120
|
+
3. Zeitwerk handles autoloading
|
121
|
+
4. Follow Ruby conventions (snake_case for methods/variables)
|
122
|
+
5. All classes are under PatchRetention module
|
123
|
+
6. Always add a newline at the end of text files (POSIX compliance)
|
124
|
+
7. Dotenv is used for managing environment variables in development/test
|
125
|
+
|
126
|
+
## Environment Setup
|
127
|
+
|
128
|
+
### Test Credentials
|
129
|
+
Test credentials are managed securely:
|
130
|
+
- **Local Development**: Use environment variables or run `./script/setup_test_env`
|
131
|
+
- **CI/CD**: GitHub secrets are configured for `PATCH_RETENTION_TEST_CLIENT_ID` and `PATCH_RETENTION_TEST_CLIENT_SECRET`
|
132
|
+
- **Security**: Never commit credentials to the repository
|
133
|
+
|
134
|
+
### Environment Files
|
135
|
+
The gem uses dotenv for credential management:
|
136
|
+
- `.env.test` - Test credentials (gitignored - created by setup script)
|
137
|
+
- `.env.test.example` - Test environment template (committed without credentials)
|
138
|
+
- `.env.development` - Development template (committed)
|
139
|
+
- `.env.development.local` - Your local credentials (gitignored)
|
140
|
+
- `.env.example` - Example configuration
|
141
|
+
|
142
|
+
### Environment Variables
|
143
|
+
- `PATCH_RETENTION_CLIENT_ID` - Your API client ID
|
144
|
+
- `PATCH_RETENTION_CLIENT_SECRET` - Your API client secret
|
145
|
+
- `PATCH_RETENTION_API_URL` - API endpoint (optional, defaults to https://api.patchretention.com/v2)
|
146
|
+
- `PATCH_RETENTION_PROXY_URL` - Proxy URL (optional)
|
147
|
+
|
148
|
+
## TODO/Improvements
|
149
|
+
- [ ] Add response error handling for specific HTTP status codes
|
150
|
+
- [ ] Implement pagination for list operations (all contacts, all events)
|
151
|
+
- [x] Add support for GET operations on Products and Memberships (find methods added)
|
152
|
+
- [x] Add update operations for Products and Memberships (update, cancel, expire methods added)
|
153
|
+
- [ ] Add delete operations for Products and Memberships
|
154
|
+
- [ ] Implement retry logic for transient failures
|
155
|
+
- [ ] Add comprehensive test coverage for new endpoints
|
156
|
+
- [ ] Consider adding response object wrappers instead of returning raw hashes
|
157
|
+
- [ ] Add list/all methods for Products and Memberships
|
158
|
+
|
159
|
+
## Session Findings (2025-05-26)
|
160
|
+
|
161
|
+
### API Discoveries
|
162
|
+
1. **ID Formats**: API returns MongoDB-style IDs (e.g., `6833ef45...`) not prefixed formats (`prod_xxx`, `mem_xxx`)
|
163
|
+
2. **Contact IDs**: Contacts use `_id` field instead of `id` (important for membership creation)
|
164
|
+
3. **Tag Capitalization**: API automatically capitalizes all tags (e.g., "test" → "Test")
|
165
|
+
4. **External Data**: `external_data` is accepted in requests but not always returned in responses
|
166
|
+
5. **Default Values**: New memberships get `status: "PENDING"` by default
|
167
|
+
6. **Phone Numbers**: API may modify phone numbers (e.g., prepending country code)
|
168
|
+
|
169
|
+
### Testing Best Practices
|
170
|
+
1. **Debug Output**: Use `puts "DEBUG: #{result.inspect}"` in specs to debug API responses
|
171
|
+
2. **VCR Integration**: All API tests are recorded/replayed using VCR for consistent testing
|
172
|
+
3. **Flexible Assertions**: Don't rely on exact field presence, use conditional checks
|
173
|
+
4. **Custom Config Testing**: Always test that methods accept custom configuration
|
174
|
+
|
175
|
+
### Code Style
|
176
|
+
- Using Shopify's Rubocop style guide (`rubocop-shopify` gem)
|
177
|
+
- Class methods defined using `class << self` pattern
|
178
|
+
- Double quotes for strings
|
179
|
+
- Frozen string literals enabled
|
180
|
+
|
181
|
+
## Common Tasks
|
182
|
+
|
183
|
+
### Setting Up Test Environment
|
184
|
+
```bash
|
185
|
+
# Using environment variables
|
186
|
+
export PATCH_RETENTION_TEST_CLIENT_ID=your_client_id
|
187
|
+
export PATCH_RETENTION_TEST_CLIENT_SECRET=your_client_secret
|
188
|
+
./script/setup_test_env
|
189
|
+
|
190
|
+
# Or manually create .env.test
|
191
|
+
```
|
192
|
+
|
193
|
+
### Running Tests
|
194
|
+
```bash
|
195
|
+
bundle exec rake spec
|
196
|
+
```
|
197
|
+
|
198
|
+
### Running RuboCop
|
199
|
+
```bash
|
200
|
+
bundle exec rubocop # Check for issues
|
201
|
+
bundle exec rubocop -a # Auto-fix safe issues
|
202
|
+
bundle exec rubocop -A # Auto-fix all issues
|
203
|
+
```
|
204
|
+
|
205
|
+
### Debugging Failed Tests
|
206
|
+
```ruby
|
207
|
+
# Add debug output to see actual API response
|
208
|
+
it "creates something" do
|
209
|
+
result = create_something
|
210
|
+
puts "DEBUG: API Response: #{result.inspect}"
|
211
|
+
# assertions...
|
212
|
+
end
|
213
|
+
```
|
214
|
+
|
215
|
+
### Building Gem Locally
|
216
|
+
```bash
|
217
|
+
bundle exec rake build
|
218
|
+
```
|
219
|
+
|
220
|
+
### Console for Testing
|
221
|
+
```bash
|
222
|
+
bin/console
|
223
|
+
```
|
224
|
+
|
225
|
+
## Session Learnings & Best Practices
|
226
|
+
|
227
|
+
### VCR and Test Credentials
|
228
|
+
- VCR cassettes should work universally without requiring specific credentials
|
229
|
+
- Use VCR's `filter_sensitive_data` to replace actual credentials with placeholders
|
230
|
+
- Test credentials should only be available via environment variables, never hardcoded
|
231
|
+
- CI/CD should use GitHub secrets for test credentials
|
232
|
+
|
233
|
+
### CI/CD Configuration
|
234
|
+
- Keep CI workflows simple and consistent
|
235
|
+
- Use the same credential management approach across all workflows
|
236
|
+
- Add verification steps to help debug CI issues
|
237
|
+
- RuboCop compliance is enforced in CI - fix issues before pushing
|
238
|
+
|
239
|
+
### Security Best Practices
|
240
|
+
- Never commit credentials, even test ones
|
241
|
+
- Use environment variables or secure secret management
|
242
|
+
- Squash commits if credentials were accidentally exposed
|
243
|
+
- Document credential setup clearly but without revealing actual values
|
244
|
+
|
245
|
+
### Error Handling
|
246
|
+
- The `util.rb` module returns `true` on JSON parse errors - be aware of this pattern
|
247
|
+
- VCR cassettes with incomplete recordings (e.g., 401 errors) can cause test failures
|
248
|
+
- Always handle both successful and error responses in tests
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Dependency Update Report - Patch Retention Gem
|
2
|
+
|
3
|
+
## Current Ruby Version Requirement
|
4
|
+
- **Minimum**: Ruby >= 2.6.0 (as specified in gemspec)
|
5
|
+
|
6
|
+
## Outdated Dependencies Analysis
|
7
|
+
|
8
|
+
### Critical Dependencies
|
9
|
+
|
10
|
+
#### 1. **Faraday** (HTTP client)
|
11
|
+
- Current: 2.7.12
|
12
|
+
- Latest: 2.13.1
|
13
|
+
- **Recommendation**: ✅ Safe to update
|
14
|
+
- **Breaking Changes**: None
|
15
|
+
- **Benefits**: Bug fixes, performance improvements, and better HTTP/2 support
|
16
|
+
|
17
|
+
#### 2. **Zeitwerk** (Code loader)
|
18
|
+
- Current: 2.6.0
|
19
|
+
- Latest: 2.7.3
|
20
|
+
- **Recommendation**: ⚠️ Do NOT update yet
|
21
|
+
- **Breaking Changes**: Requires Ruby >= 3.2
|
22
|
+
- **Action**: Pin to `~> 2.6` in Gemfile to prevent accidental updates
|
23
|
+
|
24
|
+
### Development Dependencies
|
25
|
+
|
26
|
+
#### 3. **Byebug** (Debugger)
|
27
|
+
- Current: 11.1.3
|
28
|
+
- Latest: 12.0.0
|
29
|
+
- **Recommendation**: ⚠️ Do NOT update yet
|
30
|
+
- **Breaking Changes**: Requires Ruby >= 3.1
|
31
|
+
- **Alternative**: Consider migrating to `debug` gem (Ruby's official debugger)
|
32
|
+
|
33
|
+
#### 4. **RSpec** (Testing)
|
34
|
+
- Current: 3.12.0
|
35
|
+
- Latest: 3.13.0
|
36
|
+
- **Recommendation**: ✅ Safe to update
|
37
|
+
- **Breaking Changes**: None
|
38
|
+
- **Benefits**: Better Ruby 3.x support, improved error messages
|
39
|
+
|
40
|
+
#### 5. **RuboCop** (Linter)
|
41
|
+
- Current: 1.58.0
|
42
|
+
- Latest: 1.75.7
|
43
|
+
- **Recommendation**: ✅ Safe to update (but may introduce new cops)
|
44
|
+
- **Breaking Changes**: None, but may flag new style violations
|
45
|
+
- **Action**: Update and fix any new violations
|
46
|
+
|
47
|
+
### Other Notable Updates
|
48
|
+
- **Rake**: 13.1.0 → 13.2.1 (✅ Safe)
|
49
|
+
- **Pry**: 0.14.2 → 0.15.2 (✅ Safe)
|
50
|
+
- **JSON**: 2.7.0 → 2.12.2 (✅ Safe)
|
51
|
+
- **REXML**: 3.2.6 → 3.4.1 (✅ Safe - security fixes)
|
52
|
+
|
53
|
+
## Recommended Update Strategy
|
54
|
+
|
55
|
+
### Immediate Updates (No Breaking Changes)
|
56
|
+
```ruby
|
57
|
+
# In Gemfile:
|
58
|
+
gem "faraday", "~> 2.13"
|
59
|
+
gem "rake", "~> 13.2"
|
60
|
+
|
61
|
+
group :development do
|
62
|
+
gem "rspec", "~> 3.13"
|
63
|
+
gem "rubocop", "~> 1.75"
|
64
|
+
gem "pry", "~> 0.15"
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
### Version Pins (To Prevent Breaking Changes)
|
69
|
+
```ruby
|
70
|
+
# Add to Gemfile to maintain Ruby 2.6+ compatibility:
|
71
|
+
gem "zeitwerk", "~> 2.6" # Pin to prevent Ruby 3.2+ requirement
|
72
|
+
gem "byebug", "~> 11.1" # Pin to prevent Ruby 3.1+ requirement
|
73
|
+
```
|
74
|
+
|
75
|
+
### Migration Path for Ruby Version
|
76
|
+
To use all latest dependencies, consider:
|
77
|
+
1. Update minimum Ruby version to 3.2+ in gemspec
|
78
|
+
2. This would allow using latest Zeitwerk and Byebug
|
79
|
+
3. Consider replacing Byebug with `debug` gem (built-in for Ruby 3.1+)
|
80
|
+
|
81
|
+
## Security Considerations
|
82
|
+
- **REXML** update includes security fixes - recommend updating
|
83
|
+
- No known vulnerabilities in current versions, but staying updated is good practice
|
84
|
+
|
85
|
+
## Testing After Updates
|
86
|
+
1. Run full test suite: `bundle exec rake spec`
|
87
|
+
2. Run RuboCop: `bundle exec rubocop`
|
88
|
+
3. Test in development environment
|
89
|
+
4. Verify gem builds correctly: `bundle exec rake build`
|
data/Gemfile
CHANGED
@@ -4,15 +4,3 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in patch_retention.gemspec
|
6
6
|
gemspec
|
7
|
-
|
8
|
-
gem "rake", "~> 13.0"
|
9
|
-
|
10
|
-
gem "faraday"
|
11
|
-
gem "zeitwerk"
|
12
|
-
|
13
|
-
group :development do
|
14
|
-
gem "byebug"
|
15
|
-
gem "pry", require: true
|
16
|
-
gem "rspec", "~> 3.0"
|
17
|
-
gem "rubocop", "~> 1.21"
|
18
|
-
end
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
patch_retention (0.
|
4
|
+
patch_retention (0.2.0)
|
5
|
+
faraday (~> 2.0)
|
6
|
+
zeitwerk (~> 2.6)
|
5
7
|
|
6
8
|
GEM
|
7
9
|
remote: https://rubygems.org/
|
8
10
|
specs:
|
11
|
+
addressable (2.8.7)
|
12
|
+
public_suffix (>= 2.0.2, < 7.0)
|
9
13
|
ast (2.4.2)
|
10
14
|
base64 (0.2.0)
|
15
|
+
bigdecimal (3.1.9)
|
16
|
+
bundler-audit (0.9.2)
|
17
|
+
bundler (>= 1.2.0, < 3)
|
18
|
+
thor (~> 1.0)
|
11
19
|
byebug (11.1.3)
|
12
20
|
coderay (1.1.3)
|
21
|
+
crack (1.0.0)
|
22
|
+
bigdecimal
|
23
|
+
rexml
|
13
24
|
diff-lcs (1.5.0)
|
14
|
-
|
15
|
-
|
16
|
-
faraday-net_http (>= 2.0, < 3.
|
17
|
-
|
18
|
-
|
25
|
+
dotenv (2.8.1)
|
26
|
+
faraday (2.13.1)
|
27
|
+
faraday-net_http (>= 2.0, < 3.5)
|
28
|
+
json
|
29
|
+
logger
|
30
|
+
faraday-net_http (3.4.0)
|
31
|
+
net-http (>= 0.5.0)
|
32
|
+
hashdiff (1.2.0)
|
19
33
|
json (2.7.0)
|
20
34
|
language_server-protocol (3.17.0.3)
|
35
|
+
logger (1.7.0)
|
21
36
|
method_source (1.0.0)
|
37
|
+
net-http (0.6.0)
|
38
|
+
uri
|
22
39
|
parallel (1.23.0)
|
23
40
|
parser (3.2.2.4)
|
24
41
|
ast (~> 2.4.1)
|
@@ -26,11 +43,12 @@ GEM
|
|
26
43
|
pry (0.14.2)
|
27
44
|
coderay (~> 1.1)
|
28
45
|
method_source (~> 1.0)
|
46
|
+
public_suffix (5.1.1)
|
29
47
|
racc (1.7.3)
|
30
48
|
rainbow (3.1.1)
|
31
49
|
rake (13.1.0)
|
32
50
|
regexp_parser (2.8.2)
|
33
|
-
rexml (3.
|
51
|
+
rexml (3.4.1)
|
34
52
|
rspec (3.12.0)
|
35
53
|
rspec-core (~> 3.12.0)
|
36
54
|
rspec-expectations (~> 3.12.0)
|
@@ -57,23 +75,37 @@ GEM
|
|
57
75
|
unicode-display_width (>= 2.4.0, < 3.0)
|
58
76
|
rubocop-ast (1.30.0)
|
59
77
|
parser (>= 3.2.1.0)
|
78
|
+
rubocop-shopify (2.15.1)
|
79
|
+
rubocop (~> 1.51)
|
60
80
|
ruby-progressbar (1.13.0)
|
61
|
-
|
81
|
+
thor (1.3.2)
|
62
82
|
unicode-display_width (2.5.0)
|
63
|
-
|
83
|
+
uri (1.0.3)
|
84
|
+
vcr (6.3.1)
|
85
|
+
base64
|
86
|
+
webmock (3.25.1)
|
87
|
+
addressable (>= 2.8.0)
|
88
|
+
crack (>= 0.3.2)
|
89
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
90
|
+
zeitwerk (2.6.18)
|
64
91
|
|
65
92
|
PLATFORMS
|
66
93
|
ruby
|
67
94
|
|
68
95
|
DEPENDENCIES
|
96
|
+
bundler (~> 2.0)
|
97
|
+
bundler-audit (~> 0.9)
|
69
98
|
byebug
|
70
|
-
|
99
|
+
dotenv (~> 2.8)
|
71
100
|
patch_retention!
|
72
101
|
pry
|
73
102
|
rake (~> 13.0)
|
103
|
+
rexml (>= 3.3.9)
|
74
104
|
rspec (~> 3.0)
|
75
105
|
rubocop (~> 1.21)
|
76
|
-
|
106
|
+
rubocop-shopify (~> 2.15)
|
107
|
+
vcr (~> 6.0)
|
108
|
+
webmock (~> 3.0)
|
77
109
|
|
78
110
|
BUNDLED WITH
|
79
|
-
2.
|
111
|
+
2.6.9
|