twelvedata_ruby 0.3.0 โ†’ 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7d5d01f41fde75fae4a61796b121816c87d6d95afc4ea3126e3044b46648eb3
4
- data.tar.gz: 04cdeaf1de8e47c3728bcefdade8b18544869dbc8b4b6af8b01354ffd3e50f73
3
+ metadata.gz: 0d48874e0a6b41a6947013b9e46ca19f50a8a04fc02a2db60f62dad52c34e160
4
+ data.tar.gz: fb9aa13deefb8768935f8221162f13105d3e381a633d6a26added68c350ec4bb
5
5
  SHA512:
6
- metadata.gz: 6353eaab3d7e93d532d25990c32014c3c324ae02bff155500e05135a07f96f592cfdaf2927566b088c95d5ef7aba31ef4b87c6d5dfe1f8fa1a808d37a3c40d95
7
- data.tar.gz: 8566bd2833987cbff4f792a0b28403e7a1a3b1d963a723de6ab2b76370548f4ee6441e943d4acb299bfe1d28c3004de52e60b4ccaa032bc6f2f66f3f980dabb0
6
+ metadata.gz: 7b473022f0ca45bd6c66114b13c6e1c8df31000be0370dfa78c27826be44939a7316e68d1277c793e6401f8d83cdf45f8d184a0ee04a344cb88413972ad5549a
7
+ data.tar.gz: e1c6d1d6aeb19842e2d957e37836b84ca3b219c8bcbee54fac0726b4697d67a3d8594ba1a28296113efbe625e04495e84fb8e85aebaac641900d9ba75120d1b3
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --color
3
+ --format progress
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,102 @@
1
+ require: rubocop-rspec
2
+ plugins:
3
+ - rubocop-performance
4
+ - rubocop-rake
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 3.4
8
+ NewCops: enable
9
+ DisabledByDefault: true
10
+ Exclude:
11
+ - 'vendor/**/*'
12
+ - 'bin/**/*'
13
+ - 'tmp/**/*'
14
+
15
+ # Layout
16
+ Layout/LineLength:
17
+ Max: 120
18
+ AllowedPatterns: ['\A\s*#']
19
+
20
+ Layout/MultilineMethodCallIndentation:
21
+ EnforcedStyle: aligned
22
+
23
+ Layout/ParameterAlignment:
24
+ EnforcedStyle: with_first_parameter
25
+
26
+ Layout/ArgumentAlignment:
27
+ EnforcedStyle: with_first_argument
28
+
29
+ # Style
30
+ Style/Documentation:
31
+ Enabled: false
32
+
33
+ Style/StringLiterals:
34
+ EnforcedStyle: double_quotes
35
+
36
+ Style/StringLiteralsInInterpolation:
37
+ EnforcedStyle: double_quotes
38
+
39
+ Style/TrailingCommaInArguments:
40
+ EnforcedStyleForMultiline: comma
41
+
42
+ Style/TrailingCommaInArrayLiteral:
43
+ EnforcedStyleForMultiline: comma
44
+
45
+ Style/TrailingCommaInHashLiteral:
46
+ EnforcedStyleForMultiline: comma
47
+
48
+ Style/FrozenStringLiteralComment:
49
+ Enabled: true
50
+ EnforcedStyle: always
51
+
52
+ Style/ClassAndModuleChildren:
53
+ EnforcedStyle: nested
54
+
55
+ # Metrics
56
+ Metrics/AbcSize:
57
+ Max: 25
58
+
59
+ Metrics/CyclomaticComplexity:
60
+ Max: 10
61
+
62
+ Metrics/MethodLength:
63
+ Max: 20
64
+ CountAsOne: ['array', 'hash', 'heredoc']
65
+
66
+ Metrics/ClassLength:
67
+ Max: 400
68
+
69
+ Metrics/ModuleLength:
70
+ Max: 200
71
+
72
+ Metrics/BlockLength:
73
+ Max: 30
74
+ AllowedMethods: ['describe', 'context', 'it', 'specify']
75
+ Exclude:
76
+ - 'spec/**/*'
77
+
78
+ # Performance
79
+ Performance/StringReplacement:
80
+ Enabled: true
81
+
82
+ Performance/RedundantBlockCall:
83
+ Enabled: true
84
+
85
+ # RSpec specific
86
+ RSpec/ExampleLength:
87
+ Max: 20
88
+
89
+ RSpec/MultipleExpectations:
90
+ Max: 6
91
+
92
+ RSpec/NestedGroups:
93
+ Max: 4
94
+
95
+ RSpec/DescribeClass:
96
+ Enabled: true
97
+
98
+ RSpec/FilePath:
99
+ Enabled: true
100
+
101
+ RSpec/SpecFilePathFormat:
102
+ Enabled: true
data/.yardopts ADDED
@@ -0,0 +1,14 @@
1
+ --markup markdown
2
+ --markup-provider kramdown
3
+ --main README.md
4
+ --output-dir doc
5
+ --protected
6
+ --private
7
+ --title "TwelvedataRuby Documentation"
8
+ --readme README.md
9
+ --files CHANGELOG.md,LICENSE.txt
10
+ lib/**/*.rb
11
+ -
12
+ README.md
13
+ CHANGELOG.md
14
+ LICENSE
data/CHANGELOG.md CHANGED
@@ -1,5 +1,200 @@
1
- ## [0.2.1] - 2021-07-17
2
- - copies http response body to a temp file first if byte size is greater than 16K before parsing it from the persisted temp file
3
- ## [0.1.0] - 2021-07-05
1
+ # Changelog
4
2
 
5
- - Initial release
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
+ ## [0.4.0] - 2024-07-02
9
+
10
+ ### ๐Ÿš€ Major Refactoring Release
11
+
12
+ This release represents a refactor of the TwelvedataRuby gem with breaking changes for better maintainability and developer experience.
13
+
14
+ ### ๐Ÿ’ฅ Breaking Changes
15
+
16
+ - **Ruby Version**: Now requires Ruby 3.4.0+ (was 2.4+)
17
+ - **Dependencies**: Updated to modern versions
18
+ - `httpx` updated to `~> 1.0` (was `~> 0.14`)
19
+ - All development dependencies updated to latest versions
20
+ - **Client Interface**: Simplified client configuration API
21
+ - `TwelvedataRuby.client(**options)` now properly configures singleton instance
22
+ - Removed deprecated `options=` writer in favor of `configure(**options)`
23
+ - **Error Handling**: Completely rewritten error hierarchy
24
+ - More specific error classes for different failure scenarios
25
+ - Better error messages with context
26
+ - Proper error attributes for debugging
27
+ - **Utils Module**: Refactored utility methods
28
+ - `to_d` renamed to `to_integer` with better error handling
29
+ - Added `present?`, `blank?`, and improved helper methods
30
+ - Better nil and edge case handling
31
+
32
+ ### โœจ Added
33
+
34
+ - **Modern Ruby Support**: Full Ruby 3.0+ compatibility with modern idioms
35
+ - **Enhanced Error Classes**:
36
+ - `ConfigurationError`, `NetworkError` for specific error types
37
+ - Better inheritance hierarchy for `ResponseError` classes
38
+ - Error objects now include original exceptions and debugging context
39
+ - **Improved Response Handling**:
40
+ - Better content type detection and parsing
41
+ - Enhanced CSV handling with proper error recovery
42
+ - File operations with better error handling
43
+ - Response inspection and debugging methods
44
+ - **Better HTTP Client Integration**:
45
+ - Proper HTTPX configuration and error handling
46
+ - Support for concurrent requests
47
+ - Network timeout and connection error handling
48
+ - **Enhanced Testing**:
49
+ - 100% test coverage with comprehensive specs
50
+ - Proper HTTP request mocking with WebMock
51
+ - Shared examples and contexts for better test organization
52
+ - Edge case testing for all components
53
+ - **Development Tools**:
54
+ - RuboCop configuration with modern rules
55
+ - GitHub Actions CI/CD pipeline
56
+ - YARD documentation generation
57
+ - SimpleCov coverage reporting
58
+
59
+ ### ๐Ÿ”ง Changed
60
+
61
+ - **Client Class**: Complete rewrite
62
+ - Singleton pattern properly implemented
63
+ - Better configuration management
64
+ - Dynamic method definition with caching
65
+ - Thread-safe operation
66
+ - **Endpoint Class**: Enhanced validation and error reporting
67
+ - Better parameter validation with detailed error messages
68
+ - Improved format handling (JSON/CSV)
69
+ - More robust parameter processing
70
+ - **Request Class**: Cleaner API and better validation
71
+ - Proper delegation to endpoint
72
+ - Enhanced equality and hashing methods
73
+ - Better debugging support with `inspect` and `to_s`
74
+ - **Response Class**: Major improvements in parsing and error handling
75
+ - Robust JSON/CSV parsing with proper error recovery
76
+ - Better large file handling with temporary files
77
+ - Enhanced file operations and attachment handling
78
+ - Improved debugging and inspection methods
79
+
80
+ ### ๐Ÿ› Fixed
81
+
82
+ - **Memory Leaks**: Proper resource cleanup in response handling
83
+ - **Edge Cases**: Better handling of nil values, empty responses, malformed data
84
+ - **Concurrency**: Thread-safe singleton client implementation
85
+ - **Error Propagation**: Proper error bubbling with context preservation
86
+ - **Parameter Validation**: More accurate validation with better error messages
87
+
88
+ ### ๐Ÿ“š Documentation
89
+
90
+ - **Complete README Rewrite**: More examples and more API documentation
91
+ - **YARD Documentation**: Inline documentation for all public methods
92
+ - **Error Handling Guide**: Examples for most (if not all) error scenarios
93
+ - **Advanced Usage**: Concurrent requests, configuration options, debugging
94
+
95
+ ### ๐Ÿงช Testing
96
+
97
+ - **Comprehensive Test Suite**: 100% code coverage with RSpec
98
+ - **Proper Mocking**: WebMock integration for HTTP request stubbing
99
+ - **Edge Case Coverage**: Tests for error conditions, malformed data, network issues
100
+ - **Performance Tests**: Basic performance and memory usage validation
101
+ - **Integration Tests**: End-to-end API workflow testing
102
+
103
+ ### ๐Ÿ”„ Migration Guide
104
+
105
+ #### Updating Dependencies
106
+
107
+ ```ruby
108
+ # In your Gemfile, update the Ruby version requirement
109
+ ruby '>= 3.4.0'
110
+
111
+ # Update the gem
112
+ gem 'twelvedata_ruby', '~> 0.4.0'
113
+ ```
114
+
115
+ #### Client Configuration
116
+
117
+ ```ruby
118
+ # Before (0.3.x)
119
+ client = TwelvedataRuby.client
120
+ client.options = { apikey: "key", connect_timeout: 300 }
121
+
122
+ # After (0.4.x)
123
+ client = TwelvedataRuby.client(apikey: "key", connect_timeout: 300)
124
+ # or
125
+ client = TwelvedataRuby.client
126
+ client.configure(apikey: "key", connect_timeout: 300)
127
+ ```
128
+
129
+ #### Error Handling
130
+
131
+ ```ruby
132
+ # Before (0.3.x)
133
+ response = client.quote(symbol: "INVALID")
134
+ if response.is_a?(Hash) && response[:errors]
135
+ # handle endpoint errors
136
+ elsif response.error
137
+ # handle API errors
138
+ end
139
+
140
+ # After (0.4.x)
141
+ response = client.quote(symbol: "INVALID")
142
+ case response
143
+ when Hash
144
+ # Handle validation errors
145
+ puts response[:errors]
146
+ when TwelvedataRuby::Response
147
+ if response.error
148
+ case response.error
149
+ when TwelvedataRuby::UnauthorizedResponseError
150
+ puts "Invalid API key"
151
+ when TwelvedataRuby::NotFoundResponseError
152
+ puts "Symbol not found"
153
+ end
154
+ else
155
+ puts response.parsed_body
156
+ end
157
+ when TwelvedataRuby::NetworkError
158
+ puts "Network connectivity issue"
159
+ end
160
+ ```
161
+
162
+ #### Utils Methods
163
+
164
+ ```ruby
165
+ # Before (0.3.x)
166
+ TwelvedataRuby::Utils.to_d("123", 0)
167
+
168
+ # After (0.4.x)
169
+ TwelvedataRuby::Utils.to_integer("123", 0)
170
+ ```
171
+
172
+ ## [0.3.0] - 2021-07-15
173
+
174
+ ### Added
175
+
176
+ - Initial stable release
177
+ - Basic API endpoint support
178
+ - JSON and CSV response formats
179
+ - Simple error handling
180
+ - Ruby 2.4+ support
181
+
182
+ ### Dependencies
183
+
184
+ - `httpx ~> 0.14.5`
185
+ - Basic development dependencies
186
+
187
+ ---
188
+
189
+ ## [Unreleased]
190
+
191
+ ### Planned
192
+
193
+ - Performance optimizations
194
+ - Additional endpoint coverage
195
+ - Enhanced WebSocket support (if available from Twelve Data)
196
+ - Caching mechanisms for frequent requests
197
+
198
+ ---
199
+
200
+ **Note**: This changelog follows semantic versioning. Major version bumps indicate breaking changes, minor versions add functionality, and patch versions fix bugs.
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 TODO: Write your name
3
+ Copyright (c) 2025 Kenneth C. Demanawa
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal