namesilo_client 0.0.1 → 0.0.3
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 +4 -4
- data/lib/namesilo_client.rb +385 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46e03aeb20fb1bd7801ddd0aac63737958a0efbc3763b0efa65e69aaed64d733
|
4
|
+
data.tar.gz: 9d304b702865749031a7a3cdd95a672780c67bc312aa77529ea03a8068623e6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e0cf28c14bc8d3cebfda51d49d5c660bff8ed0ec38f16ca845a448515375af8b03f3b2f3d213d3ce37bb4fe7888bbf45fb7d7aa679c180df36d741b598cf9c7
|
7
|
+
data.tar.gz: ec395b999e9d546e4453d4525438956461c3c3068abff998a5b32d1c171df2a822593aab69bb6556f9491b7048b2ba7db214f749746e5620a3f5ada6571aa2cf
|
data/lib/namesilo_client.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'json'
|
3
3
|
require 'addressable'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'dns_record'
|
6
|
+
require 'host'
|
7
|
+
require 'email_forward'
|
4
8
|
|
5
9
|
module NamesiloClient
|
6
10
|
class API
|
@@ -74,6 +78,18 @@ module NamesiloClient
|
|
74
78
|
get_request('contactAdd?'+get_url_parameters(params)).body
|
75
79
|
end
|
76
80
|
|
81
|
+
# contactUpdate
|
82
|
+
# Parameters: see add_contact
|
83
|
+
def update_contact(params)
|
84
|
+
get_request('contactUpdate?'+get_url_parameters(params)).body
|
85
|
+
end
|
86
|
+
|
87
|
+
# contactDelete
|
88
|
+
def delete_contact(contact_id)
|
89
|
+
params={'contact_id':contact_id}
|
90
|
+
get_request('contactDelete?'+get_url_parameters(params)).body
|
91
|
+
end
|
92
|
+
|
77
93
|
# List all domains
|
78
94
|
# Returns XML
|
79
95
|
# xpath: /namesilo/reply/domains/domain
|
@@ -81,6 +97,16 @@ module NamesiloClient
|
|
81
97
|
get_request('listDomains?'+get_url_parameters({})).body
|
82
98
|
end
|
83
99
|
|
100
|
+
# list all domains in Array
|
101
|
+
def list_domains_array()
|
102
|
+
domains = []
|
103
|
+
doc = Nokogiri::XML(list_domains())
|
104
|
+
doc.xpath('/namesilo/reply/domains/domain').each do |domain|
|
105
|
+
domains << domain
|
106
|
+
end
|
107
|
+
domains
|
108
|
+
end
|
109
|
+
|
84
110
|
# Get domain info
|
85
111
|
# Parameter: domain name
|
86
112
|
# returns XML containing all domain info
|
@@ -97,6 +123,24 @@ module NamesiloClient
|
|
97
123
|
get_request('dnsListRecords?'+get_url_parameters({'domain':domain})).body
|
98
124
|
end
|
99
125
|
|
126
|
+
# List DNS records
|
127
|
+
# Returns an array containing DNS record object
|
128
|
+
def list_dns_records_array(domain)
|
129
|
+
dns_records = []
|
130
|
+
doc = Nokogiri::XML(list_dns_records(domain))
|
131
|
+
doc.xpath('/namesilo/reply/resource_record').each do |r|
|
132
|
+
record = DnsRecord.new
|
133
|
+
record.recordid = r.xpath('record_id').text()
|
134
|
+
record.host = r.xpath('host').text()
|
135
|
+
record.type = r.xpath('type').text()
|
136
|
+
record.value = r.xpath('value').text()
|
137
|
+
record.ttl = r.xpath('ttl').text()
|
138
|
+
record.distance = r.xpath('distance').text()
|
139
|
+
dns_records << record
|
140
|
+
end
|
141
|
+
dns_records
|
142
|
+
end
|
143
|
+
|
100
144
|
# Add a DNS record
|
101
145
|
# Parameters:
|
102
146
|
# domain: The domain being updated
|
@@ -166,6 +210,23 @@ module NamesiloClient
|
|
166
210
|
get_request('listRegisteredNameServers?'+get_url_parameters({'domain':domain})).body
|
167
211
|
end
|
168
212
|
|
213
|
+
# list_name_servers_array
|
214
|
+
def list_name_servers_array(domain)
|
215
|
+
name_servers = []
|
216
|
+
doc = Nokogiri::XML(list_name_servers(domain))
|
217
|
+
doc.xpath('/namesilo/reply/hosts').each do |r|
|
218
|
+
h = Host.new
|
219
|
+
h.host = r.xpath('host').text()
|
220
|
+
ips = []
|
221
|
+
r.xpath('ip').each do |ip|
|
222
|
+
ips << ip.text()
|
223
|
+
end
|
224
|
+
h.ips = ips
|
225
|
+
name_servers << h
|
226
|
+
end
|
227
|
+
name_servers
|
228
|
+
end
|
229
|
+
|
169
230
|
# listEmailForwards
|
170
231
|
# returns all email forwards
|
171
232
|
# xpath: /namesilo/reply/addresses
|
@@ -173,6 +234,23 @@ module NamesiloClient
|
|
173
234
|
get_request('listEmailForwards?'+get_url_parameters({'domain':domain})).body
|
174
235
|
end
|
175
236
|
|
237
|
+
# return email forwards array
|
238
|
+
def list_email_forwards_array(domain)
|
239
|
+
email_forwards = []
|
240
|
+
doc = Nokogiri::XML(list_email_forwards(domain))
|
241
|
+
doc.xpath('/namesilo/reply/addresses').each do |a|
|
242
|
+
ef = EmailForward.new
|
243
|
+
ef.email = a.xpath('email').text()
|
244
|
+
fts = []
|
245
|
+
a.xpath('forwards_to').each do |ft|
|
246
|
+
fts << ft.text()
|
247
|
+
end
|
248
|
+
ef.forwards_to = fts
|
249
|
+
email_forwards << ef
|
250
|
+
end
|
251
|
+
email_forwards
|
252
|
+
end
|
253
|
+
|
176
254
|
# registrantVerificationStatus
|
177
255
|
# Shows the verification status for any Registrant email addresses
|
178
256
|
# xpath: /namesilo/reply/email
|
@@ -208,5 +286,312 @@ module NamesiloClient
|
|
208
286
|
get_request('orderDetails?'+get_url_parameters({'order_number':order_number})).body
|
209
287
|
end
|
210
288
|
|
289
|
+
# renewDomain
|
290
|
+
# Parameters (format should be in JSON, e.g. {'domain':'yourdomain.com','years':'1'}):
|
291
|
+
# domain(required): The domain to renew
|
292
|
+
# years(required): The number of years to renew the domain
|
293
|
+
#
|
294
|
+
# payment_id(optional): the id of verified payment method, if not specified, your account balance will be used
|
295
|
+
# coupon(optional): the coupon code used in this transaction
|
296
|
+
def renew_domain(params)
|
297
|
+
get_request('renewDomain?'+get_url_parameters(params)).body
|
298
|
+
end
|
299
|
+
|
300
|
+
# registerDomain
|
301
|
+
# Parameters
|
302
|
+
# domain(required): The domain to renew
|
303
|
+
# years(required): The number of years to renew the domain
|
304
|
+
#
|
305
|
+
# payment_id(optional)
|
306
|
+
# coupon(optional)
|
307
|
+
# private(optional): if the free WHOIS privacy service will be used or not
|
308
|
+
# auto_renew(optional)
|
309
|
+
# portfolio(optional): the name of the portfolio to link the registered domain with
|
310
|
+
# ns1-13(optional): up to 13 name servers to use for the domain registration
|
311
|
+
# contact info(optional): see https://www.namesilo.com/api_reference.php#registerDomain
|
312
|
+
def register_domain(params)
|
313
|
+
get_request('registerDomain?'+get_url_parameters(params)).body
|
314
|
+
end
|
315
|
+
|
316
|
+
# transferDomain
|
317
|
+
# Parameters
|
318
|
+
# domain(required)
|
319
|
+
#
|
320
|
+
# payment_id(optional)
|
321
|
+
# auth(optional): transfer authorization code
|
322
|
+
# private(optional): if you want the domain to utilize our free WHOIS privacy service
|
323
|
+
# auto_renew(optional)
|
324
|
+
# portfolio(optional)
|
325
|
+
# coupon(optional)
|
326
|
+
# Passing Contact Information(optional): see https://www.namesilo.com/api_reference.php#transferDomain
|
327
|
+
# Passing Contact ID(optional): see https://www.namesilo.com/api_reference.php#transferDomain
|
328
|
+
def transfer_domain(params)
|
329
|
+
get_request('transferDomain?'+get_url_parameters(params)).body
|
330
|
+
end
|
331
|
+
|
332
|
+
# transferUpdateChangeEPPCode
|
333
|
+
# Parameters
|
334
|
+
# domain
|
335
|
+
# auth: The EPP code to use
|
336
|
+
def transfer_update_change_epp_code(domain,epp_code)
|
337
|
+
params={'domain':domain,'auth':epp_code}
|
338
|
+
get_request('transferUpdateChangeEPPCode?'+get_url_parameters(params)).body
|
339
|
+
end
|
340
|
+
|
341
|
+
# transferUpdateResendAdminEmail
|
342
|
+
# Parameters
|
343
|
+
# domain
|
344
|
+
def transfer_update_resend_admin_email(domain)
|
345
|
+
params={'domain':domain}
|
346
|
+
get_request('transferUpdateResendAdminEmail?'+get_url_parameters(params)).body
|
347
|
+
end
|
348
|
+
|
349
|
+
# transferUpdateResubmitToRegistry
|
350
|
+
# Parameters
|
351
|
+
# domain
|
352
|
+
def transfer_update_resubmit_to_registry(domain)
|
353
|
+
params={'domain':domain}
|
354
|
+
get_request('transferUpdateResubmitToRegistry?'+get_url_parameters(params)).body
|
355
|
+
end
|
356
|
+
|
357
|
+
# checkTransferAvailability
|
358
|
+
# Parameters
|
359
|
+
# domains: A comma-delimited list of domains
|
360
|
+
def check_transfer_availability(domains)
|
361
|
+
params={'domains':domains}
|
362
|
+
get_request('checkTransferAvailability?'+get_url_parameters(params)).body
|
363
|
+
end
|
364
|
+
|
365
|
+
# contactDomainAssociate
|
366
|
+
# Parameters
|
367
|
+
# domains (required)
|
368
|
+
#
|
369
|
+
# registrant(optional): registrant's contact id
|
370
|
+
# administrative(optional): admin's contact id
|
371
|
+
# billing(optional): billing contact id
|
372
|
+
# technical(optional): technical role contact id
|
373
|
+
def contact_domain_associate(params)
|
374
|
+
get_request('contactDomainAssociate?'+get_url_parameters(params)).body
|
375
|
+
end
|
376
|
+
|
377
|
+
# changeNameServers
|
378
|
+
# Parameters
|
379
|
+
# domain
|
380
|
+
# ns1-ns13: must provide between 2 and 13 name servers
|
381
|
+
def change_name_servers(params)
|
382
|
+
get_request('changeNameServers?'+get_url_parameters(params)).body
|
383
|
+
end
|
384
|
+
|
385
|
+
# dnsSecListRecords
|
386
|
+
# Parameters
|
387
|
+
# domain
|
388
|
+
def list_dns_sec_records(domain)
|
389
|
+
params={'domain':domain}
|
390
|
+
get_request('dnsSecListRecords?'+get_url_parameters(params)).body
|
391
|
+
end
|
392
|
+
|
393
|
+
# dnsSecAddRecord
|
394
|
+
# Parameters
|
395
|
+
# domain
|
396
|
+
# digest: The digest
|
397
|
+
# keyTag: The key tag
|
398
|
+
# digestType: The digest type ( accepted values: https://www.namesilo.com/api_reference.php#dnsSecAddRecord )
|
399
|
+
# alg: see: https://www.namesilo.com/api_reference.php#dnsSecAddRecord
|
400
|
+
def add_dns_sec_record(params)
|
401
|
+
get_request('dnsSecAddRecord?'+get_url_parameters(params)).body
|
402
|
+
end
|
403
|
+
|
404
|
+
# dnsSecDeleteRecord
|
405
|
+
# Parameters: as same as dnsSecAddRecord
|
406
|
+
def del_dns_sec_record(params)
|
407
|
+
get_request('dnsSecDeleteRecord?'+get_url_parameters(params)).body
|
408
|
+
end
|
409
|
+
|
410
|
+
# portfolioAdd
|
411
|
+
# Parameters:
|
412
|
+
# portfolio: The encoded name of the portfolio to add
|
413
|
+
def add_portfolio(portfolio)
|
414
|
+
params={'portfolio':portfolio}
|
415
|
+
get_request('portfolioAdd?'+get_url_parameters(params)).body
|
416
|
+
end
|
417
|
+
|
418
|
+
# portfolioDelete
|
419
|
+
# Parameters:
|
420
|
+
# portfolio: The encoded name of the portfolio to add
|
421
|
+
def delete_portfolio(portfolio)
|
422
|
+
params={'portfolio':portfolio}
|
423
|
+
get_request('portfolioDelete?'+get_url_parameters(params)).body
|
424
|
+
end
|
425
|
+
|
426
|
+
# portfolioDomainAssociate
|
427
|
+
# Parameters:
|
428
|
+
# domains
|
429
|
+
# portfolio
|
430
|
+
def associate_domain_portfolio(portfolio,domains)
|
431
|
+
params={'portfolio':portfolio,'domains':domains}
|
432
|
+
get_request('portfolioDomainAssociate?'+get_url_parameters(params)).body
|
433
|
+
end
|
434
|
+
|
435
|
+
# addRegisteredNameServer: add a registered name server
|
436
|
+
# Parameters:
|
437
|
+
# new_host: the host name
|
438
|
+
# ip1(required): IP Address for new name server
|
439
|
+
# ip2-ip13(optional)
|
440
|
+
def add_registered_name_server(params)
|
441
|
+
get_request('addRegisteredNameServer?'+get_url_parameters(params)).body
|
442
|
+
end
|
443
|
+
|
444
|
+
# modifyRegisteredNameServer
|
445
|
+
# Parameters:
|
446
|
+
# current_host: current host name
|
447
|
+
# new_host: the new host name
|
448
|
+
# ip1
|
449
|
+
# ip2-ip13
|
450
|
+
def modify_registered_name_server(params)
|
451
|
+
get_request('modifyRegisteredNameServer?'+get_url_parameters(params)).body
|
452
|
+
end
|
453
|
+
|
454
|
+
# deleteRegisteredNameServer
|
455
|
+
# Parameters:
|
456
|
+
# current_host: current host name
|
457
|
+
def delete_registered_name_server(hostname)
|
458
|
+
params={'hostname':hostname}
|
459
|
+
get_request('deleteRegisteredNameServer?'+get_url_parameters(params)).body
|
460
|
+
end
|
461
|
+
|
462
|
+
# addPrivacy: Add WHOIS Privacy to a domain
|
463
|
+
# Parameters:
|
464
|
+
# domain
|
465
|
+
def add_privacy(domain)
|
466
|
+
params={'domain':domain}
|
467
|
+
get_request('addPrivacy?'+get_url_parameters(params)).body
|
468
|
+
end
|
469
|
+
|
470
|
+
# removePrivacy
|
471
|
+
# Parameters:
|
472
|
+
# domain
|
473
|
+
def remove_privacy(domain)
|
474
|
+
params={'domain':domain}
|
475
|
+
get_request('removePrivacy?'+get_url_parameters(params)).body
|
476
|
+
end
|
477
|
+
|
478
|
+
# addAutoRenewal: Set a domain to be auto-renewed.
|
479
|
+
def add_auto_renewal(domain)
|
480
|
+
params={'domain':domain}
|
481
|
+
get_request('addAutoRenewal?'+get_url_parameters(params)).body
|
482
|
+
end
|
483
|
+
|
484
|
+
# removeAutoRenewal: set a domain to not be auto-renewed
|
485
|
+
def remove_auto_renewal(domain)
|
486
|
+
params={'domain':domain}
|
487
|
+
get_request('removeAutoRenewal?'+get_url_parameters(params)).body
|
488
|
+
end
|
489
|
+
|
490
|
+
# domainForward
|
491
|
+
# Required parameters:
|
492
|
+
# domain
|
493
|
+
# protocol: http or https
|
494
|
+
# address: the web site address to forward to
|
495
|
+
# method: "301", "302" or "cloaked"
|
496
|
+
#
|
497
|
+
# Optional parameters:
|
498
|
+
# meta_title: The META title for cloaked forward
|
499
|
+
# meta_description
|
500
|
+
# meta_keywords: The META keywords for cloaked forward
|
501
|
+
def forward_domain(params)
|
502
|
+
get_request('domainForward?'+get_url_parameters(params)).body
|
503
|
+
end
|
504
|
+
|
505
|
+
# domainForwardSubDomain
|
506
|
+
# Parameters: as same as forward_domain, plus:
|
507
|
+
# sub_domain
|
508
|
+
def forward_sub_domain(params)
|
509
|
+
get_request('domainForwardSubDomain?'+get_url_parameters(params)).body
|
510
|
+
end
|
511
|
+
|
512
|
+
# domainForwardSubDomainDelete: delete a subdomain forward
|
513
|
+
# Parameters
|
514
|
+
# domain
|
515
|
+
# subdomain
|
516
|
+
def delete_forward_sub_domain(domain, subdomain)
|
517
|
+
params={'domain':domain, 'subdomain':subdomain}
|
518
|
+
get_request('domainForwardSubDomainDelete?'+get_url_parameters(params)).body
|
519
|
+
end
|
520
|
+
|
521
|
+
# domainLock: set a domain to be locked
|
522
|
+
# Parameters
|
523
|
+
# domain
|
524
|
+
def lock_domain(domain)
|
525
|
+
params={'domain':domain}
|
526
|
+
get_request('domainLock?'+get_url_parameters(params)).body
|
527
|
+
end
|
528
|
+
|
529
|
+
# domainUnlock
|
530
|
+
# Parameters
|
531
|
+
# domain
|
532
|
+
def unlock_domain(domain)
|
533
|
+
params={'domain':domain}
|
534
|
+
get_request('domainUnlock?'+get_url_parameters(params)).body
|
535
|
+
end
|
536
|
+
|
537
|
+
# configureEmailForward: create a new email forward or modify an existing email forward
|
538
|
+
# Required parameters
|
539
|
+
# domain
|
540
|
+
# email
|
541
|
+
# forward1: the first email address to foward emails
|
542
|
+
#
|
543
|
+
# Optional parameters
|
544
|
+
# forward2-5
|
545
|
+
def forward_email(params)
|
546
|
+
get_request('configureEmailForward?'+get_url_parameters(params)).body
|
547
|
+
end
|
548
|
+
|
549
|
+
# deleteEmailForward: delete a email forward
|
550
|
+
# Parameters
|
551
|
+
# domain
|
552
|
+
# email
|
553
|
+
def delete_forward_email(domain,email)
|
554
|
+
params={'domain':domain, 'email':email}
|
555
|
+
get_request('deleteEmailForward?'+get_url_parameters(params)).body
|
556
|
+
end
|
557
|
+
|
558
|
+
# emailVerification: sned an email verification message
|
559
|
+
# Parameters
|
560
|
+
# email
|
561
|
+
def email_verification(email)
|
562
|
+
params={'email':email}
|
563
|
+
get_request('emailVerification?'+get_url_parameters(params)).body
|
564
|
+
end
|
565
|
+
|
566
|
+
# addAccountFunds: increase NameSilo account funds balance
|
567
|
+
# Parameters
|
568
|
+
# amount: the amount in US Dollars
|
569
|
+
# payment_id: The ID of the verified credit card
|
570
|
+
def add_account_funds(amount,payment_id)
|
571
|
+
params={'amount':amount,'payment_id':payment_id}
|
572
|
+
get_request('addAccountFunds?'+get_url_parameters(params)).body
|
573
|
+
end
|
574
|
+
|
575
|
+
# marketplaceActiveSalesOverview: a list for all active Marketplace sales in your account.
|
576
|
+
def marketplace_active_sales_overview()
|
577
|
+
params={}
|
578
|
+
get_request('marketplaceActiveSalesOverview?'+get_url_parameters(params)).body
|
579
|
+
end
|
580
|
+
|
581
|
+
# marketplaceAddOrModifySale
|
582
|
+
# Parameters: see https://www.namesilo.com/api_reference.php#marketplaceAddOrModifySale
|
583
|
+
def marketplace_add_sale(params)
|
584
|
+
get_request('marketplaceAddOrModifySale?'+get_url_parameters(params)).body
|
585
|
+
end
|
586
|
+
|
587
|
+
# marketplaceLandingPageUpdate
|
588
|
+
# required parameters
|
589
|
+
# domain
|
590
|
+
#
|
591
|
+
# optional parameters: see https://www.namesilo.com/api_reference.php#marketplaceLandingPageUpdate
|
592
|
+
def marketplace_landing_page_update(params)
|
593
|
+
get_request('marketplaceLandingPageUpdate?'+get_url_parameters(params)).body
|
594
|
+
end
|
595
|
+
|
211
596
|
end
|
212
597
|
end
|