internetbs 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +5 -0
- data/LICENSE +19 -0
- data/README.md +758 -0
- data/internetbs.gemspec +18 -0
- data/lib/internetbs.rb +64 -0
- data/lib/internetbs/account_balance.rb +8 -0
- data/lib/internetbs/account_balances.rb +40 -0
- data/lib/internetbs/account_domain.rb +11 -0
- data/lib/internetbs/account_domains.rb +100 -0
- data/lib/internetbs/account_price.rb +19 -0
- data/lib/internetbs/account_prices.rb +70 -0
- data/lib/internetbs/account_transaction.rb +9 -0
- data/lib/internetbs/account_transactions.rb +54 -0
- data/lib/internetbs/additional_attributes.rb +41 -0
- data/lib/internetbs/base.rb +33 -0
- data/lib/internetbs/client.rb +49 -0
- data/lib/internetbs/configuration.rb +61 -0
- data/lib/internetbs/country_codes.rb +288 -0
- data/lib/internetbs/domain_availability.rb +37 -0
- data/lib/internetbs/domain_contact.rb +109 -0
- data/lib/internetbs/domain_host.rb +46 -0
- data/lib/internetbs/domain_hosts.rb +101 -0
- data/lib/internetbs/domain_information.rb +128 -0
- data/lib/internetbs/domain_push.rb +33 -0
- data/lib/internetbs/domain_record.rb +31 -0
- data/lib/internetbs/domain_records.rb +172 -0
- data/lib/internetbs/domain_total.rb +8 -0
- data/lib/internetbs/dot_asia_attributes.rb +56 -0
- data/lib/internetbs/dot_de_attributes.rb +64 -0
- data/lib/internetbs/dot_eu_attributes.rb +20 -0
- data/lib/internetbs/dot_fr_attributes.rb +138 -0
- data/lib/internetbs/dot_it_attributes.rb +182 -0
- data/lib/internetbs/dot_nl_attributes.rb +47 -0
- data/lib/internetbs/dot_uk_attributes.rb +60 -0
- data/lib/internetbs/dot_us_attributes.rb +54 -0
- data/lib/internetbs/error.rb +38 -0
- data/lib/internetbs/language_codes.rb +27 -0
- data/lib/internetbs/order_domain.rb +78 -0
- data/lib/internetbs/private_whois.rb +81 -0
- data/lib/internetbs/registrar_lock.rb +73 -0
- data/lib/internetbs/registry_status.rb +39 -0
- data/lib/internetbs/renew_domain.rb +43 -0
- data/lib/internetbs/update_domain.rb +71 -0
- data/lib/internetbs/version.rb +10 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b26ea041a21340a11023abae39fd5298913e336
|
4
|
+
data.tar.gz: b209a17b36787b1118efe77a76a54de953718dae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4bf8421880606c190cbf6b0a708b32d9832c43b30491b48cfa20e0339215dc4fd77d7ce41758d11df3f6541818cec6ff773bb023158cce7a2418729818ddef3
|
7
|
+
data.tar.gz: 6749dfedfaac8253ab6806b8642574b94c57fe8428e3c66271830193017237a4bfefc6cdb9449f8f2a018aeca425f10a9374b14c580f6d70be15080df7295383
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Brightcommerce, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,758 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/internetbs.svg)](https://badge.fury.io/rb/internetbs)
|
2
|
+
|
3
|
+
# InternetBS Client
|
4
|
+
The **InternetBS Client** is a Ruby API client for Internet.bs resellers. This client provides almost all of the functionality exposed by their API. To use this client you will need an API key.
|
5
|
+
|
6
|
+
## Background
|
7
|
+
The **InternetBS Client** is an opinionated client library for the Internet.bs API. We built this library to provide fully automated provisioning of domain names for our client's apps and websites using the Brightcommerce API.
|
8
|
+
|
9
|
+
The **InternetBS Client** provides endpoint access to the API methods that fulfill our requirements. Version 1 of our client is missing domain trade/transfer, domain forwarding and reseller account configuration. We will add domain related API endpoints in version 2.
|
10
|
+
|
11
|
+
The **InternetBS Client** has undergone extensive real-world testing with real domains. We have had difficulty testing some domain extensions as we don't have a presence in the countries that own those TLD's. We provide a list of domain extensions we have tested in the Testing section of this document.
|
12
|
+
|
13
|
+
## About Internet.bs
|
14
|
+
To find out more about Internet.bs please visit their [website](https://www.internetbs.net). You can find out more about the API by reading their [documentation](https://internetbs.net/ResellerRegistrarDomainNameAPI). To use their API you need to have a reseller account, you can find out more about their reseller requirements on their website.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
To install add the line to your `Gemfile`:
|
18
|
+
```
|
19
|
+
gem 'internetbs'
|
20
|
+
```
|
21
|
+
And call `bundle install`.
|
22
|
+
|
23
|
+
Alternatively, you can install it from the terminal:
|
24
|
+
```
|
25
|
+
gem install internetbs
|
26
|
+
```
|
27
|
+
|
28
|
+
## Dependencies
|
29
|
+
The **InternetBS Client** has the following runtime dependencies:
|
30
|
+
- Virtus ~> 1.0.3
|
31
|
+
|
32
|
+
## Compatibility
|
33
|
+
Developed with MRI 2.2, however the `.gemspec` only specifies MRI 2.0. It may work with other flavors, but it hasn't been tested. Please let us know if you encounter any issues.
|
34
|
+
|
35
|
+
## How To Use
|
36
|
+
|
37
|
+
### Prerequisites
|
38
|
+
The **InternetBS Client** requires an API key and password. By default the library will look for your API key and password in the environment variables `INTERNETBS_API_KEY` and `INTERNETBS_API_PWD`. The password is the same as used when logging into your account at their website.
|
39
|
+
|
40
|
+
### Environments
|
41
|
+
The **InternetBS Client** supports multiple environments. These environments don't have to match your application's environments. By default the environments provided by the client are `:production`, `:test` and `:development`. The default environment is `:production` and the credentials for this environment are read from ENV variables.
|
42
|
+
|
43
|
+
If you'd like to override this behavior and provide the API key and/or password directly to the client, setup a configuration initializer as shown below:
|
44
|
+
```ruby
|
45
|
+
InternetBS.configure do |config|
|
46
|
+
config.credentials[:production][:api_key] = "B04B4E74C57C37DE4886"
|
47
|
+
config.credentials[:production][:api_pwd] = "s3kr3t"
|
48
|
+
config.credentials[:production][:api_uri] = "https://api.internet.bs"
|
49
|
+
|
50
|
+
config.credentials[:test][:api_key] = "testapi"
|
51
|
+
config.credentials[:test][:api_pwd] = "testpass"
|
52
|
+
config.credentials[:test][:api_uri] = "https://testapi.internet.bs"
|
53
|
+
|
54
|
+
config.credentials[:development][:api_key] = "testapi"
|
55
|
+
config.credentials[:development][:api_pwd] = "testpass"
|
56
|
+
config.credentials[:development][:api_uri] = "https://testapi.internet.bs"
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
Or pass the values directly to the attributes on the `InternetBS` namespace:
|
61
|
+
```ruby
|
62
|
+
# Set the environment to development:
|
63
|
+
InternetBS.environment = :development
|
64
|
+
|
65
|
+
# The set the credentials:
|
66
|
+
InternetBS.api_key = "B04B4E74C57C37DE4886"
|
67
|
+
InternetBS.api_pwd = "s3kr3t"
|
68
|
+
InternetBS.api_uri = "https://api.internet.bs"
|
69
|
+
```
|
70
|
+
|
71
|
+
The **InternetBS Client** provides flexibility by allowing you to use whatever credentials you want in whatever environment you want. You can, for instance, add a `:staging` environment if you want:
|
72
|
+
```ruby
|
73
|
+
InternetBS.credentials[:staging][:api_key] = "44CD64EEEFFF887755560B"
|
74
|
+
InternetBS.credentials[:staging][:api_pwd] = "another_pass"
|
75
|
+
InternetBS.credentials[:staging][:api_uri] = "https://api.internet.bs"
|
76
|
+
```
|
77
|
+
|
78
|
+
You can query the current environments also:
|
79
|
+
```ruby
|
80
|
+
InternetBS.environments #=> [:production, :test, :development, :staging]
|
81
|
+
```
|
82
|
+
|
83
|
+
And the current environment:
|
84
|
+
```ruby
|
85
|
+
InternetBS.environment #=> :development
|
86
|
+
```
|
87
|
+
|
88
|
+
### API Calls
|
89
|
+
The **InternetBS Client** provides access to the following Internet.bs API endpoints:
|
90
|
+
|
91
|
+
API Endpoint | Description
|
92
|
+
--- | ---
|
93
|
+
[Account/Balance/Get](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/01_account_balance_get) | The command is intended to retrieve the prepaid account balance.
|
94
|
+
[Account/Pricelist/Get](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/06_account_price_list_get) | The command is intended to obtain our pricelist.
|
95
|
+
[Domain/Check](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/01_domain_check) | The command is intended to check whether a domain is available for registration or not.
|
96
|
+
[Domain/Create](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/02_domain_create) | The command is intended to register a new domain.
|
97
|
+
[Domain/Update](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/03_domain_update) | The command is intended to update a domain.
|
98
|
+
[Domain/Renew](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/04_domain_renew) | The command is intended to renew a domain.
|
99
|
+
[Domain/Info](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/05_domain_info) | The command is intended to return full details about a domain name.
|
100
|
+
[Domain/List](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/06_domain_list) | This command is intended to retrieve a list of domains in your account.
|
101
|
+
[Domain/RegistryStatus](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/07_domain_registry_status) | The command is intended to view a domain registry status.
|
102
|
+
[Domain/Push](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/08_domain_push) | The command is intended to move a domain from one account to another.
|
103
|
+
[Domain/Count](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/09_domain_count) | The command is intended to count total number of domains in the account.
|
104
|
+
[Domain/PrivateWhois/Enable](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/02_private_whois/01_domain_private_whois_enable) | The command is a purposely redundant auxiliary way to enable Private Whois for a specific domain.
|
105
|
+
[Domain/PrivateWhois/Disable](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/02_private_whois/02_domain_private_whois_disable) | The command is a purposely redundant auxiliary way to disable Private Whois for a specific domain.
|
106
|
+
[Domain/PrivateWhois/Status](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/02_private_whois/03_domain_private_whois_status) | The command is a purposely redundant auxiliary way to obtain the Private Whois status for a specific domain.
|
107
|
+
[Domain/RegistrarLock/Enable](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/03_registrar_lock/01_domain_registrar_lock_enable) | The command is a purposely redundant auxiliary way to enable the RegistrarLock for a specific domain.
|
108
|
+
[Domain/RegistrarLock/Disable](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/03_registrar_lock/02_domain_registrar_lock_disable) | The command is a purposely redundant auxiliary way to disable the RegistrarLock for a specific domain.
|
109
|
+
[Domain/RegistrarLock/Status](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/03_registrar_lock/03_domain_registrar_lock_status) | The command is a purposely redundant auxiliary way to retrieve the current RegistrarLock status for specific domain.
|
110
|
+
[Domain/DnsRecord/Add](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/05_dns_management_related/01_domain_dns_record_add) | The command is intended to add a new DNS record to a specific zone (domain).
|
111
|
+
[Domain/DnsRecord/Remove](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/05_dns_management_related/02_domain_dns_record_remove) | The command is intended to remove a DNS record from a specific zone.
|
112
|
+
[Domain/DnsRecord/Update](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/05_dns_management_related/03_domain_dns_record_update) | The command is intended to update an existing DNS record.
|
113
|
+
[Domain/DnsRecord/List](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/05_dns_management_related/04_domain_dns_record_list) | The command is intended to retrieve the list of DNS records for a specific domain.
|
114
|
+
[Domain/Host/Create](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/07_nameservers_related/01_domain_host_create) | The command is intended to create a host also known as name server or child host.
|
115
|
+
[Domain/Host/Update](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/07_nameservers_related/02_domain_host_update) | The command is intended to update a host; the command is replacing the current list of IP for the host with the new one you provide.
|
116
|
+
[Domain/Host/Info](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/07_nameservers_related/03_domain_host_info) | The command is intended to retrieve existing host (name server) information for a specific host.
|
117
|
+
[Domain/Host/Delete](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/07_nameservers_related/04_domain_host_delete) | The command is intended to delete (remove) an unwanted host.
|
118
|
+
[Domain/Host/List](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/07_nameservers_related/05_domain_host_list) | The command is intended to retrieve the list of hosts defined for a domain.
|
119
|
+
|
120
|
+
The **InternetBS Client** does not provide access to the following Internet.bs API endpoints. They are currently slated for Version 2:
|
121
|
+
|
122
|
+
API Endpoint | Description
|
123
|
+
--- | ---
|
124
|
+
[Domain/Transfer/Initiate](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/01_domain_transfer_initiate) | The command is intended to initiate an incoming domain name transfer.
|
125
|
+
[Domain/Transfer/Cancel](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/02_domain_transfer_cancel) | The command is intended to cancel a pending incoming transfer request.
|
126
|
+
[Domain/Transfer/ResendAuthEmail](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/03_domain_transfer_resend_auth_email) | The command is intended to resend the Initial Authorization for the Registrar Transfer email for a pending, incoming transfer request.
|
127
|
+
[Domain/TransferAway/Approve](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/04_domain_transfer_away_approve) | The command is intended to immediately approve a pending, outgoing transfer request (you are transferring a domain away).
|
128
|
+
[Domain/TransferAway/Reject](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/05_domain_transfer_away_reject) | The command is intended to reject a pending, outgoing transfer request (you are transferring away a domain).
|
129
|
+
[Domain/Transfer/History](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/06_domain_transfer_history) | The command is intended to retrieve the history of a transfer.
|
130
|
+
[Domain/Transfer/Retry](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/07_domain_transfer_retry) | This command is intended to reattempt a transfer in case an error occurred because inaccurate transfer auth info was provided or because the domain was locked or in some other cases where an intervention by the customer is required before retrying the transfer.
|
131
|
+
[Domain/Trade](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/08_domain_trade) | The command is used to initiate a .fr/.re/.pm/.yt/.tf/.wf trade.
|
132
|
+
[Domain/ChangeTag/DotUK](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/04_transfer_trade/09_domain_change_tag_uk) | The command is intended for transferring away a .uk domain.
|
133
|
+
|
134
|
+
The **InternetBS Client** *does not* provide access to the following Internet.bs API endpoints and not currently slated for inclusion since they not likely to be required by the Brightcommerce API. If there are significant requests for these endpoints to be included we'll consider adding them. If you would like to add them yourself, we'll be happy to accept merge requests as long as the coding style remains congruent.
|
135
|
+
|
136
|
+
API Endpoint | Description
|
137
|
+
--- | ---
|
138
|
+
[Domain/EmailForward/Add](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/01_domain_email_forward_add) | The command is intended to add a new Email Forwarding rule.
|
139
|
+
[Domain/EmailForward/Remove](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/02_domain_email_forward_remove) | The command is intended to remove an existing Email Forwarding rule.
|
140
|
+
[Domain/EmailForward/Update](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/03_domain_email_forward_update) | The command is intended to update an existing Email Forwarding rule.
|
141
|
+
[Domain/EmailForward/List](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/04_domain_email_forward_list) | The command is intended to retrieve the list of email forwarding rules for a domain.
|
142
|
+
[Domain/UrlForward/Add](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/05_domain_url_forward_add) | The command is intended to add a new URL Forwarding rule.
|
143
|
+
[Domain/UrlForward/Remove](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/06_domain_url_forward_remove) | The command is intended to remove an existing URL Forwarding rule.
|
144
|
+
[Domain/UrlForward/Update](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/07_domain_url_forward_update) | The command is intended to update an existing URL Forwarding rule.
|
145
|
+
[Domain/UrlForward/List](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/06_forwarding_related/08_domain_url_forward_list) | The command is intended to retrieve the list of URL forwarding rules for a domain.
|
146
|
+
[Account/Configuration/Get](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/04_account_configuration_get) | The command is intended to view the account configuration.
|
147
|
+
[Account/Configuration/Set](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/05_account_configuration_set) | The command allows you to set the available configuration values for the API.
|
148
|
+
[Account/DefaultCurrency/Get](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/02_account_currency_get) | The command is intended to set the default currency.
|
149
|
+
[Account/DefaultCurrency/Set](https://internetbs.net/ResellerRegistrarDomainNameAPI/api/08_account_related/03_account_currency_set) | The command is intended to set the default currency.
|
150
|
+
|
151
|
+
## How To Use
|
152
|
+
We've attempted to make the **InternetBS Client** interface as consistent as possible. We send requests as follows to the Internet.bs API endpoints:
|
153
|
+
- All requests are `GET` or `POST` requests. The Internet.bs API doesn't accept `PATCH`, `PUT` or `DELETE` requests.
|
154
|
+
- Calling read-only endpoints use the `GET` HTTP verb and pass parameters as URL-endcoded.
|
155
|
+
- Calling endpoints that make changes, ie. create, update or delete requests, use the `POST` HTTP verb and send parameters as `x-www-form-urlencoded` in the request body.
|
156
|
+
- As specified by the Internet.bs API, only SSL-secured endpoints using the HTTPS protocol are called.
|
157
|
+
- The resellers API key and password are passed as parameters.
|
158
|
+
- The `responseformat` parameter requesting a JSON-encoded response is sent with every request.
|
159
|
+
|
160
|
+
The **InternetBS Client** breaks the API into consistent logical domain models. The models are backed by Virtus Model and most provide a `#fetch` method. Where a model performs a specific action the method will be named, and the parameters for the model must be provided as attributes on the class. Every call performs some validation before executing the API call. If the validation fails, the call will exit early, return `false` and any exceptions are made available in the `#errors` collection attribute.
|
161
|
+
|
162
|
+
Following are examples of how to instanciate each class with attributes where necessary, and the properties that can be queried on the class after each API call. All example information including names, addresses and other details are completely fictional and provided to give context.
|
163
|
+
|
164
|
+
### Account Balances
|
165
|
+
Fetch the current reseller account balances for each currency. Balances are returned as a collection of `AccountBalance`.
|
166
|
+
```ruby
|
167
|
+
@balances = InternetBS::AccountBalances.new
|
168
|
+
|
169
|
+
result = @balances.fetch #=> true
|
170
|
+
|
171
|
+
# Alternatively you pass the currency you're interested in:
|
172
|
+
@balances.currency = 'USD'
|
173
|
+
result = @balances.fetch #=> true
|
174
|
+
|
175
|
+
# If the fetch method fails it will return false
|
176
|
+
# and populate the errors collection attribute:
|
177
|
+
unless result
|
178
|
+
@balances.errors.each do |error|
|
179
|
+
puts error
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Iterate the collection of balances:
|
184
|
+
@balances.each do |balance|
|
185
|
+
puts balance.amount #=> 1234.56
|
186
|
+
puts balance.currency #=> 'USD'
|
187
|
+
end
|
188
|
+
```
|
189
|
+
|
190
|
+
### Account Domains
|
191
|
+
Fetch a list of domains and domain counts for the currect reseller account. Domains are returned as a collection of `AccountDomain`.
|
192
|
+
```ruby
|
193
|
+
@domains = InternetBS::AccountDomains.new
|
194
|
+
|
195
|
+
result = @domains.fetch #=> true
|
196
|
+
|
197
|
+
# If the fetch method fails it will return false
|
198
|
+
# and populate the errors collection attribute:
|
199
|
+
if result == false
|
200
|
+
@account.errors.each do |error|
|
201
|
+
puts error
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Iterate the collection of domains:
|
206
|
+
@domains.list.each do |domain|
|
207
|
+
puts domain.name #=> 'example.com'
|
208
|
+
end
|
209
|
+
```
|
210
|
+
|
211
|
+
#### Options
|
212
|
+
To customize the results returned you can set the following options as attributes on the class:
|
213
|
+
|
214
|
+
Option | Class | Description
|
215
|
+
--- | --- | ---
|
216
|
+
`#compact_list` | Boolean | If `true` the list of domains returned will consist solely of domain names, if `false` the list of domains returned will contain additional information such as expiration date, epp auth info, status and registrar lock status. The default value is `true`.
|
217
|
+
`#expiring_only` | Boolean | If `true` will restrict list of domains returned to those that are expiring. This cannot be used in conjunction with `#pending_transfer_only`. The default value is `false`.
|
218
|
+
`#extension_filter` | String | A comma-separated list of domain extensions e.g. `com,net,org,co.uk`.
|
219
|
+
`#pending_transfer_only` | Boolean | If `true` will restrict list of domains returned to those that are in Pending Transfer status.
|
220
|
+
`#range_from`, `#range_to` | Integer | If you want the listing to be paginated use these two parameters, they represent page numbers.
|
221
|
+
`#search_term_filter` | String | Retrieve a list of domains that contain a specific text.
|
222
|
+
`#sort_by` | String | specify a sorting criteria. Possible values are: `DOMAIN_NAME`, `DOMAIN_NAME_DESC`, `EXPIRATION`, `EXPIRATION_DESC`. The default value is `DOMAIN_NAME`.
|
223
|
+
|
224
|
+
#### Retrieving Totals
|
225
|
+
To retrieve the number of domains in an account, the **InternetBS Client** provides the following method:
|
226
|
+
|
227
|
+
Method | Description
|
228
|
+
--- | ---
|
229
|
+
`#totals` | Call this method to retrieve the total number of domains. The number of domains can be queried on the `#total_domains` attribute. The total of number for each TLD can be queried on the `#total_domains_by_tld` attribute.
|
230
|
+
|
231
|
+
### Account Prices
|
232
|
+
Fetch the price list for the current reseller. Prices are returned as a collection of `AccountPrice`.
|
233
|
+
```ruby
|
234
|
+
@prices = InternetBS::AccountPrices.new
|
235
|
+
|
236
|
+
result = @prices.fetch #=> true
|
237
|
+
|
238
|
+
# If the fetch method fails it will return false
|
239
|
+
# and populate the errors collection attribute:
|
240
|
+
if result == false
|
241
|
+
@prices.errors.each do |error|
|
242
|
+
puts error
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
@prices.list #=> an enumerable array of InternetBS::AccountPrice
|
247
|
+
@prices.list.size #=> 39
|
248
|
+
|
249
|
+
# Enumerate each
|
250
|
+
@prices.list.each do |price|
|
251
|
+
puts price.name
|
252
|
+
...
|
253
|
+
end
|
254
|
+
|
255
|
+
# AccountPrice properties
|
256
|
+
price = @prices.list.select { |p|
|
257
|
+
p.name == '.com' && p.operation == 'registration'
|
258
|
+
}
|
259
|
+
price.is_a?(InternetBS::AccountPrice) #=> true
|
260
|
+
price.currency #=> USD
|
261
|
+
price.name #=> .com
|
262
|
+
price.operation #=> registration
|
263
|
+
price.price_1_year #=> 8.99
|
264
|
+
price.price_2_years #=> 8.95
|
265
|
+
price.price_3_years #=> 8.93
|
266
|
+
price.price_4_years #=> 8.91
|
267
|
+
price.price_5_years #=> 8.89
|
268
|
+
price.price_6_years #=> 8.87
|
269
|
+
price.price_7_years #=> 8.85
|
270
|
+
price.price_8_years #=> 8.83
|
271
|
+
price.price_9_years #=> 8.81
|
272
|
+
price.price_10_years #=> 8.79
|
273
|
+
|
274
|
+
# Display the price level (only available from version 2 query):
|
275
|
+
@prices.level #=> Basic
|
276
|
+
```
|
277
|
+
|
278
|
+
#### Options
|
279
|
+
The following options are available as attributes on the `AccountPrices` class. Set these attributes before calling `#fetch`.
|
280
|
+
|
281
|
+
Option | Class | Description
|
282
|
+
--- | --- | ---
|
283
|
+
`#version` | Integer | Pass `1` or `2` for the version attribute to fetch prices. Version 1 will retrieve prices for one year. Version 2 will retrieve prices for 10 years.
|
284
|
+
`#currency` | String | Retrieve the price list in a specific currency. By default the list will be retrieved in `USD`.
|
285
|
+
`#discount_code` | String | Apply a discount to the retrieved price list.
|
286
|
+
|
287
|
+
### Domain Availability
|
288
|
+
Check whether a domain is available for registration or not.
|
289
|
+
```ruby
|
290
|
+
@domain = InternetBS::DomainAvailability.new(:domain => 'acme.com')
|
291
|
+
|
292
|
+
result = @domain.fetch #=> true
|
293
|
+
|
294
|
+
# If the fetch method fails it will return false
|
295
|
+
# and populate the errors collection attribute:
|
296
|
+
unless result
|
297
|
+
@domain.errors.each do |error|
|
298
|
+
puts error
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
# Is the domain available?
|
303
|
+
puts @domain.status #=> true
|
304
|
+
|
305
|
+
# Other properties you can check:
|
306
|
+
puts @domain.transaction_id #=> 234678268342423876
|
307
|
+
puts @domain.max_registration_period #=> 10 # years
|
308
|
+
puts @domain.min_registration_period #=> 1 # year
|
309
|
+
puts @domain.private_whois_allowed #=> true
|
310
|
+
puts @domain.realtime_registration #=> true
|
311
|
+
puts @domain.registrar_lock_allowed #=> true
|
312
|
+
```
|
313
|
+
|
314
|
+
### Domain Information
|
315
|
+
Check whether a domain is available for registration or not.
|
316
|
+
```ruby
|
317
|
+
@domain = InternetBS::DomainInformation.new(:domain => 'acme.com')
|
318
|
+
|
319
|
+
result = @domain.fetch #=> true
|
320
|
+
|
321
|
+
# If the fetch method fails it will return false
|
322
|
+
# and populate the errors collection attribute:
|
323
|
+
unless result
|
324
|
+
@domain.errors.each do |error|
|
325
|
+
puts error
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
# DomainInformation properties:
|
330
|
+
puts @domain.domain_status #=> REGISTERED
|
331
|
+
puts @domain.auto_renew #=> false
|
332
|
+
puts @domain.domain_extension #=> .com
|
333
|
+
puts @domain.expiration_date #=> 2011/03/05
|
334
|
+
puts @domain.private_whois #=> FULL
|
335
|
+
puts @domain.registrar_lock #=> ENABLED
|
336
|
+
puts @domain.transfer_auth_info #=> 1542c06388d8e03e14613788ca6bd914
|
337
|
+
puts @domain.contacts #=> array of DomainContact, see below
|
338
|
+
```
|
339
|
+
|
340
|
+
#### Domain Contacts
|
341
|
+
```ruby
|
342
|
+
# Iterate domain contacts:
|
343
|
+
@domain.contacts.each do |contact|
|
344
|
+
puts contact.contact_type #=> :registrant
|
345
|
+
puts contact.city
|
346
|
+
puts contact.country
|
347
|
+
puts contact.country_code
|
348
|
+
puts contact.email
|
349
|
+
puts contact.fax
|
350
|
+
puts contact.first_name
|
351
|
+
puts contact.last_name
|
352
|
+
puts contact.obfuscate_email #=> true
|
353
|
+
puts contact.organization
|
354
|
+
puts contact.phone_number
|
355
|
+
puts contact.postal_code
|
356
|
+
puts contact.street
|
357
|
+
puts contact.street_2
|
358
|
+
puts contact.street_3
|
359
|
+
puts contact.additional_attributes # see below
|
360
|
+
end
|
361
|
+
```
|
362
|
+
|
363
|
+
#### Domain Contact Additional Attributes
|
364
|
+
Some domain extensions have additional attributes. Listed below are the additional attributes for each domain extension.
|
365
|
+
|
366
|
+
##### .ASIA TLD
|
367
|
+
CED is an acronym for Charter Eligibility Declaration.
|
368
|
+
|
369
|
+
Attribute | Type | Required?
|
370
|
+
--- | --- | ---
|
371
|
+
ced_locality | String | YES
|
372
|
+
ced_entity | String (only `CED_ENTITY_TYPES`) | YES
|
373
|
+
ced_entity_other | String | YES if `ced_entity == 'other'`
|
374
|
+
ced_id_form | String (only `CED_ID_FORM_TYPES`) | YES
|
375
|
+
ced_id_form_other | String | YES if `ced_id_form == 'other'`
|
376
|
+
ced_city | String | NO
|
377
|
+
ced_id_number | String | NO
|
378
|
+
ced_state_province | String | NO
|
379
|
+
|
380
|
+
##### .DE TLD
|
381
|
+
Attribute | Type | Required?
|
382
|
+
--- | --- | ---
|
383
|
+
role | String (only `ROLES`) | YES
|
384
|
+
ip_address | String | YES
|
385
|
+
disclose_name | Boolean (default `false`) | YES
|
386
|
+
disclose_contact | Boolean (default `false`) | YES
|
387
|
+
disclose_address | Boolean (default `false`) | YES
|
388
|
+
remark | String | NO
|
389
|
+
sip_uri | String | NO
|
390
|
+
terms_accepted | Boolean (default `false`) | YES
|
391
|
+
|
392
|
+
##### .EU TLD
|
393
|
+
Attribute | Type | Required?
|
394
|
+
--- | --- | ---
|
395
|
+
language | String (only `LANGUAGE_CODES`) | YES
|
396
|
+
|
397
|
+
##### .FR TLD
|
398
|
+
Attribute | Type | Required?
|
399
|
+
--- | --- | ---
|
400
|
+
entity_type | String (only `CONTACT_ENTITY_TYPES`) | YES
|
401
|
+
entity_name | String | YES if `entity_type == COMPANY,TRADEMARK,ASSOCIATION,ENTITY`
|
402
|
+
entity_vat | String | NO
|
403
|
+
entity_siren | String | NO
|
404
|
+
entity_duns | String | NO
|
405
|
+
entity_trade_mark | String | YES if `entity_type == TRADEMARK`
|
406
|
+
entity_waldec | String | YES if `entity_type == ASSOCIATION`
|
407
|
+
entity_date_of_association | Date (`YYYY-MM-DD`) | YES if `entity_type == ASSOCIATION`
|
408
|
+
entity_date_of_publication | Date (`YYYY-MM-DD`) | YES if `entity_type == ASSOCIATION`
|
409
|
+
entity_gazette_announcement_number | String | YES if `entity_type == ASSOCIATION`
|
410
|
+
entity_gazette_page_number | String | YES if `entity_type == ASSOCIATION`
|
411
|
+
entity_birth_date | Date (`YYYY-MM-DD`) | NO
|
412
|
+
entity_birth_place_country_code | String (only `COUNTRY_CODES`) | NO
|
413
|
+
entity_birth_city | String | NO
|
414
|
+
entity_birth_place_postal_code | String | NO
|
415
|
+
entity_restricted_publication | Boolean | NO
|
416
|
+
other_contact_entity | String |
|
417
|
+
|
418
|
+
##### .IT TLD
|
419
|
+
Attribute | Type | Required?
|
420
|
+
--- | --- | ---
|
421
|
+
entity_type | String (only `ENTITY_TYPES`) | YES
|
422
|
+
nationality | String (only `COUNTRY_CODES`) | YES
|
423
|
+
reg_code | String | YES
|
424
|
+
hide_whois | Boolean (default `false`) | YES
|
425
|
+
province | String (only `PROVINCIAL_CODES` | YES if `nationality == IT`
|
426
|
+
terms_1_accepted | Boolean (default `false`) | YES
|
427
|
+
terms_2_accepted | Boolean (default `false`) | YES
|
428
|
+
terms_3_accepted | Boolean (default `false`) | YES
|
429
|
+
terms_4_accepted | Boolean (default `false`) | YES
|
430
|
+
ip_address | String | YES
|
431
|
+
|
432
|
+
##### .NL TLD
|
433
|
+
Attribute | Type | Required?
|
434
|
+
--- | --- | ---
|
435
|
+
ip_address | String | YES
|
436
|
+
legal_form | String (only `LEGAL_FORMS`) | YES
|
437
|
+
registration_number | String | NO
|
438
|
+
terms_accepted | Boolean (default `false`) | YES
|
439
|
+
|
440
|
+
##### .UK TLD
|
441
|
+
Attribute | Type | Required?
|
442
|
+
--- | --- | ---
|
443
|
+
county | String | YES
|
444
|
+
organization_type | String (only `ORGANIZATION_TYPES`) | YES
|
445
|
+
organization_number | String | YES if `organization_type == LTD,PLC,LLP,IP,SCH,RCHAR`
|
446
|
+
registration_number | String | YES if `organization_type == LTD,PLC,LLP,IP,SCH,RCHAR`
|
447
|
+
opt_out | Boolean (default `false`) | YES if `organization_type == FIND,IND`
|
448
|
+
|
449
|
+
##### .US TLD
|
450
|
+
Attribute | Type | Required?
|
451
|
+
--- | --- | ---
|
452
|
+
purpose | String (only `PURPOSES`) | YES
|
453
|
+
nexus_category | String (only `NEXUS_CATEGORIES`) | YES
|
454
|
+
nexus_country | String (only `COUNTRY_CODES`) | YES if `nexus_category == C31,C32`
|
455
|
+
|
456
|
+
### Domain Hosts (Name Servers)
|
457
|
+
Add, update, remove and list domain host records, otherwise known as name servers or child hosts.
|
458
|
+
```ruby
|
459
|
+
@ns = InternetBS::DomainHosts.new(:domain => 'acme.com')
|
460
|
+
|
461
|
+
# TODO: Document `:compact => false` # default is true
|
462
|
+
|
463
|
+
result = @ns.fetch #=> true
|
464
|
+
|
465
|
+
# If the fetch method fails it will return false
|
466
|
+
# and populate the errors collection attribute:
|
467
|
+
if result == false
|
468
|
+
@ns.errors.each do |err|
|
469
|
+
puts err
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
@ns.list #=> an array of DomainHost
|
474
|
+
@ns.list.size #=> 3
|
475
|
+
|
476
|
+
# Enumerate each
|
477
|
+
@ns.list.each do |ns|
|
478
|
+
puts ns.host
|
479
|
+
end
|
480
|
+
|
481
|
+
# DomainHost properties
|
482
|
+
ns = @ns.list.first
|
483
|
+
ns.is_a?(DomainHost) #=> true
|
484
|
+
puts ns.host #=> ns1.someregistrar.com
|
485
|
+
puts ns.ip_addresses #> [111.222.333.444]
|
486
|
+
|
487
|
+
# Add a domain host (pass in a DomainHost instance):
|
488
|
+
ns4 = InternetBS::DomainHost.new(
|
489
|
+
:host => "ns4.acme.com",
|
490
|
+
:ip_addresses => ['112.223.334.445'] # array of one or more ip addresses
|
491
|
+
)
|
492
|
+
|
493
|
+
@hosts = DomainHosts.new(:domain => 'acme.com')
|
494
|
+
result = @hosts.add(ns4) #=> true
|
495
|
+
|
496
|
+
# Update a domain host (pass in a DomainHost instance):
|
497
|
+
ns4.ip_addresses[0] = '112.223.334.455'
|
498
|
+
result = @hosts.update(ns4) #=> true
|
499
|
+
|
500
|
+
# Remove a domain host (pass in a DomainHost instance):
|
501
|
+
result = @hosts.remove(ns4) #=> true
|
502
|
+
```
|
503
|
+
|
504
|
+
### Domain Records (DNS)
|
505
|
+
Add, update, remove and list domain records, otherwise known as DNS records.
|
506
|
+
```ruby
|
507
|
+
@dns_records = InternetBS::DomainRecords.new(:domain => 'acme.com')
|
508
|
+
|
509
|
+
# TODO: Document `:filter_type => DomainRecord::TYPES` # 'A', 'AAAA', 'DYNAMIC', 'CNAME', 'MX', 'SRV', 'TXT', 'NS'
|
510
|
+
|
511
|
+
result = @dns_records.fetch #=> true
|
512
|
+
|
513
|
+
# If the fetch method fails it will return false
|
514
|
+
# and populate the errors collection attribute:
|
515
|
+
if result == false
|
516
|
+
@dns_records.errors.each do |err|
|
517
|
+
puts err
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
@dns_records.list #=> an array of DomainRecord
|
522
|
+
@dns_records.list.size #=> 8
|
523
|
+
|
524
|
+
# Enumerate each
|
525
|
+
@dns_records.list.each do |record|
|
526
|
+
puts record.name #=> www.acme.com
|
527
|
+
end
|
528
|
+
|
529
|
+
# DomainRecord properties
|
530
|
+
dns = @dns_records.list.first
|
531
|
+
dns.is_a?(DomainRecord) #=> true
|
532
|
+
puts dns.type #=> A
|
533
|
+
puts dns.value #=> 111.222.333.444
|
534
|
+
puts dns.ttl #=> 3600
|
535
|
+
|
536
|
+
# Add a domain record (pass in a DomainRecord instance):
|
537
|
+
dns_record = InternetBS::DomainRecord.new(
|
538
|
+
:name => "api.acme.com",
|
539
|
+
:type => "A",
|
540
|
+
:value => "111.222.333.456",
|
541
|
+
:ttl => 3600
|
542
|
+
)
|
543
|
+
|
544
|
+
@dns_records = DomainRecords.new(:domain => 'acme.com')
|
545
|
+
result = @dns_records.add(dns_record) #=> true
|
546
|
+
|
547
|
+
# Update a domain record (pass in a Domainrecord instance):
|
548
|
+
dns_record.value = '111.222.333.457'
|
549
|
+
result = @dns_records.update(dns_record) #=> true
|
550
|
+
|
551
|
+
# Remove a domain record (pass in a DomainRecord instance):
|
552
|
+
result = @dns_records.remove(dns_record) #=> true
|
553
|
+
```
|
554
|
+
|
555
|
+
### Private Whois
|
556
|
+
This API is intended for checking and/or changing the private whois option for a domain.
|
557
|
+
```ruby
|
558
|
+
@private_whois = InternetBS::PrivateWhois.new(:domain => "acme.com")
|
559
|
+
|
560
|
+
result = @private_whois.fetch #=> true
|
561
|
+
|
562
|
+
# If the fetch method fails it will return false
|
563
|
+
# and populate the errors collection attribute:
|
564
|
+
if result == false
|
565
|
+
@private_whois.errors.each do |err|
|
566
|
+
puts err
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
@private_whois.privacy_status #=> FULL
|
571
|
+
|
572
|
+
# Disable privacy:
|
573
|
+
result = @private_whois.disable #=> true
|
574
|
+
|
575
|
+
# Enable privacy:
|
576
|
+
@private_whois.privacy_status = 'PARTIAL'
|
577
|
+
result = @private_whois.enable #=> true
|
578
|
+
```
|
579
|
+
|
580
|
+
### Registrar Lock
|
581
|
+
This API is intended for checking and/or changing the registrar lock for a domain.
|
582
|
+
```ruby
|
583
|
+
@registrar_lock = InternetBS::RegistrarLock.new(:domain => "acme.com")
|
584
|
+
|
585
|
+
result = @registrar_lock.fetch #=> true
|
586
|
+
|
587
|
+
# If the fetch method fails it will return false and populate the errors collection attribute:
|
588
|
+
if result == false
|
589
|
+
@registrar_lock.errors.each do |err|
|
590
|
+
puts err
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
@registrar_lock.lock_status #=> FULL
|
595
|
+
|
596
|
+
# Disable registrar lock:
|
597
|
+
result = @registrar_lock.disable #=> true
|
598
|
+
|
599
|
+
# Enable registrar lock:
|
600
|
+
result = @registrar_lock.enable #=> true
|
601
|
+
```
|
602
|
+
|
603
|
+
### Registry Status
|
604
|
+
This API is intended for checking the registry status of a domain.
|
605
|
+
```ruby
|
606
|
+
@registry_status = InternetBS::RegistryStatus.new(:domain => "acme.com")
|
607
|
+
|
608
|
+
result = @registry_status.fetch #=> true
|
609
|
+
|
610
|
+
# If the fetch method fails it will return false
|
611
|
+
# and populate the errors collection attribute:
|
612
|
+
if result == false
|
613
|
+
@registry_status.errors.each do |err|
|
614
|
+
puts err
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
@registry_status.registry_status #=> clientTransferProhibited
|
619
|
+
```
|
620
|
+
|
621
|
+
### Updating a Domain
|
622
|
+
Update the properties of a domain including auto-renewal, private whois, registrar lock, transfer auth info, domain contacts, and nameservers. For .tel domains you can also update the hosting account and password.
|
623
|
+
```ruby
|
624
|
+
@domain = InternetBS::UpdateDomain.new(:domain => "acme.com")
|
625
|
+
|
626
|
+
result = @domain.fetch #=> true
|
627
|
+
|
628
|
+
# If the fetch method fails it will return false
|
629
|
+
# and populate the errors collection attribute:
|
630
|
+
if result == false
|
631
|
+
@domain.errors.each do |err|
|
632
|
+
puts err
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
# Set properties that need updating on the `@domain` instance:
|
637
|
+
@domain.auto_renew = false
|
638
|
+
@domain.private_whois = 'FULL'
|
639
|
+
@domain.registrar_lock = 'ENABLED'
|
640
|
+
@domain.transfer_auth_info
|
641
|
+
|
642
|
+
registrant = InternetBS::DomainContact.new(
|
643
|
+
:contact_type => :registrant,
|
644
|
+
:first_name => 'John',
|
645
|
+
:last_name => 'Doe',
|
646
|
+
...
|
647
|
+
)
|
648
|
+
@domain.contacts = [registrant, billing, technical, admin]
|
649
|
+
|
650
|
+
ns_list = ['ns1.example.com', 'ns2.example.com', 'ns3.example.com']
|
651
|
+
@domain.nameservers = ns_list
|
652
|
+
|
653
|
+
# For .tel domains only:
|
654
|
+
@domain.tel_hosting_account = 'my_username'
|
655
|
+
@domain.tel_hosting_password = 'my_password'
|
656
|
+
@domain.tel_hide_whois_data = true
|
657
|
+
|
658
|
+
# Then call the `#update!` method:
|
659
|
+
result = @domain.update! #=> true
|
660
|
+
```
|
661
|
+
|
662
|
+
### Ordering a Domain
|
663
|
+
Use this class to purchase a domain. Contacts must be provided as an array of `DomainContact` records.
|
664
|
+
```ruby
|
665
|
+
@order = InternetBS::OrderDomain.new(
|
666
|
+
:domain => "bigacme.com",
|
667
|
+
:currency => "USD",
|
668
|
+
:period => "1Y",
|
669
|
+
:nameservers => ['ns1.example.com', 'ns2.example.com'],
|
670
|
+
:transfer_auth_info => 'EPP AUTH INFO HERE', # optional
|
671
|
+
:registrar_lock => 'ENABLED', #optional
|
672
|
+
:private_whois => 'FULL', # optional
|
673
|
+
:discount_code => '10PERCENT', # optional
|
674
|
+
:auto_renew => true, # optional
|
675
|
+
:contacts => [registrant, admin, billing, ...],
|
676
|
+
:tel_hosting_account => 'my_username', # optional, .tel only
|
677
|
+
:tel_hosting_password => 'my_password', # optional, .tel only
|
678
|
+
:tel_hide_whois_data => true # optional, .tel only
|
679
|
+
)
|
680
|
+
|
681
|
+
result = @order.purchase! #=> true
|
682
|
+
|
683
|
+
# If the purchase! method fails it will return false
|
684
|
+
# and populate the errors collection attribute:
|
685
|
+
if result == false
|
686
|
+
@order.errors.each do |err|
|
687
|
+
puts err
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
# Order properties
|
692
|
+
@order.status #=> 'SUCCESS'
|
693
|
+
@order.transaction_id #=> 820b6791e386b31b354e613a6371c7bc
|
694
|
+
@order.total_price #=> 13.9
|
695
|
+
```
|
696
|
+
|
697
|
+
### Renewing a Domain
|
698
|
+
Use this class to renew a domain. Currency will default to `USD` and the period will default to one year (`1Y`).
|
699
|
+
```ruby
|
700
|
+
@renewal = InternetBS::RenewDomain.new(
|
701
|
+
:domain => "bigacme.com",
|
702
|
+
:currency => "USD", # default
|
703
|
+
:period => "1Y", # default
|
704
|
+
:discount_code => '10PERCENT' # optional
|
705
|
+
)
|
706
|
+
|
707
|
+
result = @renewal.purchase! #=> true
|
708
|
+
|
709
|
+
# If the purchase! method fails it will return false
|
710
|
+
# and populate the errors collection attribute:
|
711
|
+
if result == false
|
712
|
+
@renewal.errors.each do |err|
|
713
|
+
puts err
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
# Renewal properties
|
718
|
+
@renewal.status #=> 'SUCCESS'
|
719
|
+
@renewal.transaction_id #=> 4e74069f2b5d1d62282c21d0a2e49a27
|
720
|
+
@renewal.total_price #=> 13.9
|
721
|
+
```
|
722
|
+
|
723
|
+
### Country Codes
|
724
|
+
The **InternetBS Client** provides a constant hash of country codes. This list is derived from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. The hash keys are ISO_3166-1_alpha-2 codes and the values are the country display name. The top 20 countries by number of Internet users are grouped first, see https://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users.
|
725
|
+
|
726
|
+
Example: access a country name by code:
|
727
|
+
```ruby
|
728
|
+
InternetBS::COUNTRY_CODES['US'] #=> United States
|
729
|
+
```
|
730
|
+
All the regular hash functions are available for finding keys and values, but the hash is immutable. If you want to manipulate the list, for example to sort it differently; you will have to copy it into a new hash variable first.
|
731
|
+
|
732
|
+
### Language Codes
|
733
|
+
The **InternetBS Client** provides a constant hash of the most commonly required language codes. This list is derived from https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes. The hash keys are ISO 639-1 two-letter codes, and the values are the language display name.
|
734
|
+
|
735
|
+
Example: access a language name by code:
|
736
|
+
```ruby
|
737
|
+
InternetBS::LANGUAGE_CODES['en'] #=> English
|
738
|
+
```
|
739
|
+
All the regular hash functions are available for finding keys and values, but the hash is immutable. If you want to manipulate the list, for example to sort it differently; you will have to copy it into a new hash variable first.
|
740
|
+
|
741
|
+
## Testing
|
742
|
+
TBA - Currently partially tested using reseller account and testapi endpoints.
|
743
|
+
|
744
|
+
## To Do
|
745
|
+
- Investigate account transactions API endpoint.
|
746
|
+
- Implement Version 2 API endpoints.
|
747
|
+
- Test suite with mocks for CI/CD scenarios.
|
748
|
+
|
749
|
+
## Acknowledgements
|
750
|
+
#### Version 1.0.0
|
751
|
+
- Jurgen Jocubeit - President & CEO, [Brightcommerce, Inc.](https://twitter.com/brightcommerce)
|
752
|
+
|
753
|
+
## License
|
754
|
+
This library is release in the public domain under the [MIT License](http://opensource.org/licenses/MIT).
|
755
|
+
|
756
|
+
## Copyright
|
757
|
+
Copyright 2015 Brightcommerce, Inc.
|
758
|
+
All rights reserved.
|