ee_e_business_register 0.3.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: 19fcfcfebdc8ee468082d775697e5ad1813cadf6165bf7fe6b6c77a75a9f4d13
4
+ data.tar.gz: 3da6375585851f412fe18216fda7aae2d925cd198a9b12c4a02bc0bf2d5f5a72
5
+ SHA512:
6
+ metadata.gz: 0b548ee045fa8bb892abc34a68bd0e4f1919a7573fe7fc6b1f32831008751dddaec2c8e4ddece612a77c2edb00e00727f9e58c72186d86b654eecdc8704220f8
7
+ data.tar.gz: 72207a5f26c7445a26a9716242142200ecb7a3f7da76c41c08de3b5daccdf3d697bd1fb86c4da184ee3721c66eb36e3dd73e62427ed9a90c4e1547f6734357aa
@@ -0,0 +1,8 @@
1
+ # Estonian e-Business Register API Credentials
2
+ #
3
+ # Copy this file to ~/.ee_business_register_credentials.yml and fill in your credentials
4
+ # You can obtain credentials by signing an agreement with the Registers and Information Systems Center
5
+ # Visit: https://www.rik.ee/en/e-business-register/open-data-api
6
+ #
7
+ username: your_username_here
8
+ password: your_password_here
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,93 @@
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
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - Enhanced documentation with comprehensive examples and walkthroughs
12
+ - Professional polish for production-ready release
13
+ - Improved demo application navigation and UX
14
+ - Additional gemspec metadata for better RubyGems integration
15
+
16
+ ### Changed
17
+ - Polished all code comments and documentation strings for clarity
18
+ - Reviewed and improved all example code in documentation
19
+ - Enhanced error messages for better user experience
20
+
21
+ ## [0.2.0] - 2024-12-XX
22
+
23
+ ### Added
24
+ - Beneficial owners endpoint support (`get_beneficial_owners`)
25
+ - Comprehensive model classes for all data types
26
+ - Enhanced error handling with specific exception types
27
+ - Complete demo application with all endpoints
28
+ - Professional UI/UX for demo application
29
+ - Extensive documentation with real-world examples
30
+
31
+ ### Changed
32
+ - Updated API operation mappings to current Estonian API version
33
+ - Improved data parsing and model conversion
34
+ - Enhanced client retry logic and timeout handling
35
+ - Deprecated company name search functionality (API limitation)
36
+
37
+ ### Deprecated
38
+ - `search_companies` method - Estonian API removed name search capability
39
+ - `find_companies_like` method - functionality no longer available
40
+
41
+ ### Fixed
42
+ - Registry code validation and normalization
43
+ - Date parsing and type conversion issues
44
+ - SOAP response parsing edge cases
45
+ - Model initialization with nil values
46
+ - Demo application navigation and routing
47
+
48
+ ### Security
49
+ - Input sanitization for all user-provided data
50
+ - Prevention of XML/SOAP injection attacks
51
+ - Validation of Estonian registry codes and personal codes
52
+
53
+ ## [0.1.0] - 2025-08-27
54
+
55
+ ### Added
56
+ - Initial release of the Estonian e-Business Register API client
57
+ - Basic company lookup functionality
58
+ - SOAP client with authentication
59
+ - Core data models (Company, Address)
60
+ - Configuration system
61
+ - Basic error handling
62
+ - Unit tests and integration tests
63
+ - Demo application framework
64
+
65
+ ### Features
66
+ - Find companies by registry code
67
+ - Get company details and documents
68
+ - Access annual reports
69
+ - Retrieve classifiers and reference data
70
+ - Health check endpoint
71
+ - Type-safe data models with dry-struct
72
+ - Bilingual support (Estonian/English)
73
+
74
+ ---
75
+
76
+ ## Contributing
77
+
78
+ When making changes, please:
79
+
80
+ 1. Add entries to the `[Unreleased]` section
81
+ 2. Use the following categories: Added, Changed, Deprecated, Removed, Fixed, Security
82
+ 3. Follow the format: `- Description of change (#PR-number)`
83
+ 4. Move entries to a new version section when releasing
84
+
85
+ ## Release Process
86
+
87
+ 1. Update the version number in `lib/ee_e_business_register/version.rb`
88
+ 2. Move unreleased changes to a new version section in this changelog
89
+ 3. Update the date for the new version
90
+ 4. Create a git tag with the version number
91
+ 5. Build and publish the gem to RubyGems
92
+
93
+ For more details, see the [Contributing Guidelines](CONTRIBUTING.md).
@@ -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 Angelos Kapsimanis
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.
data/Makefile ADDED
@@ -0,0 +1,392 @@
1
+ # Estonian e-Business Register Ruby Gem Makefile
2
+ # Professional FinTech-grade automation for development workflow
3
+ #
4
+ # This Makefile provides a complete development and deployment workflow for the
5
+ # Estonian e-Business Register Ruby gem, including testing with API rate limiting,
6
+ # version management, building, and publishing to RubyGems.
7
+ #
8
+ # Key features:
9
+ # - API throttling for Estonian registry (1-second delays)
10
+ # - Comprehensive testing suite (unit + integration)
11
+ # - Automated version management with semantic versioning
12
+ # - Safe publishing workflow with confirmations
13
+ # - Code quality enforcement with RuboCop
14
+ # - Git integration for tagging and releases
15
+ #
16
+ # Usage:
17
+ # make help - Show available commands
18
+ # make test - Run all tests with API throttling
19
+ # make build - Build the gem package
20
+ # make demo - Build gem and launch Sinatra demo app
21
+ # make version-up - Increment version number
22
+ # make publish - Publish to RubyGems.org
23
+ # make release - Complete release workflow
24
+
25
+ # Ensure all targets are treated as commands, not files
26
+ # This prevents make from looking for files with these names
27
+ .PHONY: help test test-unit test-integration build clean install version-up publish lint format demo
28
+
29
+ # Terminal color codes for professional output formatting
30
+ # These make the output more readable and user-friendly
31
+ GREEN = \033[0;32m # Success messages
32
+ YELLOW = \033[0;33m # Warning messages
33
+ RED = \033[0;31m # Error messages
34
+ BLUE = \033[0;34m # Info messages
35
+ NC = \033[0m # No Color (reset)
36
+
37
+ # Configuration variables for the gem
38
+ # These can be easily modified if the gem structure changes
39
+ GEM_NAME = ee_e_business_register
40
+ VERSION_FILE = lib/ee_e_business_register/version.rb
41
+
42
+ #==============================================================================
43
+ # HELP AND DOCUMENTATION
44
+ #==============================================================================
45
+
46
+ # Default target - shows help when user runs 'make' without arguments
47
+ # This provides a user-friendly entry point to discover available commands
48
+ help: ## Show this help message
49
+ @echo "$(BLUE)Estonian e-Business Register Gem$(NC)"
50
+ @echo "$(BLUE)=================================$(NC)"
51
+ @echo ""
52
+ @echo "Available commands:"
53
+ # Extract all targets with ## comments and format them nicely
54
+ # This automatically generates help from the inline documentation
55
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2}'
56
+ @echo ""
57
+ @echo "$(YELLOW)Note: API tests include 1-second delays due to rate limiting$(NC)"
58
+
59
+ #==============================================================================
60
+ # TESTING COMMANDS
61
+ #==============================================================================
62
+
63
+ # Main test command - runs all tests with proper API throttling
64
+ # The Estonian e-Business Register API has rate limits, so we add delays
65
+ # between test files to avoid hitting the limits and getting blocked
66
+ # Tests include: basic company lookup, detailed company data (detailandmed_v2),
67
+ # classifiers, error handling, and comprehensive data model validation
68
+ test: ## Run all tests with API rate limiting delays
69
+ @echo "$(GREEN)Running complete test suite with API throttling...$(NC)"
70
+ # Custom test runner that loads each test file individually with delays
71
+ # This ensures we don't overwhelm the Estonian API with rapid requests
72
+ @bundle exec ruby -Ilib:test -e '\
73
+ require "minitest/autorun"; \
74
+ Dir.glob("test/**/test_*.rb").each do |file|; \
75
+ puts "Loading: #{file}"; \
76
+ require_relative file; \
77
+ sleep 1; \
78
+ end'
79
+ @echo "$(GREEN)✓ All tests completed including detailed company and documents functionality$(NC)"
80
+ @echo "$(BLUE)Detailed company data tests validate:$(NC)"
81
+ @echo " • General company information (addresses, activities, contacts)"
82
+ @echo " • Personnel data (board members, shareholders with OSAN/O roles)"
83
+ @echo " • Comprehensive business activity codes (EMTAK/NACE)"
84
+ @echo " • Estonian address system integration (ADS)"
85
+ @echo "$(BLUE)Company documents tests validate:$(NC)"
86
+ @echo " • Annual reports (PDF, XBRL, DDOC/BDOC formats)"
87
+ @echo " • Articles of association documents"
88
+ @echo " • Document filtering by type, year, and validity"
89
+ @echo " • Document metadata (size, URLs, status dates)"
90
+ @echo "$(YELLOW)Note: API integration tests require real credentials$(NC)"
91
+ @echo "$(YELLOW)Create ~/.ee_business_register_credentials.yml with username and password$(NC)"
92
+
93
+ # Unit tests only - these don't make API calls so no throttling needed
94
+ # Useful for quick feedback during development without hitting API limits
95
+ test-unit: ## Run unit tests only (no API calls)
96
+ @echo "$(GREEN)Running unit tests (excluding integration tests)...$(NC)"
97
+ # Exclude integration tests to avoid any API calls
98
+ # This gives developers fast feedback on code changes
99
+ @bundle exec ruby -Ilib:test -e '\
100
+ require "minitest/autorun"; \
101
+ Dir.glob("test/**/test_*.rb").reject { |f| f.include?("integration") }.each do |file|; \
102
+ puts "Loading: #{file}"; \
103
+ require_relative file; \
104
+ end'
105
+
106
+ # Integration tests with real API calls - requires valid credentials
107
+ # These tests actually connect to the Estonian e-Business Register
108
+ # and verify that our gem works with the real API
109
+ test-integration: ## Run integration tests with real API (requires credentials)
110
+ @echo "$(GREEN)Running integration tests with 1-second API throttling...$(NC)"
111
+ # Check if credentials file exists before attempting API tests
112
+ # This prevents confusing error messages for new developers
113
+ @if [ ! -f ~/.ee_business_register_credentials.yml ]; then \
114
+ echo "$(RED)Error: Credentials file not found at ~/.ee_business_register_credentials.yml$(NC)"; \
115
+ echo "$(YELLOW)Please create credentials file or skip integration tests$(NC)"; \
116
+ exit 1; \
117
+ fi
118
+ # Run only the integration test file with API throttling
119
+ @bundle exec ruby -Ilib:test test/integration_test.rb
120
+ @sleep 1 # Additional delay after integration tests
121
+
122
+ #==============================================================================
123
+ # BUILD AND PACKAGING
124
+ #==============================================================================
125
+
126
+ # Build the gem package from the gemspec
127
+ # This creates a .gem file that can be installed or published
128
+ build: clean ## Build the gem package
129
+ @echo "$(GREEN)Building $(GEM_NAME) gem...$(NC)"
130
+ # Use bundler's gem build command for consistency
131
+ # This ensures all dependencies and configurations are respected
132
+ @bundle exec gem build $(GEM_NAME).gemspec
133
+ @echo "$(GREEN)✓ Gem built successfully$(NC)"
134
+ # Show the built gem file(s) for verification
135
+ @ls -la *.gem 2>/dev/null || echo "$(RED)No gem file found$(NC)"
136
+
137
+ # Clean up build artifacts to ensure fresh builds
138
+ # Important for avoiding conflicts between different versions
139
+ clean: ## Clean built artifacts
140
+ @echo "$(GREEN)Cleaning build artifacts...$(NC)"
141
+ # Remove gem files and packaging directories
142
+ @rm -f *.gem
143
+ @rm -rf pkg/
144
+ @echo "$(GREEN)✓ Clean complete$(NC)"
145
+
146
+ # Install the gem locally for testing
147
+ # Useful for testing the gem in local Ruby environment
148
+ install: build ## Install the gem locally
149
+ @echo "$(GREEN)Installing $(GEM_NAME) locally...$(NC)"
150
+ # Install the most recently built gem file
151
+ @gem install *.gem
152
+ @echo "$(GREEN)✓ Gem installed locally$(NC)"
153
+
154
+ #==============================================================================
155
+ # VERSION MANAGEMENT
156
+ #==============================================================================
157
+
158
+ # Display current version from the version file
159
+ # Useful for checking version before releases
160
+ version: ## Show current version
161
+ @echo "$(GREEN)Current version:$(NC)"
162
+ # Extract version string from VERSION constant in Ruby file
163
+ @grep VERSION $(VERSION_FILE) | cut -d'"' -f2
164
+
165
+ # Increment patch version (x.y.z -> x.y.z+1)
166
+ # Use this for bug fixes and minor updates
167
+ version-up: ## Increment patch version (x.y.z -> x.y.z+1)
168
+ @echo "$(GREEN)Incrementing patch version...$(NC)"
169
+ # Use Ruby to safely modify the version file
170
+ # This handles the version format correctly and atomically
171
+ @ruby -i -pe '\
172
+ if /VERSION = "(\d+)\.(\d+)\.(\d+)"/ then \
173
+ gsub(/VERSION = "(\d+)\.(\d+)\.(\d+)"/, "VERSION = \"#{$$1}.#{$$2}.#{$$3.to_i + 1}\"") \
174
+ end' $(VERSION_FILE)
175
+ @echo "$(GREEN)✓ Version updated to:$(NC) $$(make version)"
176
+ @echo "$(YELLOW)Don't forget to commit the version change!$(NC)"
177
+
178
+ # Increment minor version (x.y.z -> x.y+1.0)
179
+ # Use this for new features that are backward compatible
180
+ version-up-minor: ## Increment minor version (x.y.z -> x.y+1.0)
181
+ @echo "$(GREEN)Incrementing minor version...$(NC)"
182
+ # Reset patch version to 0 when incrementing minor
183
+ @ruby -i -pe '\
184
+ if /VERSION = "(\d+)\.(\d+)\.(\d+)"/ then \
185
+ gsub(/VERSION = "(\d+)\.(\d+)\.(\d+)"/, "VERSION = \"#{$$1}.#{$$2.to_i + 1}.0\"") \
186
+ end' $(VERSION_FILE)
187
+ @echo "$(GREEN)✓ Version updated to:$(NC) $$(make version)"
188
+ @echo "$(YELLOW)Don't forget to commit the version change!$(NC)"
189
+
190
+ # Increment major version (x.y.z -> x+1.0.0)
191
+ # Use this for breaking changes or major new features
192
+ version-up-major: ## Increment major version (x.y.z -> x+1.0.0)
193
+ @echo "$(GREEN)Incrementing major version...$(NC)"
194
+ # Reset minor and patch versions to 0 when incrementing major
195
+ @ruby -i -pe '\
196
+ if /VERSION = "(\d+)\.(\d+)\.(\d+)"/ then \
197
+ gsub(/VERSION = "(\d+)\.(\d+)\.(\d+)"/, "VERSION = \"#{$$1.to_i + 1}.0.0\"") \
198
+ end' $(VERSION_FILE)
199
+ @echo "$(GREEN)✓ Version updated to:$(NC) $$(make version)"
200
+ @echo "$(YELLOW)Don't forget to commit the version change!$(NC)"
201
+
202
+ #==============================================================================
203
+ # PUBLISHING TO RUBYGEMS
204
+ #==============================================================================
205
+
206
+ # Publish gem to RubyGems.org - this is irreversible!
207
+ # Includes safety confirmation to prevent accidental publishing
208
+ publish: build ## Publish gem to RubyGems.org
209
+ @echo "$(GREEN)Publishing $(GEM_NAME) to RubyGems.org...$(NC)"
210
+ @echo "$(YELLOW)Current version: $$(make version)$(NC)"
211
+ @echo "$(YELLOW)Are you sure you want to publish? This cannot be undone.$(NC)"
212
+ # Interactive confirmation to prevent accidental publishing
213
+ # Publishing to RubyGems is permanent and cannot be reverted
214
+ @read -p "Type 'yes' to confirm: " confirm; \
215
+ if [ "$$confirm" = "yes" ]; then \
216
+ gem push *.gem && \
217
+ echo "$(GREEN)✓ Gem published successfully!$(NC)" && \
218
+ echo "$(BLUE)View at: https://rubygems.org/gems/$(GEM_NAME)$(NC)"; \
219
+ else \
220
+ echo "$(YELLOW)Publish cancelled$(NC)"; \
221
+ fi
222
+
223
+ # Dry run for publishing - test the process without actually publishing
224
+ # Useful for validating that everything is ready for publication
225
+ publish-dry-run: build ## Simulate publishing (safe test)
226
+ @echo "$(GREEN)Dry run: simulating gem publish...$(NC)"
227
+ @echo "$(YELLOW)Version: $$(make version)$(NC)"
228
+ @echo "$(YELLOW)Gem file: $$(ls *.gem)$(NC)"
229
+ @echo "$(GREEN)✓ Ready to publish (use 'make publish' to actually publish)$(NC)"
230
+
231
+ #==============================================================================
232
+ # CODE QUALITY AND LINTING
233
+ #==============================================================================
234
+
235
+ # Run RuboCop static code analysis
236
+ # Ensures code follows Ruby community standards
237
+ lint: ## Run RuboCop linter
238
+ @echo "$(GREEN)Running RuboCop linter...$(NC)"
239
+ # Check both lib and test directories for style issues
240
+ # Simple format provides clean, readable output
241
+ @bundle exec rubocop lib/ test/ --format simple
242
+ @echo "$(GREEN)✓ Linting complete$(NC)"
243
+
244
+ # Auto-fix RuboCop violations where possible
245
+ # Saves developer time by automatically fixing simple style issues
246
+ lint-fix: ## Run RuboCop with auto-correct
247
+ @echo "$(GREEN)Running RuboCop with auto-correct...$(NC)"
248
+ # Automatically fix issues that can be safely corrected
249
+ @bundle exec rubocop lib/ test/ --auto-correct
250
+ @echo "$(GREEN)✓ Auto-corrections applied$(NC)"
251
+
252
+ # Alias for lint-fix for convenience
253
+ format: lint-fix ## Alias for lint-fix
254
+
255
+ #==============================================================================
256
+ # DEVELOPMENT HELPERS
257
+ #==============================================================================
258
+
259
+ # Install all gem dependencies
260
+ # Essential setup step for new development environments
261
+ deps: ## Install dependencies
262
+ @echo "$(GREEN)Installing dependencies...$(NC)"
263
+ # Use bundler to install all dependencies from Gemfile
264
+ @bundle install
265
+ @echo "$(GREEN)✓ Dependencies installed$(NC)"
266
+
267
+ # Update all dependencies to latest compatible versions
268
+ # Important for security updates and bug fixes
269
+ deps-update: ## Update dependencies
270
+ @echo "$(GREEN)Updating dependencies...$(NC)"
271
+ # Update all gems to latest versions within constraints
272
+ @bundle update
273
+ @echo "$(GREEN)✓ Dependencies updated$(NC)"
274
+
275
+ # Start interactive console with gem pre-loaded
276
+ # Useful for testing gem functionality interactively
277
+ console: ## Start interactive console with gem loaded
278
+ @echo "$(GREEN)Starting interactive console...$(NC)"
279
+ # Use the provided console script which loads the gem
280
+ @bundle exec bin/console
281
+
282
+ # Launch the Sinatra demo application
283
+ # Builds the gem first to ensure latest version is used in demo
284
+ demo: build ## Build gem and launch Sinatra demo app
285
+ @echo "$(GREEN)Building gem and launching Sinatra demo application...$(NC)"
286
+ @echo "$(BLUE)Starting Estonian e-Business Register API Demo$(NC)"
287
+ @echo "$(BLUE)============================================$(NC)"
288
+ # Install the freshly built gem locally for demo to use latest version
289
+ @echo "$(YELLOW)Installing latest gem version for demo...$(NC)"
290
+ @gem install *.gem --local --force > /dev/null 2>&1 || true
291
+ # Navigate to demo directory and start the Sinatra app
292
+ @echo "$(GREEN)Starting demo app at http://localhost:4567$(NC)"
293
+ @echo "$(YELLOW)Press Ctrl+C to stop the server$(NC)"
294
+ @echo ""
295
+ # Change to demo directory and run the startup script
296
+ @cd ../demo_app && ruby start.rb
297
+
298
+ #==============================================================================
299
+ # GIT INTEGRATION
300
+ #==============================================================================
301
+
302
+ # Create git tag for current version
303
+ # Important for tracking releases and enabling rollbacks
304
+ git-tag: ## Create git tag for current version
305
+ @echo "$(GREEN)Creating git tag for version $$(make version)...$(NC)"
306
+ # Create annotated tag with version message
307
+ # Annotated tags include metadata like date and author
308
+ @git tag -a "v$$(make version)" -m "Release version $$(make version)"
309
+ @echo "$(GREEN)✓ Tag created: v$$(make version)$(NC)"
310
+ @echo "$(YELLOW)Push with: git push origin v$$(make version)$(NC)"
311
+
312
+ # Push all tags to remote repository
313
+ # Makes tags available to other developers and CI/CD systems
314
+ git-push-tags: ## Push all tags to origin
315
+ @echo "$(GREEN)Pushing tags to origin...$(NC)"
316
+ # Push all local tags to the remote repository
317
+ @git push origin --tags
318
+ @echo "$(GREEN)✓ Tags pushed$(NC)"
319
+
320
+ #==============================================================================
321
+ # COMPLETE RELEASE WORKFLOW
322
+ #==============================================================================
323
+
324
+ # Complete automated release process
325
+ # Combines all release steps into a single command for convenience
326
+ release: version-up build test git-tag publish git-push-tags ## Complete release workflow
327
+ @echo "$(GREEN)🎉 Release complete!$(NC)"
328
+ @echo "$(BLUE)Version $$(make version) has been:$(NC)"
329
+ @echo " • Built and tested"
330
+ @echo " • Tagged in git"
331
+ @echo " • Published to RubyGems"
332
+ @echo " • Tags pushed to origin"
333
+
334
+ #==============================================================================
335
+ # STATUS AND DIAGNOSTICS
336
+ #==============================================================================
337
+
338
+ # Show comprehensive project status
339
+ # Useful for debugging and understanding current state
340
+ status: ## Show project status
341
+ @echo "$(BLUE)Estonian e-Business Register Gem Status$(NC)"
342
+ @echo "$(BLUE)=======================================$(NC)"
343
+ # Display current version
344
+ @echo "Version: $$(make version)"
345
+ # Count built gem files
346
+ @echo "Gem files: $$(ls *.gem 2>/dev/null | wc -l | tr -d ' ') built"
347
+ # Show git status if this is a git repository
348
+ @echo "Git status:"
349
+ @git status --porcelain || echo " (not a git repository)"
350
+ @echo ""
351
+ # Check if dependencies are satisfied
352
+ @echo "Dependencies:"
353
+ @bundle check >/dev/null 2>&1 && echo " ✓ All dependencies satisfied" || echo " ⚠ Run 'make deps' to install dependencies"
354
+ @echo ""
355
+ # Check for API credentials
356
+ @echo "Credentials:"
357
+ @[ -f ~/.ee_business_register_credentials.yml ] && echo " ✓ API credentials configured" || echo " ⚠ No credentials file found"
358
+
359
+ #==============================================================================
360
+ # SECURITY AND PERFORMANCE
361
+ #==============================================================================
362
+
363
+ # Run security audit on all dependencies
364
+ # Important for FinTech applications to identify vulnerabilities
365
+ security-audit: ## Run security audit on dependencies
366
+ @echo "$(GREEN)Running security audit...$(NC)"
367
+ # Use bundler-audit to check for known vulnerabilities
368
+ # Update the vulnerability database first
369
+ @bundle audit check --update
370
+ @echo "$(GREEN)✓ Security audit complete$(NC)"
371
+
372
+ # Generate documentation (placeholder for future implementation)
373
+ # Professional gems should include comprehensive documentation
374
+ docs: ## Generate documentation (placeholder)
375
+ @echo "$(GREEN)Generating documentation...$(NC)"
376
+ @echo "$(YELLOW)Documentation generation not yet implemented$(NC)"
377
+ @echo "$(BLUE)See README.md for current documentation$(NC)"
378
+
379
+ # Run basic performance benchmarks
380
+ # Helps identify performance regressions during development
381
+ benchmark: ## Run basic performance benchmarks
382
+ @echo "$(GREEN)Running performance benchmarks...$(NC)"
383
+ # Simple benchmark of basic operations
384
+ # Note: This will make real API calls if credentials are configured
385
+ @bundle exec ruby -Ilib -e '\
386
+ require "ee_e_business_register"; \
387
+ require "benchmark"; \
388
+ puts "Note: Benchmarks will make real API calls if credentials are configured"; \
389
+ puts "Basic configuration benchmark:"; \
390
+ Benchmark.bm do |x|; \
391
+ x.report("Config creation:") { 1000.times { EeEBusinessRegister::Configuration.new } }; \
392
+ end'