fabulous 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3dfaa3332923d415808730428bcdad8a6e718c2f3fa63d31675d16188c538feb
4
+ data.tar.gz: 21b6a869115e9e1393448b9b2d921d9c1b8ec7d050dec3400ece1dc93569c83a
5
+ SHA512:
6
+ metadata.gz: b8f1b33465e42fa8fc7ad26c2af52634d66bc31dd2ee1eeee61c93b02848e063fa415f7dfc9d3beeb695981ff0e0e9c9a5ff505acad18ab62f2e2208b48f9270
7
+ data.tar.gz: b744a83dc51544a2037da0e058a6c72c1d7fa76bb41a151234bd9767874331d970d4b33dc1c5426363c560cfd3ed6ec9b11cd695f1d92e5fec08882ffa437c11
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Fabulous Ruby Gem Contributors
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/README.md ADDED
@@ -0,0 +1,422 @@
1
+ # Fabulous API Ruby Gem
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/fabulous.svg)](https://badge.fury.io/rb/fabulous)
4
+ [![CI](https://github.com/usiegj00/api-fabulous-com/actions/workflows/ci.yml/badge.svg)](https://github.com/usiegj00/api-fabulous-com/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ A comprehensive Ruby client for the [Fabulous.com API](https://api.fabulous.com/api_reference.html), providing domain management and DNS configuration capabilities.
8
+
9
+ ## Features
10
+
11
+ - Complete domain management (register, renew, transfer, etc.)
12
+ - DNS record management (A, AAAA, CNAME, MX, TXT)
13
+ - Automatic pagination support
14
+ - Comprehensive error handling
15
+ - Ruby 3.0+ support
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ ```ruby
22
+ gem 'fabulous'
23
+ ```
24
+
25
+ And then execute:
26
+
27
+ ```bash
28
+ bundle install
29
+ ```
30
+
31
+ Or install it yourself as:
32
+
33
+ ```bash
34
+ gem install fabulous
35
+ ```
36
+
37
+ ## CLI Usage
38
+
39
+ The gem includes a powerful command-line interface for managing your Fabulous.com domains.
40
+
41
+ ### Setup
42
+
43
+ Create a `.env` file with your credentials:
44
+
45
+ ```bash
46
+ FABULOUS_USERNAME=your_username
47
+ FABULOUS_PASSWORD=your_password
48
+ ```
49
+
50
+ ### Commands
51
+
52
+ #### List domains
53
+ ```bash
54
+ # List all domains (shows name, expiry date)
55
+ fabulous list
56
+
57
+ # Show domains expiring within 30 days
58
+ fabulous expiring 30
59
+
60
+ # Search for specific domains
61
+ fabulous search "example"
62
+
63
+ # Sort and filter options
64
+ fabulous list --sort expiry --expiring 90 --limit 50
65
+ ```
66
+
67
+ Note: The list command shows basic information (domain name and expiry date). For detailed information including auto-renew status, lock status, and nameservers, use the `info` command.
68
+
69
+ #### Domain information
70
+ ```bash
71
+ # Get detailed domain info
72
+ fabulous info example.com
73
+
74
+ # Check domain availability
75
+ fabulous check newdomain.com
76
+ ```
77
+
78
+ #### Portfolio summary
79
+ ```bash
80
+ # Show portfolio statistics
81
+ fabulous summary
82
+ ```
83
+
84
+ #### Nameserver management
85
+ ```bash
86
+ # Get current nameservers
87
+ fabulous nameservers get example.com
88
+
89
+ # Update nameservers
90
+ fabulous nameservers set example.com ns1.cloudflare.com ns2.cloudflare.com
91
+ ```
92
+
93
+ #### DNS records
94
+ ```bash
95
+ # List DNS records
96
+ fabulous dns list example.com
97
+
98
+ # Add DNS records interactively
99
+ fabulous dns add example.com
100
+
101
+ # Filter by record type
102
+ fabulous dns list example.com --type A
103
+ ```
104
+
105
+ ### CLI Options
106
+
107
+ - `--sort [name|expiry|status]` - Sort domains by field
108
+ - `--filter STRING` - Filter domains by name
109
+ - `--expiring N` - Show domains expiring within N days
110
+ - `--limit N` - Number of domains to display
111
+ - `--interactive` - Enable interactive pagination
112
+ - `--help` - Show help for any command
113
+
114
+ ## Configuration
115
+
116
+ Configure the gem with your Fabulous.com API credentials:
117
+
118
+ ```ruby
119
+ require 'fabulous'
120
+
121
+ Fabulous.configure do |config|
122
+ config.username = 'your_username'
123
+ config.password = 'your_password'
124
+
125
+ # Optional settings
126
+ config.timeout = 30 # Request timeout in seconds (default: 30)
127
+ config.open_timeout = 10 # Connection timeout in seconds (default: 10)
128
+ end
129
+ ```
130
+
131
+ ### Environment Variables
132
+
133
+ You can also use environment variables:
134
+
135
+ ```ruby
136
+ Fabulous.configure do |config|
137
+ config.username = ENV['FABULOUS_USERNAME']
138
+ config.password = ENV['FABULOUS_PASSWORD']
139
+ end
140
+ ```
141
+
142
+ ## Usage
143
+
144
+ ### Domain Management
145
+
146
+ #### List All Domains with Pagination
147
+
148
+ ```ruby
149
+ client = Fabulous.client
150
+
151
+ # Get all domains (auto-paginated)
152
+ all_domains = client.domains.all
153
+ all_domains.each do |domain|
154
+ puts "#{domain[:name]} - Expires: #{domain[:expiry_date]}"
155
+ end
156
+
157
+ # Manual pagination
158
+ client.domains.list do |response, page|
159
+ puts "Page #{page} of #{response.page_count}"
160
+ domains = response.data[:domains]
161
+ domains.each do |domain|
162
+ puts domain[:name]
163
+ end
164
+ end
165
+
166
+ # Get specific page
167
+ page_1_domains = client.domains.list(page: 1)
168
+ ```
169
+
170
+ #### Check Domain Availability
171
+
172
+ ```ruby
173
+ if client.domains.check("example.com")
174
+ puts "Domain is available!"
175
+ else
176
+ puts "Domain is taken"
177
+ end
178
+ ```
179
+
180
+ #### Register a Domain
181
+
182
+ ```ruby
183
+ client.domains.register(
184
+ "mynewdomain.com",
185
+ years: 2,
186
+ nameservers: ["ns1.example.com", "ns2.example.com"],
187
+ whois_privacy: true,
188
+ auto_renew: true
189
+ )
190
+ ```
191
+
192
+ #### Get Domain Information
193
+
194
+ ```ruby
195
+ info = client.domains.info("example.com")
196
+ puts "Status: #{info[:status]}"
197
+ puts "Expires: #{info[:expiry_date]}"
198
+ puts "Nameservers: #{info[:nameservers].join(', ')}"
199
+ ```
200
+
201
+ ### Nameserver Management
202
+
203
+ #### Get Current Nameservers
204
+
205
+ ```ruby
206
+ nameservers = client.domains.get_nameservers("example.com")
207
+ nameservers.each { |ns| puts ns }
208
+ ```
209
+
210
+ #### Update Nameservers
211
+
212
+ ```ruby
213
+ new_nameservers = [
214
+ "ns1.cloudflare.com",
215
+ "ns2.cloudflare.com"
216
+ ]
217
+
218
+ client.domains.set_nameservers("example.com", new_nameservers)
219
+ ```
220
+
221
+ ### DNS Record Management
222
+
223
+ #### List DNS Records
224
+
225
+ ```ruby
226
+ # Get all DNS records
227
+ records = client.dns.list_records("example.com")
228
+
229
+ # Get specific record type
230
+ a_records = client.dns.list_records("example.com", type: "A")
231
+ ```
232
+
233
+ #### Manage A Records
234
+
235
+ ```ruby
236
+ # Add A record
237
+ client.dns.add_a_record(
238
+ "example.com",
239
+ hostname: "www",
240
+ ip_address: "192.168.1.1",
241
+ ttl: 3600
242
+ )
243
+
244
+ # Get A records
245
+ a_records = client.dns.a_records("example.com")
246
+
247
+ # Update A record
248
+ client.dns.update_a_record(
249
+ "example.com",
250
+ record_id: "123",
251
+ ip_address: "192.168.1.2"
252
+ )
253
+
254
+ # Delete A record
255
+ client.dns.delete_a_record("example.com", "123")
256
+ ```
257
+
258
+ #### Manage MX Records
259
+
260
+ ```ruby
261
+ # Add MX record
262
+ client.dns.add_mx_record(
263
+ "example.com",
264
+ hostname: "mail.example.com",
265
+ priority: 10,
266
+ ttl: 3600
267
+ )
268
+
269
+ # Get MX records
270
+ mx_records = client.dns.mx_records("example.com")
271
+
272
+ # Update MX record
273
+ client.dns.update_mx_record(
274
+ "example.com",
275
+ record_id: "456",
276
+ priority: 5
277
+ )
278
+
279
+ # Delete MX record
280
+ client.dns.delete_mx_record("example.com", "456")
281
+ ```
282
+
283
+ #### Manage CNAME Records
284
+
285
+ ```ruby
286
+ # Add CNAME record
287
+ client.dns.add_cname_record(
288
+ "example.com",
289
+ alias: "blog",
290
+ target: "blog.example.com",
291
+ ttl: 3600
292
+ )
293
+
294
+ # Get CNAME records
295
+ cname_records = client.dns.cname_records("example.com")
296
+ ```
297
+
298
+ #### Manage TXT Records
299
+
300
+ ```ruby
301
+ # Add TXT record (for SPF, DKIM, etc.)
302
+ client.dns.add_txt_record(
303
+ "example.com",
304
+ hostname: "@",
305
+ text: "v=spf1 include:_spf.google.com ~all",
306
+ ttl: 3600
307
+ )
308
+ ```
309
+
310
+ #### Manage AAAA Records (IPv6)
311
+
312
+ ```ruby
313
+ # Add AAAA record
314
+ client.dns.add_aaaa_record(
315
+ "example.com",
316
+ hostname: "www",
317
+ ipv6_address: "2001:db8::1",
318
+ ttl: 3600
319
+ )
320
+ ```
321
+
322
+ ### Domain Settings
323
+
324
+ ```ruby
325
+ # Lock/Unlock domain
326
+ client.domains.lock("example.com")
327
+ client.domains.unlock("example.com")
328
+
329
+ # Auto-renewal
330
+ client.domains.set_auto_renew("example.com", enabled: true)
331
+ client.domains.set_auto_renew("example.com", enabled: false)
332
+
333
+ # WHOIS Privacy
334
+ client.domains.enable_whois_privacy("example.com")
335
+ client.domains.disable_whois_privacy("example.com")
336
+
337
+ # Renew domain
338
+ client.domains.renew("example.com", years: 2)
339
+
340
+ # Transfer domain
341
+ client.domains.transfer_in("example.com", "AUTH_CODE_HERE")
342
+ ```
343
+
344
+ ## Error Handling
345
+
346
+ The gem provides specific error classes for different scenarios:
347
+
348
+ ```ruby
349
+ begin
350
+ client.domains.list
351
+ rescue Fabulous::AuthenticationError => e
352
+ puts "Authentication failed: #{e.message}"
353
+ rescue Fabulous::RequestError => e
354
+ puts "Bad request: #{e.message} (Code: #{e.code})"
355
+ rescue Fabulous::ResponseError => e
356
+ puts "Server error: #{e.message} (Code: #{e.code})"
357
+ rescue Fabulous::RateLimitError => e
358
+ puts "Rate limit exceeded: #{e.message}"
359
+ rescue Fabulous::TimeoutError => e
360
+ puts "Request timed out: #{e.message}"
361
+ rescue Fabulous::ConfigurationError => e
362
+ puts "Configuration error: #{e.message}"
363
+ rescue Fabulous::Error => e
364
+ puts "General error: #{e.message}"
365
+ end
366
+ ```
367
+
368
+ ## Advanced Usage
369
+
370
+ ### Multiple Client Instances
371
+
372
+ ```ruby
373
+ # Client for account 1
374
+ client1 = Fabulous::Client.new(
375
+ Fabulous::Configuration.new.tap do |c|
376
+ c.username = "user1"
377
+ c.password = "pass1"
378
+ end
379
+ )
380
+
381
+ # Client for account 2
382
+ client2 = Fabulous::Client.new(
383
+ Fabulous::Configuration.new.tap do |c|
384
+ c.username = "user2"
385
+ c.password = "pass2"
386
+ end
387
+ )
388
+ ```
389
+
390
+ ### Batch Operations
391
+
392
+ ```ruby
393
+ domains_to_update = ["domain1.com", "domain2.com", "domain3.com"]
394
+
395
+ domains_to_update.each do |domain|
396
+ begin
397
+ client.domains.set_auto_renew(domain, enabled: true)
398
+ puts "✓ Updated #{domain}"
399
+ rescue Fabulous::Error => e
400
+ puts "✗ Failed #{domain}: #{e.message}"
401
+ end
402
+ end
403
+ ```
404
+
405
+ ## Examples
406
+
407
+ See the `examples/` directory for complete working examples:
408
+ - `list_domains.rb` - Domain listing with pagination examples
409
+ - `manage_nameservers.rb` - Nameserver management examples
410
+ - `complete_examples.rb` - Comprehensive API usage examples
411
+
412
+ ## Development
413
+
414
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
415
+
416
+ ## Contributing
417
+
418
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/fabulous.
419
+
420
+ ## License
421
+
422
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/fabulous ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "fabulous/cli"
6
+
7
+ Fabulous::CLI.start(ARGV)