astroapi-ruby 1.0.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 +7 -0
- data/lib/astroapi/categories/analysis.rb +219 -0
- data/lib/astroapi/categories/astrocartography.rb +119 -0
- data/lib/astroapi/categories/base_category.rb +30 -0
- data/lib/astroapi/categories/charts.rb +119 -0
- data/lib/astroapi/categories/chinese.rb +72 -0
- data/lib/astroapi/categories/data.rb +100 -0
- data/lib/astroapi/categories/eclipses.rb +40 -0
- data/lib/astroapi/categories/enhanced.rb +53 -0
- data/lib/astroapi/categories/fengshui.rb +44 -0
- data/lib/astroapi/categories/fixed_stars.rb +47 -0
- data/lib/astroapi/categories/glossary.rb +114 -0
- data/lib/astroapi/categories/horary.rb +58 -0
- data/lib/astroapi/categories/horoscope.rb +144 -0
- data/lib/astroapi/categories/human_design.rb +77 -0
- data/lib/astroapi/categories/insights/business.rb +62 -0
- data/lib/astroapi/categories/insights/financial.rb +62 -0
- data/lib/astroapi/categories/insights/pet.rb +53 -0
- data/lib/astroapi/categories/insights/relationship.rb +67 -0
- data/lib/astroapi/categories/insights/wellness.rb +67 -0
- data/lib/astroapi/categories/insights.rb +41 -0
- data/lib/astroapi/categories/kabbalah.rb +69 -0
- data/lib/astroapi/categories/lunar.rb +51 -0
- data/lib/astroapi/categories/numerology.rb +37 -0
- data/lib/astroapi/categories/palmistry.rb +44 -0
- data/lib/astroapi/categories/pdf.rb +47 -0
- data/lib/astroapi/categories/render.rb +47 -0
- data/lib/astroapi/categories/svg.rb +48 -0
- data/lib/astroapi/categories/tarot.rb +156 -0
- data/lib/astroapi/categories/traditional.rb +93 -0
- data/lib/astroapi/categories/vedic.rb +190 -0
- data/lib/astroapi/categories/ziwei.rb +25 -0
- data/lib/astroapi/client.rb +103 -0
- data/lib/astroapi/configuration.rb +44 -0
- data/lib/astroapi/error.rb +74 -0
- data/lib/astroapi/http/client.rb +108 -0
- data/lib/astroapi/http/middleware/authentication.rb +22 -0
- data/lib/astroapi/http/middleware/logger.rb +43 -0
- data/lib/astroapi/http/middleware/response_unwrapper.rb +25 -0
- data/lib/astroapi/validators/base_validator.rb +72 -0
- data/lib/astroapi/validators/subject_validator.rb +87 -0
- data/lib/astroapi/version.rb +5 -0
- data/lib/astroapi.rb +18 -0
- metadata +218 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 375b371bd7cd2e2bbba91e3199e0688c7bb82bbefdf8c064d7f128713eca7495
|
|
4
|
+
data.tar.gz: 7c7a5d49c7754ea7574d9b7ca8dbf585b51c7fa0910f68ccd358e9d3d0d43fa8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9d9634fee62e33f2c7713a1637981285314ee62b8aa6f70716119c015991467b185cc81bd4b60a26caab987d79de325b1e5e49bdabca00ac979f111216d0160b
|
|
7
|
+
data.tar.gz: 69b774cef367e3ca85625016a2e88ac5ce7f001b468e3167dcfb55930ccb3e2b812892e0299f7abc9aaccf002f83263691af1253f8101ddbd81cb2987028864c
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_category'
|
|
4
|
+
require_relative '../validators/subject_validator'
|
|
5
|
+
|
|
6
|
+
module Astroapi
|
|
7
|
+
module Categories
|
|
8
|
+
# Analysis category client for interpretive reports and analyses
|
|
9
|
+
class Analysis < BaseCategory
|
|
10
|
+
# Get natal report
|
|
11
|
+
# @param request [Hash] Subject birth data
|
|
12
|
+
# @return [Hash] Comprehensive natal interpretation
|
|
13
|
+
def get_natal_report(request)
|
|
14
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
15
|
+
http.post(build_url('natal-report'), body: request)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Get synastry report
|
|
19
|
+
# @param request [Hash] Two subjects' birth data
|
|
20
|
+
# @return [Hash] Relationship analysis
|
|
21
|
+
def get_synastry_report(request)
|
|
22
|
+
http.post(build_url('synastry-report'), body: request)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Get composite report
|
|
26
|
+
# @param request [Hash] Two subjects' birth data
|
|
27
|
+
# @return [Hash] Composite chart interpretation
|
|
28
|
+
def get_composite_report(request)
|
|
29
|
+
http.post(build_url('composite-report'), body: request)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get compatibility analysis
|
|
33
|
+
# @param request [Hash] Two subjects' birth data
|
|
34
|
+
# @return [Hash] Compatibility assessment
|
|
35
|
+
def get_compatibility_analysis(request)
|
|
36
|
+
http.post(build_url('compatibility'), body: request)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Get compatibility score
|
|
40
|
+
# @param request [Hash] Two subjects' birth data
|
|
41
|
+
# @return [Hash] Numeric compatibility score
|
|
42
|
+
def get_compatibility_score(request)
|
|
43
|
+
http.post(build_url('compatibility-score'), body: request)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Get relationship analysis
|
|
47
|
+
# @param request [Hash] Two subjects' birth data
|
|
48
|
+
# @return [Hash] Relationship dynamics
|
|
49
|
+
def get_relationship_analysis(request)
|
|
50
|
+
http.post(build_url('relationship'), body: request)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Get relationship score
|
|
54
|
+
# @param request [Hash] Two subjects' birth data
|
|
55
|
+
# @return [Hash] Numeric relationship score
|
|
56
|
+
def get_relationship_score(request)
|
|
57
|
+
http.post(build_url('relationship-score'), body: request)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Get transit report
|
|
61
|
+
# @param request [Hash] Subject and transit date
|
|
62
|
+
# @return [Hash] Transit interpretations
|
|
63
|
+
def get_transit_report(request)
|
|
64
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
65
|
+
http.post(build_url('transit-report'), body: request)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Get natal transit report
|
|
69
|
+
# @param request [Hash] Subject and date range
|
|
70
|
+
# @return [Hash] Natal transit interpretations
|
|
71
|
+
def get_natal_transit_report(request)
|
|
72
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
73
|
+
http.post(build_url('natal-transit-report'), body: request)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Get progression report
|
|
77
|
+
# @param request [Hash] Subject and progression date
|
|
78
|
+
# @return [Hash] Progression interpretations
|
|
79
|
+
def get_progression_report(request)
|
|
80
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
81
|
+
http.post(build_url('progression-report'), body: request)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Get direction report
|
|
85
|
+
# @param request [Hash] Subject and direction date
|
|
86
|
+
# @return [Hash] Direction interpretations
|
|
87
|
+
def get_direction_report(request)
|
|
88
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
89
|
+
http.post(build_url('direction-report'), body: request)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Get lunar return report
|
|
93
|
+
# @param request [Hash] Subject and date
|
|
94
|
+
# @return [Hash] Monthly themes
|
|
95
|
+
def get_lunar_return_report(request)
|
|
96
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
97
|
+
http.post(build_url('lunar-return-report'), body: request)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Get solar return report
|
|
101
|
+
# @param request [Hash] Subject and year
|
|
102
|
+
# @return [Hash] Yearly themes
|
|
103
|
+
def get_solar_return_report(request)
|
|
104
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
105
|
+
http.post(build_url('solar-return-report'), body: request)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Get lunar return transit report
|
|
109
|
+
# @param request [Hash] Subject and date range
|
|
110
|
+
# @return [Hash] LR transit events
|
|
111
|
+
def get_lunar_return_transit_report(request)
|
|
112
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
113
|
+
http.post(build_url('lunar-return-transit-report'), body: request)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Get solar return transit report
|
|
117
|
+
# @param request [Hash] Subject and year
|
|
118
|
+
# @return [Hash] SR transit events
|
|
119
|
+
def get_solar_return_transit_report(request)
|
|
120
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
121
|
+
http.post(build_url('solar-return-transit-report'), body: request)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Get career analysis
|
|
125
|
+
# @param request [Hash] Subject birth data
|
|
126
|
+
# @return [Hash] 10th house/career focus
|
|
127
|
+
def get_career_analysis(request)
|
|
128
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
129
|
+
http.post(build_url('career'), body: request)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Get health analysis
|
|
133
|
+
# @param request [Hash] Subject birth data
|
|
134
|
+
# @return [Hash] 6th house/wellness focus
|
|
135
|
+
def get_health_analysis(request)
|
|
136
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
137
|
+
http.post(build_url('health'), body: request)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Get karmic analysis
|
|
141
|
+
# @param request [Hash] Subject birth data
|
|
142
|
+
# @return [Hash] Past life/soul lessons
|
|
143
|
+
def get_karmic_analysis(request)
|
|
144
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
145
|
+
http.post(build_url('karmic'), body: request)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Get psychological analysis
|
|
149
|
+
# @param request [Hash] Subject birth data
|
|
150
|
+
# @return [Hash] Psychological patterns
|
|
151
|
+
def get_psychological_analysis(request)
|
|
152
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
153
|
+
http.post(build_url('psychological'), body: request)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Get spiritual analysis
|
|
157
|
+
# @param request [Hash] Subject birth data
|
|
158
|
+
# @return [Hash] Spiritual path
|
|
159
|
+
def get_spiritual_analysis(request)
|
|
160
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
161
|
+
http.post(build_url('spiritual'), body: request)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Get predictive analysis
|
|
165
|
+
# @param request [Hash] Subject and time period
|
|
166
|
+
# @return [Hash] Future trends
|
|
167
|
+
def get_predictive_analysis(request)
|
|
168
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
169
|
+
http.post(build_url('predictive'), body: request)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Get vocational analysis
|
|
173
|
+
# @param request [Hash] Subject birth data
|
|
174
|
+
# @return [Hash] Career aptitudes
|
|
175
|
+
def get_vocational_analysis(request)
|
|
176
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
177
|
+
http.post(build_url('vocational'), body: request)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Get lunar analysis
|
|
181
|
+
# @param request [Hash] Subject birth data
|
|
182
|
+
# @return [Hash] Moon-focused analysis
|
|
183
|
+
def get_lunar_analysis(request)
|
|
184
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
185
|
+
http.post(build_url('lunar-analysis'), body: request)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Get relocation analysis
|
|
189
|
+
# @param request [Hash] Subject and new location
|
|
190
|
+
# @return [Hash] Geographic relocation analysis
|
|
191
|
+
def get_relocation_analysis(request)
|
|
192
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
193
|
+
http.post(build_url('relocation'), body: request)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Get Venus return report
|
|
197
|
+
# @param request [Hash] Subject and return date
|
|
198
|
+
# @return [Hash] Venus return interpretation
|
|
199
|
+
def get_venus_return_report(request)
|
|
200
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
201
|
+
http.post(build_url('venus-return-report'), body: request)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Get Venus return transit report
|
|
205
|
+
# @param request [Hash] Subject and date range
|
|
206
|
+
# @return [Hash] Venus return transit events
|
|
207
|
+
def get_venus_return_transit_report(request)
|
|
208
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
209
|
+
http.post(build_url('venus-return-transit-report'), body: request)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
protected
|
|
213
|
+
|
|
214
|
+
def api_prefix
|
|
215
|
+
'/api/v3/analysis'
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_category'
|
|
4
|
+
require_relative '../validators/subject_validator'
|
|
5
|
+
|
|
6
|
+
module Astroapi
|
|
7
|
+
module Categories
|
|
8
|
+
# Astrocartography category client for locational astrology
|
|
9
|
+
class Astrocartography < BaseCategory
|
|
10
|
+
# Get astrocartography lines
|
|
11
|
+
# @param request [Hash] Subject birth data
|
|
12
|
+
# @return [Hash] Planetary AC/DC/MC/IC lines
|
|
13
|
+
def get_lines(request)
|
|
14
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
15
|
+
http.post(build_url('lines'), body: request)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Generate astrocartography map
|
|
19
|
+
# @param request [Hash] Subject birth data and map options
|
|
20
|
+
# @return [Hash] World map with lines
|
|
21
|
+
def generate_map(request)
|
|
22
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
23
|
+
http.post(build_url('map'), body: request)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Generate paran map
|
|
27
|
+
# @param request [Hash] Subject birth data
|
|
28
|
+
# @return [Hash] Line crossing points
|
|
29
|
+
def generate_paran_map(request)
|
|
30
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
31
|
+
http.post(build_url('paran-map'), body: request)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Analyze specific location
|
|
35
|
+
# @param request [Hash] Subject and location
|
|
36
|
+
# @return [Hash] Location influences
|
|
37
|
+
def analyze_location(request)
|
|
38
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
39
|
+
http.post(build_url('location-analysis'), body: request)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Compare multiple locations
|
|
43
|
+
# @param request [Hash] Subject and locations
|
|
44
|
+
# @return [Hash] Multi-location comparison
|
|
45
|
+
def compare_locations(request)
|
|
46
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
47
|
+
http.post(build_url('compare-locations'), body: request)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Find power zones
|
|
51
|
+
# @param request [Hash] Subject and criteria
|
|
52
|
+
# @return [Hash] Optimal geographic areas
|
|
53
|
+
def find_power_zones(request)
|
|
54
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
55
|
+
http.post(build_url('power-zones'), body: request)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Search locations by criteria
|
|
59
|
+
# @param request [Hash] Search criteria
|
|
60
|
+
# @return [Hash] Matching locations
|
|
61
|
+
def search_locations(request)
|
|
62
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
63
|
+
http.post(build_url('search-locations'), body: request)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Generate relocation chart
|
|
67
|
+
# @param request [Hash] Subject and new location
|
|
68
|
+
# @return [Hash] Chart for new location
|
|
69
|
+
def generate_relocation_chart(request)
|
|
70
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
71
|
+
http.post(build_url('relocation-chart'), body: request)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Get line meanings
|
|
75
|
+
# @param params [Hash] Query parameters
|
|
76
|
+
# @return [Hash] Line interpretations
|
|
77
|
+
def get_line_meanings(params = {})
|
|
78
|
+
http.get(build_url('line-meanings'), params: params)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Get supported features
|
|
82
|
+
# @param params [Hash] Query parameters
|
|
83
|
+
# @return [Hash] Available features
|
|
84
|
+
def get_supported_features(params = {})
|
|
85
|
+
http.get(build_url('supported-features'), params: params)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Calculate astrodynes
|
|
89
|
+
# @param request [Hash] Subject birth data
|
|
90
|
+
# @return [Hash] Astrodyne calculations
|
|
91
|
+
def calculate_astrodynes(request)
|
|
92
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
93
|
+
http.post(build_url('astrodynes'), body: request)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Compare astrodynes for multiple locations
|
|
97
|
+
# @param request [Hash] Subject and locations
|
|
98
|
+
# @return [Hash] Astrodyne comparison
|
|
99
|
+
def compare_astrodynes(request)
|
|
100
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
101
|
+
http.post(build_url('astrodynes', 'compare'), body: request)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Render astrocartography map image
|
|
105
|
+
# @param request [Hash] Subject and render options
|
|
106
|
+
# @return [Hash] Rendered map data
|
|
107
|
+
def render_map(request)
|
|
108
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
109
|
+
http.post(build_url('render'), body: request)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
protected
|
|
113
|
+
|
|
114
|
+
def api_prefix
|
|
115
|
+
'/api/v3/astrocartography'
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Astroapi
|
|
4
|
+
module Categories
|
|
5
|
+
# Base class for all category clients
|
|
6
|
+
class BaseCategory
|
|
7
|
+
attr_reader :http
|
|
8
|
+
|
|
9
|
+
def initialize(http_client)
|
|
10
|
+
@http = http_client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
protected
|
|
14
|
+
|
|
15
|
+
# Build URL path from segments
|
|
16
|
+
# @param segments [Array<String>] Path segments
|
|
17
|
+
# @return [String] Full path
|
|
18
|
+
def build_url(*segments)
|
|
19
|
+
path_segments = [api_prefix, *segments.compact].map { |s| s.to_s.gsub(%r{^/+|/+$}, '') }
|
|
20
|
+
"/#{path_segments.join('/')}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# API prefix for this category (must be overridden)
|
|
24
|
+
# @return [String]
|
|
25
|
+
def api_prefix
|
|
26
|
+
raise NotImplementedError, 'Subclasses must define api_prefix'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_category'
|
|
4
|
+
require_relative '../validators/subject_validator'
|
|
5
|
+
|
|
6
|
+
module Astroapi
|
|
7
|
+
module Categories
|
|
8
|
+
# Charts category client for astrological chart generation
|
|
9
|
+
class Charts < BaseCategory
|
|
10
|
+
# Get natal chart
|
|
11
|
+
# @param request [Hash] Subject birth data
|
|
12
|
+
# @return [Hash] Natal chart data
|
|
13
|
+
def get_natal_chart(request)
|
|
14
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
15
|
+
http.post(build_url('natal'), body: request)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Get composite chart
|
|
19
|
+
# @param request [Hash] Two subjects' birth data
|
|
20
|
+
# @return [Hash] Composite chart data
|
|
21
|
+
def get_composite_chart(request)
|
|
22
|
+
http.post(build_url('composite'), body: request)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Get synastry chart
|
|
26
|
+
# @param request [Hash] Two subjects' birth data
|
|
27
|
+
# @return [Hash] Synastry chart data
|
|
28
|
+
def get_synastry_chart(request)
|
|
29
|
+
http.post(build_url('synastry'), body: request)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Get transit chart
|
|
33
|
+
# @param request [Hash] Subject and transit date
|
|
34
|
+
# @return [Hash] Transit chart data
|
|
35
|
+
def get_transit_chart(request)
|
|
36
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
37
|
+
http.post(build_url('transit'), body: request)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Get solar return chart
|
|
41
|
+
# @param request [Hash] Subject and return year
|
|
42
|
+
# @return [Hash] Solar return chart data
|
|
43
|
+
def get_solar_return_chart(request)
|
|
44
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
45
|
+
http.post(build_url('solar-return'), body: request)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Get lunar return chart
|
|
49
|
+
# @param request [Hash] Subject and return date
|
|
50
|
+
# @return [Hash] Lunar return chart data
|
|
51
|
+
def get_lunar_return_chart(request)
|
|
52
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
53
|
+
http.post(build_url('lunar-return'), body: request)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get solar return transits
|
|
57
|
+
# @param request [Hash] Subject and year
|
|
58
|
+
# @return [Hash] Solar return transit events
|
|
59
|
+
def get_solar_return_transits(request)
|
|
60
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
61
|
+
http.post(build_url('solar-return-transits'), body: request)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Get lunar return transits
|
|
65
|
+
# @param request [Hash] Subject and date range
|
|
66
|
+
# @return [Hash] Lunar return transit events
|
|
67
|
+
def get_lunar_return_transits(request)
|
|
68
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
69
|
+
http.post(build_url('lunar-return-transits'), body: request)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Get progressions
|
|
73
|
+
# @param request [Hash] Subject and progression date
|
|
74
|
+
# @return [Hash] Secondary/tertiary progressions
|
|
75
|
+
def get_progressions(request)
|
|
76
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
77
|
+
http.post(build_url('progressions'), body: request)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Get directions
|
|
81
|
+
# @param request [Hash] Subject and direction date
|
|
82
|
+
# @return [Hash] Solar arc directions
|
|
83
|
+
def get_directions(request)
|
|
84
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
85
|
+
http.post(build_url('directions'), body: request)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Get natal transits
|
|
89
|
+
# @param request [Hash] Subject and date range
|
|
90
|
+
# @return [Hash] Upcoming transit events
|
|
91
|
+
def get_natal_transits(request)
|
|
92
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
93
|
+
http.post(build_url('natal-transits'), body: request)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Get Venus return chart
|
|
97
|
+
# @param request [Hash] Subject and return date
|
|
98
|
+
# @return [Hash] Venus return chart data
|
|
99
|
+
def get_venus_return_chart(request)
|
|
100
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
101
|
+
http.post(build_url('venus-return'), body: request)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Get Venus return transits
|
|
105
|
+
# @param request [Hash] Subject and date range
|
|
106
|
+
# @return [Hash] Venus return transit events
|
|
107
|
+
def get_venus_return_transits(request)
|
|
108
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
109
|
+
http.post(build_url('venus-return-transits'), body: request)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
protected
|
|
113
|
+
|
|
114
|
+
def api_prefix
|
|
115
|
+
'/api/v3/charts'
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_category'
|
|
4
|
+
|
|
5
|
+
module Astroapi
|
|
6
|
+
module Categories
|
|
7
|
+
# Chinese astrology and BaZi category client
|
|
8
|
+
class Chinese < BaseCategory
|
|
9
|
+
# Calculate BaZi (Four Pillars)
|
|
10
|
+
# @param request [Hash] Birth data
|
|
11
|
+
# @return [Hash] Four Pillars chart
|
|
12
|
+
def calculate_bazi(request)
|
|
13
|
+
http.post(build_url('bazi'), body: request)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Calculate compatibility
|
|
17
|
+
# @param request [Hash] Two subjects' birth data
|
|
18
|
+
# @return [Hash] Chinese compatibility analysis
|
|
19
|
+
def calculate_compatibility(request)
|
|
20
|
+
http.post(build_url('compatibility'), body: request)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Calculate luck pillars
|
|
24
|
+
# @param request [Hash] Birth data
|
|
25
|
+
# @return [Hash] Da Yun periods
|
|
26
|
+
def calculate_luck_pillars(request)
|
|
27
|
+
http.post(build_url('luck-pillars'), body: request)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Calculate Ming Gua
|
|
31
|
+
# @param request [Hash] Birth data
|
|
32
|
+
# @return [Hash] Feng Shui number
|
|
33
|
+
def calculate_ming_gua(request)
|
|
34
|
+
http.post(build_url('ming-gua'), body: request)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Get yearly forecast
|
|
38
|
+
# @param request [Hash] Birth data and year
|
|
39
|
+
# @return [Hash] Annual forecast
|
|
40
|
+
def get_yearly_forecast(request)
|
|
41
|
+
http.post(build_url('yearly-forecast'), body: request)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Analyze year elements
|
|
45
|
+
# @param year [Integer] Year to analyze
|
|
46
|
+
# @return [Hash] Five elements for year
|
|
47
|
+
def analyze_year_elements(year)
|
|
48
|
+
http.get(build_url('elements', 'balance', year.to_s))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get solar terms
|
|
52
|
+
# @param year [Integer] Year
|
|
53
|
+
# @return [Hash] 24 Solar Terms
|
|
54
|
+
def get_solar_terms(year)
|
|
55
|
+
http.get(build_url('calendar', 'solar-terms', year.to_s))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Get zodiac animal info
|
|
59
|
+
# @param animal [String] Animal name
|
|
60
|
+
# @return [Hash] Animal characteristics
|
|
61
|
+
def get_zodiac_animal(animal)
|
|
62
|
+
http.get(build_url('zodiac', animal))
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
protected
|
|
66
|
+
|
|
67
|
+
def api_prefix
|
|
68
|
+
'/api/v3/chinese'
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_category'
|
|
4
|
+
require_relative '../validators/subject_validator'
|
|
5
|
+
|
|
6
|
+
module Astroapi
|
|
7
|
+
module Categories
|
|
8
|
+
# Data category client for planetary positions, aspects, house cusps, etc.
|
|
9
|
+
class Data < BaseCategory
|
|
10
|
+
# Get planetary positions
|
|
11
|
+
# @example
|
|
12
|
+
# positions = client.data.get_positions(
|
|
13
|
+
# subject: {
|
|
14
|
+
# birth_data: {
|
|
15
|
+
# year: 1990, month: 5, day: 11,
|
|
16
|
+
# hour: 14, minute: 30,
|
|
17
|
+
# city: 'London', country_code: 'GB'
|
|
18
|
+
# }
|
|
19
|
+
# }
|
|
20
|
+
# )
|
|
21
|
+
#
|
|
22
|
+
# @param request [Hash] Subject birth data
|
|
23
|
+
# @option request [Hash] :subject Subject with birth_data
|
|
24
|
+
# @return [Hash] Planetary positions with signs, degrees, retrograde status
|
|
25
|
+
# @raise [Astroapi::ValidationError] if request data is invalid
|
|
26
|
+
def get_positions(request)
|
|
27
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
28
|
+
http.post(build_url('positions'), body: request)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Get enhanced planetary positions with additional data
|
|
32
|
+
# @param request [Hash] Subject birth data
|
|
33
|
+
# @return [Hash] Enhanced planetary positions
|
|
34
|
+
def get_enhanced_positions(request)
|
|
35
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
36
|
+
http.post(build_url('positions', 'enhanced'), body: request)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Get global planetary positions (without subject)
|
|
40
|
+
# @param request [Hash] Request options
|
|
41
|
+
# @option request [String] :date ISO date string (optional)
|
|
42
|
+
# @return [Hash] Global planetary positions
|
|
43
|
+
def get_global_positions(request = {})
|
|
44
|
+
http.post(build_url('global-positions'), body: request)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get planetary aspects
|
|
48
|
+
# @param request [Hash] Subject birth data
|
|
49
|
+
# @return [Hash] Planetary aspects
|
|
50
|
+
def get_aspects(request)
|
|
51
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
52
|
+
http.post(build_url('aspects'), body: request)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Get enhanced planetary aspects
|
|
56
|
+
# @param request [Hash] Subject birth data
|
|
57
|
+
# @return [Hash] Enhanced planetary aspects
|
|
58
|
+
def get_enhanced_aspects(request)
|
|
59
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
60
|
+
http.post(build_url('aspects', 'enhanced'), body: request)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Get house cusps
|
|
64
|
+
# @param request [Hash] Subject birth data
|
|
65
|
+
# @return [Hash] House cusps data
|
|
66
|
+
def get_house_cusps(request)
|
|
67
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
68
|
+
http.post(build_url('house-cusps'), body: request)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Get lunar metrics
|
|
72
|
+
# @param request [Hash] Subject birth data
|
|
73
|
+
# @return [Hash] Lunar phase, illumination, etc.
|
|
74
|
+
def get_lunar_metrics(request)
|
|
75
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
76
|
+
http.post(build_url('lunar-metrics'), body: request)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Get enhanced lunar metrics
|
|
80
|
+
# @param request [Hash] Subject birth data
|
|
81
|
+
# @return [Hash] Enhanced lunar metrics
|
|
82
|
+
def get_enhanced_lunar_metrics(request)
|
|
83
|
+
Validators::SubjectValidator.validate!(request[:subject] || request['subject'])
|
|
84
|
+
http.post(build_url('lunar-metrics', 'enhanced'), body: request)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Get current moment (planetary positions at current time)
|
|
88
|
+
# @return [Hash] Current planetary positions
|
|
89
|
+
def get_current_moment
|
|
90
|
+
http.get(build_url('now'))
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
protected
|
|
94
|
+
|
|
95
|
+
def api_prefix
|
|
96
|
+
'/api/v3/data'
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|