Skip to content

Commit 57c1802

Browse files
author
Sergii Solonyna
committed
Initial commit
0 parents  commit 57c1802

90 files changed

Lines changed: 7217 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: RuboCop
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: ruby/setup-ruby@v1
16+
with:
17+
ruby-version: "3.3"
18+
bundler-cache: true
19+
- run: bundle exec rubocop
20+
21+
test:
22+
name: Tests (Ruby ${{ matrix.ruby }})
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: ${{ matrix.ruby }}
33+
bundler-cache: true
34+
- run: bundle exec rspec

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
test:
10+
name: Tests
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: "3.3"
17+
bundler-cache: true
18+
- run: bundle exec rake
19+
20+
publish:
21+
name: Publish to RubyGems
22+
needs: test
23+
runs-on: ubuntu-latest
24+
environment: rubygems
25+
permissions:
26+
contents: write
27+
id-token: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: "3.3"
33+
bundler-cache: true
34+
35+
- name: Verify tag matches gem version
36+
run: |
37+
GEM_VERSION=$(ruby -r ./lib/astroapi/version -e "puts Astroapi::VERSION")
38+
TAG_VERSION="${GITHUB_REF_NAME#v}"
39+
if [ "$GEM_VERSION" != "$TAG_VERSION" ]; then
40+
echo "ERROR: Tag version ($TAG_VERSION) does not match gem version ($GEM_VERSION)"
41+
echo "Update lib/astroapi/version.rb before tagging."
42+
exit 1
43+
fi
44+
45+
- name: Build gem
46+
run: gem build astroapi.gemspec
47+
48+
- name: Publish to RubyGems
49+
run: |
50+
mkdir -p ~/.gem
51+
echo "---" > ~/.gem/credentials
52+
echo ":rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" >> ~/.gem/credentials
53+
chmod 0600 ~/.gem/credentials
54+
gem push astroapi-*.gem
55+
rm -f ~/.gem/credentials
56+
57+
- name: Create GitHub Release
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
run: |
61+
gh release create "$GITHUB_REF_NAME" \
62+
--title "$GITHUB_REF_NAME" \
63+
--generate-notes \
64+
astroapi-*.gem

.gitignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/spec/examples.txt
9+
/test/tmp/
10+
/test/version_tmp/
11+
/tmp/
12+
13+
# Used by dotenv library to load environment variables.
14+
.env
15+
16+
# Ignore Byebug command history file.
17+
.byebug_history
18+
19+
## Specific to RubyMotion:
20+
.dat*
21+
.repl_history
22+
build/
23+
*.bridgesupport
24+
build-iPhoneOS/
25+
build-iPhoneSimulator/
26+
27+
## Specific to RubyMotion (use of CocoaPods):
28+
#
29+
# We recommend against adding the Pods directory to your .gitignore. However
30+
# you should judge for yourself, the pros and cons are mentioned at:
31+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32+
#
33+
# vendor/Pods/
34+
35+
## Documentation cache and generated files:
36+
/.yardoc/
37+
/_yardoc/
38+
/doc/
39+
/rdoc/
40+
41+
## Environment normalization:
42+
/.bundle/
43+
/vendor/bundle
44+
/lib/bundler/man/
45+
46+
# for a library or gem, you might want to ignore these files since the code is
47+
# intended to run in multiple environments; otherwise, check them in:
48+
Gemfile.lock
49+
.ruby-version
50+
.ruby-gemset
51+
52+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53+
.rvmrc
54+
55+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
56+
.rubocop-https?--*
57+
58+
# IDE files
59+
.idea/
60+
.vscode/
61+
*.swp
62+
*.swo
63+
*~
64+
65+
# OS files
66+
.DS_Store
67+
Thumbs.db

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--require spec_helper
2+
--format documentation
3+
--color

.rubocop.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
require:
2+
- rubocop-rspec
3+
4+
AllCops:
5+
TargetRubyVersion: 2.6
6+
NewCops: enable
7+
Exclude:
8+
- 'vendor/**/*'
9+
- 'tmp/**/*'
10+
- 'examples/**/*'
11+
12+
Style/Documentation:
13+
Enabled: false
14+
15+
Style/StringLiterals:
16+
EnforcedStyle: single_quotes
17+
18+
Style/StringLiteralsInInterpolation:
19+
EnforcedStyle: single_quotes
20+
21+
Layout/LineLength:
22+
Max: 120
23+
24+
Metrics/ClassLength:
25+
Exclude:
26+
- 'lib/astroapi/categories/**/*'
27+
28+
Metrics/BlockLength:
29+
Exclude:
30+
- 'spec/**/*'
31+
- '*.gemspec'
32+
33+
Metrics/MethodLength:
34+
Max: 20
35+
Exclude:
36+
- 'spec/**/*'
37+
- 'lib/astroapi/validators/**/*'
38+
- 'lib/astroapi/http/client.rb'
39+
- 'lib/astroapi/client.rb'
40+
41+
Metrics/AbcSize:
42+
Max: 20
43+
Exclude:
44+
- 'spec/**/*'
45+
- 'lib/astroapi/validators/**/*'
46+
- 'lib/astroapi/error.rb'
47+
- 'lib/astroapi/http/client.rb'
48+
- 'lib/astroapi/client.rb'
49+
50+
RSpec/ExampleLength:
51+
Max: 15
52+
53+
RSpec/MultipleExpectations:
54+
Max: 5
55+
56+
RSpec/NestedGroups:
57+
Max: 4
58+
59+
RSpec/FilePath:
60+
Enabled: false
61+
62+
RSpec/MessageSpies:
63+
Enabled: false
64+
65+
RSpec/StubbedMock:
66+
Enabled: false
67+
68+
RSpec/DescribeClass:
69+
Exclude:
70+
- 'spec/integration/**/*'
71+
72+
Naming/AccessorMethodName:
73+
Enabled: false
74+
75+
Metrics/CyclomaticComplexity:
76+
Max: 15
77+
Exclude:
78+
- 'lib/astroapi/validators/**/*'
79+
- 'lib/astroapi/error.rb'
80+
81+
Metrics/PerceivedComplexity:
82+
Max: 15
83+
Exclude:
84+
- 'lib/astroapi/validators/**/*'
85+
- 'lib/astroapi/error.rb'

CHANGELOG.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
## [1.0.0] - 2026-02-16
11+
12+
### Added
13+
14+
#### Core
15+
- HTTP client built on Faraday with middleware stack (authentication, logging, response unwrapping, retry, error handling)
16+
- Configuration via constructor hash, block, or environment variables (`ASTROLOGY_API_KEY`, `ASTROLOGY_API_BASE_URL`, `ASTROLOGY_DEBUG`)
17+
- Retry logic with configurable attempts, delay, and status codes
18+
- Error hierarchy: `ClientError`, `ServerError`, `TimeoutError`, `ConnectionError`, `ValidationError`, `ConfigurationError`
19+
- Input validation for birth data (date ranges, location as city+country_code or latitude+longitude)
20+
21+
#### Category Clients (25 categories, 200+ endpoints)
22+
- `data` — planetary positions, aspects, house cusps, lunar metrics (9 endpoints)
23+
- `charts` — natal, composite, synastry, transit, solar/lunar/venus return charts (13 endpoints)
24+
- `horoscope` — daily, weekly, monthly, yearly horoscopes for signs and personal (17 endpoints)
25+
- `analysis` — natal, synastry, composite, transit, career, health, karmic reports (26 endpoints)
26+
- `glossary` — active points, cities, countries, elements, house systems, keywords (14 endpoints)
27+
- `astrocartography` — lines, maps, paran maps, power zones, location analysis, astrodynes (13 endpoints)
28+
- `chinese` — BaZi, Ming Gua, zodiac animals, compatibility, luck pillars, solar terms (8 endpoints)
29+
- `eclipses` — upcoming eclipses, natal impact, interpretation (3 endpoints)
30+
- `lunar` — phases, events, mansions, void of course, calendar (5 endpoints)
31+
- `numerology` — core numbers, comprehensive reports, compatibility (3 endpoints)
32+
- `tarot` — cards glossary, draws, spreads, reports, birth cards, dignities, timing (19 endpoints)
33+
- `traditional` — dignities, lots, profections, traditional points glossary (10 endpoints)
34+
- `fixed_stars` — star positions, conjunctions, reports, presets (4 endpoints)
35+
- `insights` — AI-powered insights with 5 sub-clients: relationship, pet, wellness, financial, business (31 endpoints)
36+
- `svg` — SVG chart images: natal, synastry, composite, transit (4 endpoints)
37+
- `enhanced` — enhanced global and personal analysis with chart variants (4 endpoints)
38+
- `vedic` — kundli, panchang, dashas, yogas, doshas, kundli matching, remedies (22 endpoints)
39+
- `human_design` — bodygraph, type, design date, compatibility, transits, glossaries (8 endpoints)
40+
- `kabbalah` — birth angels, gematria, tikkun, Tree of Life chart, glossaries (7 endpoints)
41+
- `horary` — horary chart, analysis, aspects, fertility analysis, glossaries (6 endpoints)
42+
- `fengshui` — flying stars, annual stars, afflictions, glossary (4 endpoints)
43+
- `palmistry` — palm analysis, reading, astro integration, compatibility (4 endpoints)
44+
- `pdf` — PDF reports: natal, daily/weekly horoscope, horoscope data (4 endpoints)
45+
- `render` — PNG chart images: natal, synastry, composite, transit (4 endpoints)
46+
- `ziwei` — Zi Wei Dou Shu chart calculation (1 endpoint)
47+
48+
#### Testing
49+
- Dual-mode test suite: mock mode (WebMock) and live mode (real API)
50+
- 250 examples across 26 integration test files (one per category) + unit tests
51+
- 96% code coverage (SimpleCov)
52+
- RuboCop + rubocop-rspec for code style enforcement
53+
54+
#### CI/CD
55+
- GitHub Actions CI workflow: RuboCop lint + RSpec on Ruby 2.6–3.3
56+
- GitHub Actions release workflow: auto-publish to RubyGems on version tags
57+
58+
[Unreleased]: https://github.com/astro-api/astroapi-ruby/compare/v1.0.0...HEAD
59+
[1.0.0]: https://github.com/astro-api/astroapi-ruby/releases/tag/v1.0.0

0 commit comments

Comments
 (0)