namesilo_client 0.0.1
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/namesilo_client.rb +212 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 62389c4531a2fc1ab8aaaa8e3a52bfb1931032ecc8c834d889695e10251c32c5
|
4
|
+
data.tar.gz: 4b96a5f68f50dd022600eb61aabff436d6533fb9ee22b9d571e50c1c05b3822c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5bf480b7a22da3e9987d51b98bd41b9cf0bc8b38246108ccd294f3c05ebc75844808f5a81d913487a3db538c4a45aecc463e6b70c27dacbf120aa53a65c56b17
|
7
|
+
data.tar.gz: 3409ca0f885af3e105c559d2caf103638d71ce9f63e7d76f7e21d173bf4fa85eeab9393187556817e6a1ae4fd417d07040e4430ef621aa60dddaf81472a81123
|
@@ -0,0 +1,212 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'addressable'
|
4
|
+
|
5
|
+
module NamesiloClient
|
6
|
+
class API
|
7
|
+
|
8
|
+
# Class constructor
|
9
|
+
def initialize(apikey)
|
10
|
+
@apikey = apikey
|
11
|
+
@host = 'https://www.namesilo.com/api/'
|
12
|
+
end
|
13
|
+
|
14
|
+
# Establish connection
|
15
|
+
def get_connection()
|
16
|
+
conn = Faraday.new(:url => @host) do |c|
|
17
|
+
c.use Faraday::Request::UrlEncoded
|
18
|
+
c.use Faraday::Adapter::NetHttp
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Default parameters for Namesilio REST APIs
|
23
|
+
def get_default_parameters()
|
24
|
+
{"version":"1","type":"xml","key":@apikey}
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_request(endpoint)
|
28
|
+
get_connection().get endpoint
|
29
|
+
end
|
30
|
+
|
31
|
+
# Construct URL parameters, combing with default parameters
|
32
|
+
def get_url_parameters(params)
|
33
|
+
uri = Addressable::URI.new
|
34
|
+
uri.query_values = params.merge(get_default_parameters())
|
35
|
+
uri.query
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return namesilo contact information
|
39
|
+
# By default, it returns all contact informaton
|
40
|
+
# Optional parameter: contact_id
|
41
|
+
# e.g. get_contact_list(params={contact_id:'11111111'})
|
42
|
+
def get_contact_list(params={})
|
43
|
+
get_request('contactList?'+get_url_parameters(params)).body
|
44
|
+
end
|
45
|
+
|
46
|
+
# add a contact information
|
47
|
+
# params is a JSON string
|
48
|
+
# required fields:
|
49
|
+
# fn: First Name
|
50
|
+
# ln: Last Name
|
51
|
+
# ad: Mailing Address
|
52
|
+
# cy: Mailing City
|
53
|
+
# st: Mailing State/Province/Territory
|
54
|
+
# If country is US or CA, you must use the correct abbreviation
|
55
|
+
# zp: Mailing Zip/Postal Code
|
56
|
+
# ct: Mailing Country
|
57
|
+
# Country must use the correct abbreviation
|
58
|
+
# em: Email Address
|
59
|
+
# ph: Phone Number
|
60
|
+
# Optional Fields
|
61
|
+
# nn: Nickname (24)
|
62
|
+
# cp: Company (64)
|
63
|
+
# ad2: Mailing Address 2 (128)
|
64
|
+
# fx: Fax (32)
|
65
|
+
# US Fields:
|
66
|
+
# usnc: .US Nexus Category (3) (must use correct abbreviation)
|
67
|
+
# usap: .US Application Purpose (2) (must use correct abbreviation)
|
68
|
+
# CA Optional Fields
|
69
|
+
# calf: CIRA Legal Form (correct abbreviations)
|
70
|
+
# caln: CIRA Language (correct abbreviations)
|
71
|
+
# caag: CIRA Agreement Version (correct abbreviations)
|
72
|
+
# cawd: CIRA WHOIS Display
|
73
|
+
def add_contact(params)
|
74
|
+
get_request('contactAdd?'+get_url_parameters(params)).body
|
75
|
+
end
|
76
|
+
|
77
|
+
# List all domains
|
78
|
+
# Returns XML
|
79
|
+
# xpath: /namesilo/reply/domains/domain
|
80
|
+
def list_domains()
|
81
|
+
get_request('listDomains?'+get_url_parameters({})).body
|
82
|
+
end
|
83
|
+
|
84
|
+
# Get domain info
|
85
|
+
# Parameter: domain name
|
86
|
+
# returns XML containing all domain info
|
87
|
+
# xpath: /namesilo/reply
|
88
|
+
def get_domain_info(domain)
|
89
|
+
get_request('getDomainInfo?'+get_url_parameters({'domain':domain})).body
|
90
|
+
end
|
91
|
+
|
92
|
+
# List DNS records
|
93
|
+
# Parameter: domain name
|
94
|
+
# returns XML containing all DNS records
|
95
|
+
# xpath: /namesilo/reply/resource_record
|
96
|
+
def list_dns_records(domain)
|
97
|
+
get_request('dnsListRecords?'+get_url_parameters({'domain':domain})).body
|
98
|
+
end
|
99
|
+
|
100
|
+
# Add a DNS record
|
101
|
+
# Parameters:
|
102
|
+
# domain: The domain being updated
|
103
|
+
# rrtype: DNS record type, e.g. "A", "AAAA", "CNAME", "MX" and "TXT"
|
104
|
+
# rrhost: hostname for the new record
|
105
|
+
# rrvalue: The value for the resource record
|
106
|
+
# rrdistance: Only used for MX (default is 10 if not provided)
|
107
|
+
# rrttl: The TTL for the new record (default is 7207 if not provided)
|
108
|
+
def add_dns_record(params)
|
109
|
+
get_request('dnsAddRecord?'+get_url_parameters(params)).body
|
110
|
+
end
|
111
|
+
|
112
|
+
# Update DNS record
|
113
|
+
# Parameters:
|
114
|
+
# domain
|
115
|
+
# rrid: The unique ID of the resource record.
|
116
|
+
# rrhost: The hostname
|
117
|
+
# rrvalue: The value for the resource record
|
118
|
+
# rrdistance: Only used for MX
|
119
|
+
# rrttl: The TTL for this record (default is 7207 if not provided)
|
120
|
+
def update_dns_record(params)
|
121
|
+
get_request('dnsUpdateRecord?'+get_url_parameters(params)).body
|
122
|
+
end
|
123
|
+
|
124
|
+
# Delete DNS record
|
125
|
+
# Parameters:
|
126
|
+
# domain
|
127
|
+
# rrid: The unique ID of the resource record
|
128
|
+
def delete_dns_record(params)
|
129
|
+
get_request('dnsDeleteRecord?'+get_url_parameters(params)).body
|
130
|
+
end
|
131
|
+
|
132
|
+
# checkTransferStatus
|
133
|
+
# Parameter: domain name
|
134
|
+
# returns XML containing domain transfer status
|
135
|
+
# xpath: /namesilo/reply
|
136
|
+
def check_transfer_status(domain)
|
137
|
+
get_request('checkTransferStatus?'+get_url_parameters({'domain':domain})).body
|
138
|
+
end
|
139
|
+
|
140
|
+
# checkRegisterAvailability
|
141
|
+
# Parameter: register domain names in JSON, seperated by comma
|
142
|
+
# e.g. {'domains':'namesilo.com,namesilo.net,namesilo.org'}
|
143
|
+
# returns XML with available, unavailable, and invalid domains
|
144
|
+
# xpath: /namesilo/reply
|
145
|
+
def check_register_availability(domains)
|
146
|
+
get_request('checkRegisterAvailability?'+get_url_parameters({'domains':domains})).body
|
147
|
+
end
|
148
|
+
|
149
|
+
# retrieveAuthCode
|
150
|
+
# Have the EPP transfer code for the domain emailed to the administrative contact.
|
151
|
+
def retrieve_auth_code(domain)
|
152
|
+
get_request('retrieveAuthCode?'+get_url_parameters({'domain':domain})).body
|
153
|
+
end
|
154
|
+
|
155
|
+
# Get a list of all active portfolios within your account.
|
156
|
+
# returns XML containing all portfolios
|
157
|
+
# xpath: /namesilo/reply/portfolios
|
158
|
+
def get_portfolio_list()
|
159
|
+
get_request('portfolioList?'+get_url_parameters({})).body
|
160
|
+
end
|
161
|
+
|
162
|
+
# listRegisteredNameServers
|
163
|
+
# returns XML containing all name servers
|
164
|
+
# xpath: /namesilo/reply/hosts
|
165
|
+
def list_name_servers(domain)
|
166
|
+
get_request('listRegisteredNameServers?'+get_url_parameters({'domain':domain})).body
|
167
|
+
end
|
168
|
+
|
169
|
+
# listEmailForwards
|
170
|
+
# returns all email forwards
|
171
|
+
# xpath: /namesilo/reply/addresses
|
172
|
+
def list_email_forwards(domain)
|
173
|
+
get_request('listEmailForwards?'+get_url_parameters({'domain':domain})).body
|
174
|
+
end
|
175
|
+
|
176
|
+
# registrantVerificationStatus
|
177
|
+
# Shows the verification status for any Registrant email addresses
|
178
|
+
# xpath: /namesilo/reply/email
|
179
|
+
def get_registrant_verification_status()
|
180
|
+
get_request('registrantVerificationStatus?'+get_url_parameters({})).body
|
181
|
+
end
|
182
|
+
|
183
|
+
# getAccountBalance
|
184
|
+
# returns current account funds balance.
|
185
|
+
# xpath: /namesilo/reply
|
186
|
+
def get_account_balance()
|
187
|
+
get_request('getAccountBalance?'+get_url_parameters({})).body
|
188
|
+
end
|
189
|
+
|
190
|
+
# getPrices
|
191
|
+
# returns price list
|
192
|
+
# xpath: /namesilo/reply
|
193
|
+
def get_prices()
|
194
|
+
get_request('getPrices?'+get_url_parameters({})).body
|
195
|
+
end
|
196
|
+
|
197
|
+
# listOrders
|
198
|
+
# Returns Complete Account Order History
|
199
|
+
# xpath: /namesilo/reply/order
|
200
|
+
def list_orders()
|
201
|
+
get_request('listOrders?'+get_url_parameters({})).body
|
202
|
+
end
|
203
|
+
|
204
|
+
# orderDetails
|
205
|
+
# returns details for provided order number
|
206
|
+
# xpath: /namesilo/reply
|
207
|
+
def order_details(order_number)
|
208
|
+
get_request('orderDetails?'+get_url_parameters({'order_number':order_number})).body
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: namesilo_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuxi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: addressable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.7'
|
55
|
+
description: Namesilo API client is a wrapper of Namesilo REST APIs.
|
56
|
+
email:
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- lib/namesilo_client.rb
|
62
|
+
homepage: http://rubygems.org/gems/namesilo_client
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.7.3
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Namesilo API client
|
86
|
+
test_files: []
|