widegita 0.1.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/LICENSE +21 -0
- data/README.md +261 -0
- data/lib/widegita/client.rb +262 -0
- data/lib/widegita/version.rb +5 -0
- data/lib/widegita.rb +4 -0
- metadata +54 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b5e142a8b24a0f229ebd0a311086273d201d10b4769b040a1ae174af518031ae
|
|
4
|
+
data.tar.gz: fbeff74bb64592d72ad0ee61b329d275c9af05bcddfe35c9bc5bcf83d39dabe6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1e0d9e835083c5ba082a24c84e47440894a9862a78d3625d05e792a731a4e2d5b1bde82890870e426f1a2ac3ec4ba80363cd8533cfeb32d6961f91611d0b2030
|
|
7
|
+
data.tar.gz: 25595fe3685bf60bcdfeba9a41a221db724278311d4e150c513af8435e11d57c89838b86da7223eceaf5b9b76420d5e5d4539f42a06bcba675b3a3376eaaaa1f
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WideHoly
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# widegita
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/widegita)
|
|
4
|
+
[](https://www.ruby-lang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://rubygems.org/gems/widegita)
|
|
7
|
+
|
|
8
|
+
Ruby client for the [WideGita](https://widegita.com) API. Access all 18 chapters and 700 verses of the Bhagavad Gita with Sanskrit text and multiple commentaries (Shankaracharya, Ramanujacharya), Upanishads, Yoga Sutras of Patanjali, Hindu deities, philosophical concepts, topics, and a Sanskrit glossary. Zero runtime dependencies -- uses only Ruby stdlib (`net/http`, `json`, `uri`).
|
|
9
|
+
|
|
10
|
+
WideGita is a comprehensive Hindu scripture encyclopedia providing structured access to the Bhagavad Gita, Upanishadic wisdom, Yoga philosophy, and the broader Hindu intellectual tradition -- all accessible through a free REST API.
|
|
11
|
+
|
|
12
|
+
> **Explore the Gita at [widegita.com](https://widegita.com)** -- [Chapters](https://widegita.com/chapters/), [Upanishads](https://widegita.com/upanishads/), [Yoga Sutras](https://widegita.com/yoga-sutras/), [Deities](https://widegita.com/deities/), [Concepts](https://widegita.com/concepts/)
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Install](#install)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [What You Can Do](#what-you-can-do)
|
|
19
|
+
- [Read Gita Chapters](#read-gita-chapters)
|
|
20
|
+
- [Look Up Verses](#look-up-verses)
|
|
21
|
+
- [Search Scripture](#search-scripture)
|
|
22
|
+
- [Study Commentaries](#study-commentaries)
|
|
23
|
+
- [Explore Upanishads](#explore-upanishads)
|
|
24
|
+
- [Study Yoga Sutras](#study-yoga-sutras)
|
|
25
|
+
- [Discover Hindu Deities](#discover-hindu-deities)
|
|
26
|
+
- [Explore Philosophical Concepts](#explore-philosophical-concepts)
|
|
27
|
+
- [API Reference](#api-reference)
|
|
28
|
+
- [Learn More About Hindu Scripture](#learn-more-about-hindu-scripture)
|
|
29
|
+
- [WideHoly Scripture Family](#wideholy-scripture-family)
|
|
30
|
+
- [Also Available](#also-available)
|
|
31
|
+
- [License](#license)
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gem install widegita
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or add to your Gemfile:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
gem "widegita"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
require "widegita"
|
|
49
|
+
|
|
50
|
+
# Create a client (zero configuration needed)
|
|
51
|
+
client = WideGita::Client.new
|
|
52
|
+
|
|
53
|
+
# List all 18 chapters of the Bhagavad Gita
|
|
54
|
+
chapters = client.list_chapters
|
|
55
|
+
puts chapters["results"].first["name"]
|
|
56
|
+
|
|
57
|
+
# Get a specific verse -- Chapter 2, Verse 47 (Karma Yoga)
|
|
58
|
+
verse = client.get_verse(2, 47)
|
|
59
|
+
puts verse["text"]
|
|
60
|
+
|
|
61
|
+
# Search across all verses
|
|
62
|
+
results = client.search("dharma")
|
|
63
|
+
results["results"].each { |v| puts v["text"] }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## What You Can Do
|
|
67
|
+
|
|
68
|
+
### Read Gita Chapters
|
|
69
|
+
|
|
70
|
+
The Bhagavad Gita contains 18 chapters, each exploring a different aspect of yoga and dharma. The dialogue between Krishna and Arjuna on the battlefield of Kurukshetra covers karma yoga (action), jnana yoga (knowledge), and bhakti yoga (devotion).
|
|
71
|
+
|
|
72
|
+
| Chapter | Name | Verses | Theme |
|
|
73
|
+
|---------|------|--------|-------|
|
|
74
|
+
| 1 | Arjuna Vishada Yoga | 47 | Arjuna's grief and moral dilemma |
|
|
75
|
+
| 2 | Sankhya Yoga | 72 | Self, soul, and duty |
|
|
76
|
+
| 3 | Karma Yoga | 43 | Path of selfless action |
|
|
77
|
+
| 4 | Jnana Karma Sanyasa Yoga | 42 | Knowledge and renunciation |
|
|
78
|
+
| 12 | Bhakti Yoga | 20 | Path of devotion |
|
|
79
|
+
| 18 | Moksha Sanyasa Yoga | 78 | Liberation and surrender |
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
# List all chapters
|
|
83
|
+
chapters = client.list_chapters
|
|
84
|
+
|
|
85
|
+
# Get details for Chapter 2 (Sankhya Yoga)
|
|
86
|
+
ch2 = client.get_chapter(2)
|
|
87
|
+
puts ch2["name"] # => "Sankhya Yoga"
|
|
88
|
+
puts ch2["verse_count"] # => 72
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Look Up Verses
|
|
92
|
+
|
|
93
|
+
Access all 700 verses with original Sanskrit (Devanagari), transliteration, and multiple English translations. The Sivananda translation is the default.
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
# Get the famous Karma Yoga verse (2.47)
|
|
97
|
+
verse = client.get_verse(2, 47, translation: "sivananda")
|
|
98
|
+
|
|
99
|
+
# List all verses in a chapter
|
|
100
|
+
verses = client.list_verses(chapter: 2)
|
|
101
|
+
|
|
102
|
+
# Filter by translation
|
|
103
|
+
verses = client.list_verses(chapter: 12, translation: "gambhirananda")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Search Scripture
|
|
107
|
+
|
|
108
|
+
Full-text search across all Gita verses.
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
# Search for verses about dharma
|
|
112
|
+
results = client.search("dharma", limit: 10)
|
|
113
|
+
results["results"].each do |verse|
|
|
114
|
+
puts verse["text"]
|
|
115
|
+
end
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Study Commentaries
|
|
119
|
+
|
|
120
|
+
Classical commentaries from Advaita (Shankaracharya), Vishishtadvaita (Ramanujacharya), and Dvaita (Madhvacharya) traditions provide diverse philosophical interpretations.
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
# List available commentaries
|
|
124
|
+
commentaries = client.list_commentaries
|
|
125
|
+
|
|
126
|
+
# Filter by philosophical tradition
|
|
127
|
+
advaita = client.list_commentaries(tradition: "advaita")
|
|
128
|
+
|
|
129
|
+
# Get Shankaracharya's commentary
|
|
130
|
+
shankara = client.get_commentary("shankaracharya")
|
|
131
|
+
|
|
132
|
+
# List entries for a specific chapter
|
|
133
|
+
entries = client.list_commentary_entries(commentary: "shankaracharya", chapter: 2)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Explore Upanishads
|
|
137
|
+
|
|
138
|
+
The Upanishads are the philosophical foundation of Hinduism. The 10 principal (Mukhya) Upanishads are considered the most authoritative, drawn from the four Vedas.
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# List all Upanishads
|
|
142
|
+
upanishads = client.list_upanishads
|
|
143
|
+
|
|
144
|
+
# Only the 10 principal Upanishads
|
|
145
|
+
principal = client.list_upanishads(principal_only: true)
|
|
146
|
+
|
|
147
|
+
# Filter by Veda
|
|
148
|
+
rig_veda = client.list_upanishads(veda: "rig")
|
|
149
|
+
|
|
150
|
+
# Get the Isha Upanishad
|
|
151
|
+
isha = client.get_upanishad("isha")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Study Yoga Sutras
|
|
155
|
+
|
|
156
|
+
Patanjali's Yoga Sutras (196 aphorisms) are organized into 4 padas (chapters): Samadhi, Sadhana, Vibhuti, and Kaivalya -- the foundational text of Raja Yoga.
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
# List all Yoga Sutras
|
|
160
|
+
sutras = client.list_yoga_sutras
|
|
161
|
+
|
|
162
|
+
# Filter by pada
|
|
163
|
+
samadhi = client.list_yoga_sutras(pada: 1)
|
|
164
|
+
|
|
165
|
+
# Get a specific sutra
|
|
166
|
+
sutra = client.get_yoga_sutra("1-2") # yogas chitta vritti nirodhah
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Discover Hindu Deities
|
|
170
|
+
|
|
171
|
+
Profiles of Hindu deities spanning Vaishnavism, Shaivism, and Shaktism traditions -- from the Trimurti (Brahma, Vishnu, Shiva) to regional and folk deities.
|
|
172
|
+
|
|
173
|
+
```ruby
|
|
174
|
+
# List all deities
|
|
175
|
+
deities = client.list_deities
|
|
176
|
+
|
|
177
|
+
# Trimurti only
|
|
178
|
+
trimurti = client.list_deities(trimurti_only: true)
|
|
179
|
+
|
|
180
|
+
# Filter by tradition
|
|
181
|
+
vaishnava = client.list_deities(tradition: "vaishnavism")
|
|
182
|
+
|
|
183
|
+
# Get Krishna's profile
|
|
184
|
+
krishna = client.get_deity("krishna")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Explore Philosophical Concepts
|
|
188
|
+
|
|
189
|
+
Core Hindu philosophical concepts -- dharma, karma, moksha, samsara, atman, brahman -- with definitions, scriptural references, and tradition-specific interpretations.
|
|
190
|
+
|
|
191
|
+
```ruby
|
|
192
|
+
# List concepts
|
|
193
|
+
concepts = client.list_concepts
|
|
194
|
+
|
|
195
|
+
# Filter by category
|
|
196
|
+
yoga_concepts = client.list_concepts(category: "yoga")
|
|
197
|
+
|
|
198
|
+
# Get details for dharma
|
|
199
|
+
dharma = client.get_concept("dharma")
|
|
200
|
+
|
|
201
|
+
# Browse glossary
|
|
202
|
+
terms = client.list_glossary
|
|
203
|
+
term = client.get_glossary_term("karma")
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## API Reference
|
|
207
|
+
|
|
208
|
+
| Method | Description |
|
|
209
|
+
|--------|-------------|
|
|
210
|
+
| `list_chapters` | List all 18 Gita chapters |
|
|
211
|
+
| `get_chapter(number)` | Get chapter by number |
|
|
212
|
+
| `list_translations(language:)` | List translations |
|
|
213
|
+
| `get_translation(code)` | Get translation details |
|
|
214
|
+
| `list_verses(chapter:, translation:)` | List verses with filters |
|
|
215
|
+
| `get_verse(chapter, verse, translation:)` | Get a specific verse |
|
|
216
|
+
| `search(query, limit:)` | Search verse texts |
|
|
217
|
+
| `list_commentaries(tradition:)` | List commentaries |
|
|
218
|
+
| `get_commentary(slug)` | Get commentary details |
|
|
219
|
+
| `list_commentary_entries(commentary:, chapter:)` | List commentary entries |
|
|
220
|
+
| `list_upanishads(veda:, principal_only:)` | List Upanishads |
|
|
221
|
+
| `get_upanishad(slug)` | Get Upanishad details |
|
|
222
|
+
| `list_yoga_sutras(pada:)` | List Yoga Sutras |
|
|
223
|
+
| `get_yoga_sutra(slug)` | Get a Yoga Sutra |
|
|
224
|
+
| `list_deities(tradition:, trimurti_only:)` | List Hindu deities |
|
|
225
|
+
| `get_deity(slug)` | Get deity details |
|
|
226
|
+
| `list_concepts(category:)` | List philosophical concepts |
|
|
227
|
+
| `get_concept(slug)` | Get concept details |
|
|
228
|
+
| `list_topics` | List Gita topics |
|
|
229
|
+
| `get_topic(slug)` | Get topic details |
|
|
230
|
+
| `list_glossary` | List Sanskrit glossary |
|
|
231
|
+
| `get_glossary_term(slug)` | Get term definition |
|
|
232
|
+
|
|
233
|
+
## Learn More About Hindu Scripture
|
|
234
|
+
|
|
235
|
+
- **Browse**: [Chapters](https://widegita.com/chapters/) -- [Upanishads](https://widegita.com/upanishads/) -- [Yoga Sutras](https://widegita.com/yoga-sutras/)
|
|
236
|
+
- **Study**: [Deities](https://widegita.com/deities/) -- [Concepts](https://widegita.com/concepts/) -- [Glossary](https://widegita.com/glossary/)
|
|
237
|
+
- **API**: [REST API Docs](https://widegita.com/developers/) -- [OpenAPI Spec](https://widegita.com/api/openapi.json)
|
|
238
|
+
|
|
239
|
+
## WideHoly Scripture Family
|
|
240
|
+
|
|
241
|
+
Part of the [WideHoly](https://wideholy.com) multi-religion scripture platform.
|
|
242
|
+
|
|
243
|
+
| Site | Domain | Focus |
|
|
244
|
+
|------|--------|-------|
|
|
245
|
+
| WideBible | [widebible.com](https://widebible.com) | 66 books, 31,102 verses, KJV/ASV/BBE/YLT, cross-references |
|
|
246
|
+
| WideQuran | [widequran.com](https://widequran.com) | 114 surahs, 6,236 ayahs, hadith collections, tafsir |
|
|
247
|
+
| WideTorah | [widetorah.com](https://widetorah.com) | Tanakh, Talmud tractates, parashot, Rashi commentary |
|
|
248
|
+
| **WideGita** | [widegita.com](https://widegita.com) | **18 chapters, 700 verses, Upanishads, Yoga Sutras** |
|
|
249
|
+
| WideSutra | [widesutra.com](https://widesutra.com) | Tipitaka, Pali Canon, Mahayana sutras, Buddhist figures |
|
|
250
|
+
| WideHoly | [wideholy.com](https://wideholy.com) | Cross-religion search, verse comparison, shared topics |
|
|
251
|
+
|
|
252
|
+
## Also Available
|
|
253
|
+
|
|
254
|
+
| Platform | Install | Link |
|
|
255
|
+
|----------|---------|------|
|
|
256
|
+
| **PyPI** | `pip install widegita` | [PyPI](https://pypi.org/project/widegita/) |
|
|
257
|
+
| **npm** | `npm install widegita` | [npm](https://www.npmjs.com/package/widegita) |
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
MIT
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
module WideGita
|
|
8
|
+
# HTTP client for the WideGita REST API.
|
|
9
|
+
#
|
|
10
|
+
# Zero runtime dependencies -- uses only Ruby stdlib (net/http, json, uri).
|
|
11
|
+
#
|
|
12
|
+
# client = WideGita::Client.new
|
|
13
|
+
# chapters = client.list_chapters
|
|
14
|
+
# verse = client.get_verse(2, 47)
|
|
15
|
+
# results = client.search("dharma")
|
|
16
|
+
#
|
|
17
|
+
class Client
|
|
18
|
+
DEFAULT_BASE_URL = "https://widegita.com/api/v1/gita"
|
|
19
|
+
DEFAULT_TIMEOUT = 10
|
|
20
|
+
|
|
21
|
+
def initialize(base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT)
|
|
22
|
+
@base_url = base_url.chomp("/")
|
|
23
|
+
@timeout = timeout
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# --- Chapters -------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
# List all 18 chapters of the Bhagavad Gita.
|
|
29
|
+
#
|
|
30
|
+
# @return [Hash] paginated list of chapters
|
|
31
|
+
def list_chapters
|
|
32
|
+
get("/chapters/")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get chapter by number (1-18).
|
|
36
|
+
#
|
|
37
|
+
# @param number [Integer] chapter number
|
|
38
|
+
# @return [Hash] chapter details with name, sanskrit_name, verse_count
|
|
39
|
+
def get_chapter(number)
|
|
40
|
+
get("/chapters/#{number}/")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# --- Translations ---------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
# List available Gita translations.
|
|
46
|
+
#
|
|
47
|
+
# @param language [String, nil] filter by language code (e.g. "en", "sa")
|
|
48
|
+
# @return [Hash] paginated list of translations
|
|
49
|
+
def list_translations(language: nil, **params)
|
|
50
|
+
get("/translations/", { language: language }.merge(params))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Get translation by code (e.g. "sivananda", "gambhirananda").
|
|
54
|
+
#
|
|
55
|
+
# @param code [String] translation code
|
|
56
|
+
# @return [Hash] translation details
|
|
57
|
+
def get_translation(code)
|
|
58
|
+
get("/translations/#{code}/")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# --- Verses ---------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
# List Gita verses with optional filters.
|
|
64
|
+
#
|
|
65
|
+
# @param chapter [Integer, nil] filter by chapter number
|
|
66
|
+
# @param translation [String, nil] filter by translation code
|
|
67
|
+
# @return [Hash] paginated list of verses
|
|
68
|
+
def list_verses(chapter: nil, translation: nil, **params)
|
|
69
|
+
get("/verses/", { chapter__number: chapter, translation__code: translation }.merge(params))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Get a specific verse by chapter and verse number.
|
|
73
|
+
#
|
|
74
|
+
# @param chapter [Integer] chapter number (1-18)
|
|
75
|
+
# @param verse [Integer] verse number within the chapter
|
|
76
|
+
# @param translation [String] translation code (default: "sivananda")
|
|
77
|
+
# @return [Hash] verse data with Sanskrit text and translation
|
|
78
|
+
def get_verse(chapter, verse, translation: "sivananda")
|
|
79
|
+
get("/verses/", {
|
|
80
|
+
chapter__number: chapter,
|
|
81
|
+
number: verse,
|
|
82
|
+
translation__code: translation
|
|
83
|
+
})
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Search across verse texts.
|
|
87
|
+
#
|
|
88
|
+
# @param query [String] search query string
|
|
89
|
+
# @param limit [Integer] maximum results (default: 25)
|
|
90
|
+
# @return [Hash] paginated search results
|
|
91
|
+
def search(query, limit: 25)
|
|
92
|
+
get("/verses/", { search: query, page_size: limit })
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# --- Commentaries ---------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
# List Gita commentaries.
|
|
98
|
+
#
|
|
99
|
+
# @param tradition [String, nil] filter by tradition (e.g. "advaita", "dvaita")
|
|
100
|
+
# @return [Hash] paginated list of commentaries
|
|
101
|
+
def list_commentaries(tradition: nil, **params)
|
|
102
|
+
get("/commentaries/", { tradition: tradition }.merge(params))
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Get commentary by slug (e.g. "shankaracharya").
|
|
106
|
+
#
|
|
107
|
+
# @param slug [String] commentary slug
|
|
108
|
+
# @return [Hash] commentary details
|
|
109
|
+
def get_commentary(slug)
|
|
110
|
+
get("/commentaries/#{slug}/")
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# List commentary entries with optional filters.
|
|
114
|
+
#
|
|
115
|
+
# @param commentary [String, nil] filter by commentary slug
|
|
116
|
+
# @param chapter [Integer, nil] filter by chapter number
|
|
117
|
+
# @return [Hash] paginated list of commentary entries
|
|
118
|
+
def list_commentary_entries(commentary: nil, chapter: nil, **params)
|
|
119
|
+
get("/commentary-entries/", { commentary__slug: commentary, chapter__number: chapter }.merge(params))
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# --- Upanishads -----------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
# List Upanishads.
|
|
125
|
+
#
|
|
126
|
+
# @param veda [String, nil] filter by Veda ("rig", "yajur", "sama", "atharva")
|
|
127
|
+
# @param principal_only [Boolean] if true, return only the 10 principal Upanishads
|
|
128
|
+
# @return [Hash] paginated list of Upanishads
|
|
129
|
+
def list_upanishads(veda: nil, principal_only: false, **params)
|
|
130
|
+
p = { veda: veda }.merge(params)
|
|
131
|
+
p[:is_principal] = true if principal_only
|
|
132
|
+
get("/upanishads/", p)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Get Upanishad by slug (e.g. "isha", "kena", "mundaka").
|
|
136
|
+
#
|
|
137
|
+
# @param slug [String] Upanishad slug
|
|
138
|
+
# @return [Hash] Upanishad details
|
|
139
|
+
def get_upanishad(slug)
|
|
140
|
+
get("/upanishads/#{slug}/")
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# --- Yoga Sutras ----------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
# List Yoga Sutras of Patanjali.
|
|
146
|
+
#
|
|
147
|
+
# @param pada [Integer, nil] filter by pada (1=Samadhi, 2=Sadhana, 3=Vibhuti, 4=Kaivalya)
|
|
148
|
+
# @return [Hash] paginated list of sutras
|
|
149
|
+
def list_yoga_sutras(pada: nil, **params)
|
|
150
|
+
get("/yoga-sutras/", { pada: pada }.merge(params))
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Get Yoga Sutra by slug (e.g. "1-2", "2-46").
|
|
154
|
+
#
|
|
155
|
+
# @param slug [String] sutra slug
|
|
156
|
+
# @return [Hash] sutra details
|
|
157
|
+
def get_yoga_sutra(slug)
|
|
158
|
+
get("/yoga-sutras/#{slug}/")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# --- Deities --------------------------------------------------------------
|
|
162
|
+
|
|
163
|
+
# List Hindu deities.
|
|
164
|
+
#
|
|
165
|
+
# @param tradition [String, nil] filter by tradition ("vaishnavism", "shaivism")
|
|
166
|
+
# @param trimurti_only [Boolean] if true, return only Brahma, Vishnu, Shiva
|
|
167
|
+
# @return [Hash] paginated list of deities
|
|
168
|
+
def list_deities(tradition: nil, trimurti_only: false, **params)
|
|
169
|
+
p = { tradition: tradition }.merge(params)
|
|
170
|
+
p[:is_trimurti] = true if trimurti_only
|
|
171
|
+
get("/deities/", p)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Get deity by slug (e.g. "krishna", "shiva", "ganesha").
|
|
175
|
+
#
|
|
176
|
+
# @param slug [String] deity slug
|
|
177
|
+
# @return [Hash] deity details
|
|
178
|
+
def get_deity(slug)
|
|
179
|
+
get("/deities/#{slug}/")
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# --- Concepts -------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
# List Hindu philosophical concepts.
|
|
185
|
+
#
|
|
186
|
+
# @param category [String, nil] filter by category ("yoga", "vedanta")
|
|
187
|
+
# @return [Hash] paginated list of concepts
|
|
188
|
+
def list_concepts(category: nil, **params)
|
|
189
|
+
get("/concepts/", { category: category }.merge(params))
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Get concept by slug (e.g. "dharma", "karma", "moksha").
|
|
193
|
+
#
|
|
194
|
+
# @param slug [String] concept slug
|
|
195
|
+
# @return [Hash] concept details
|
|
196
|
+
def get_concept(slug)
|
|
197
|
+
get("/concepts/#{slug}/")
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# --- Topics ---------------------------------------------------------------
|
|
201
|
+
|
|
202
|
+
# List Gita topics and themes.
|
|
203
|
+
#
|
|
204
|
+
# @return [Hash] paginated list of topics
|
|
205
|
+
def list_topics
|
|
206
|
+
get("/topics/")
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Get topic by slug.
|
|
210
|
+
#
|
|
211
|
+
# @param slug [String] topic slug
|
|
212
|
+
# @return [Hash] topic details
|
|
213
|
+
def get_topic(slug)
|
|
214
|
+
get("/topics/#{slug}/")
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# --- Glossary -------------------------------------------------------------
|
|
218
|
+
|
|
219
|
+
# List Sanskrit glossary terms.
|
|
220
|
+
#
|
|
221
|
+
# @return [Hash] paginated list of glossary terms
|
|
222
|
+
def list_glossary
|
|
223
|
+
get("/glossary/")
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Get glossary term by slug.
|
|
227
|
+
#
|
|
228
|
+
# @param slug [String] term slug
|
|
229
|
+
# @return [Hash] glossary term details
|
|
230
|
+
def get_glossary_term(slug)
|
|
231
|
+
get("/glossary/#{slug}/")
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
private
|
|
235
|
+
|
|
236
|
+
def get(path, params = {})
|
|
237
|
+
uri = URI("#{@base_url}#{path}")
|
|
238
|
+
cleaned = params.each_with_object({}) { |(k, v), h| h[k] = v unless v.nil? }
|
|
239
|
+
uri.query = URI.encode_www_form(cleaned) unless cleaned.empty?
|
|
240
|
+
|
|
241
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
242
|
+
http.use_ssl = uri.scheme == "https"
|
|
243
|
+
http.open_timeout = @timeout
|
|
244
|
+
http.read_timeout = @timeout
|
|
245
|
+
|
|
246
|
+
request = Net::HTTP::Get.new(uri)
|
|
247
|
+
request["Accept"] = "application/json"
|
|
248
|
+
request["User-Agent"] = "widegita-rb/#{VERSION}"
|
|
249
|
+
|
|
250
|
+
response = http.request(request)
|
|
251
|
+
|
|
252
|
+
case response
|
|
253
|
+
when Net::HTTPSuccess
|
|
254
|
+
JSON.parse(response.body)
|
|
255
|
+
when Net::HTTPNotFound
|
|
256
|
+
raise "Not found: #{path}"
|
|
257
|
+
else
|
|
258
|
+
raise "HTTP #{response.code}: #{response.body}"
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
data/lib/widegita.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: widegita
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- dobestan
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: API client for widegita.com. Access 18 Gita chapters, 700 verses with
|
|
14
|
+
Sanskrit text and commentaries, Upanishads, Yoga Sutras of Patanjali, Hindu deities,
|
|
15
|
+
philosophical concepts, topics, and Sanskrit glossary. Zero dependencies.
|
|
16
|
+
email:
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- LICENSE
|
|
22
|
+
- README.md
|
|
23
|
+
- lib/widegita.rb
|
|
24
|
+
- lib/widegita/client.rb
|
|
25
|
+
- lib/widegita/version.rb
|
|
26
|
+
homepage: https://widegita.com
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata:
|
|
30
|
+
homepage_uri: https://widegita.com
|
|
31
|
+
source_code_uri: https://github.com/dobestan/widegita-rb
|
|
32
|
+
changelog_uri: https://github.com/dobestan/widegita-rb/blob/main/CHANGELOG.md
|
|
33
|
+
documentation_uri: https://widegita.com/developers/
|
|
34
|
+
bug_tracker_uri: https://github.com/dobestan/widegita-rb/issues
|
|
35
|
+
post_install_message:
|
|
36
|
+
rdoc_options: []
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '3.0'
|
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '0'
|
|
49
|
+
requirements: []
|
|
50
|
+
rubygems_version: 3.0.3.1
|
|
51
|
+
signing_key:
|
|
52
|
+
specification_version: 4
|
|
53
|
+
summary: Ruby SDK for WideGita — Bhagavad Gita, Upanishads, Yoga Sutras, Hindu encyclopdia
|
|
54
|
+
test_files: []
|