internetbs 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -24
- data/lib/internetbs/account_domains.rb +1 -1
- data/lib/internetbs/domain_availability.rb +21 -11
- data/lib/internetbs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb20310b5c244c4a302df9794bb2209d232df6f0
|
4
|
+
data.tar.gz: 5a7b2f00a54b384eea4d4020c0be7ad006a8bcb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee3b072ab9b80b73918c934092d6bf4470fc839e86a8de1fde2b7d7a6f9727eaaa790dbf0ed0350cb3ca98da6e2bc021e692e3d2b64b04cfb3752c4fd7a0bb1
|
7
|
+
data.tar.gz: 53db9e110308746a44a69aa31e8ef12141bbf9ece0839454c6d28ebc53f8a9f6f9fb0e8d5ef746b30b6372d7a639aca86fb026e2d34be0b14babef8d0a8998e5
|
data/README.md
CHANGED
@@ -68,23 +68,25 @@ InternetBS.api_pwd = "s3kr3t"
|
|
68
68
|
InternetBS.api_uri = "https://api.internet.bs"
|
69
69
|
```
|
70
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:
|
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
72
|
```ruby
|
73
73
|
InternetBS.credentials[:staging][:api_key] = "44CD64EEEFFF887755560B"
|
74
74
|
InternetBS.credentials[:staging][:api_pwd] = "another_pass"
|
75
75
|
InternetBS.credentials[:staging][:api_uri] = "https://api.internet.bs"
|
76
76
|
```
|
77
77
|
|
78
|
-
You can query the current environments
|
78
|
+
You can query the current list of environments:
|
79
79
|
```ruby
|
80
80
|
InternetBS.environments #=> [:production, :test, :development, :staging]
|
81
81
|
```
|
82
82
|
|
83
|
-
And the
|
83
|
+
And the currently selected environment:
|
84
84
|
```ruby
|
85
85
|
InternetBS.environment #=> :development
|
86
86
|
```
|
87
87
|
|
88
|
+
The current environment operates independently of any other framework environment, e.g. `Rails.env` or `Rack.env`. You can of course manipulate them to synchronize manually.
|
89
|
+
|
88
90
|
### API Calls
|
89
91
|
The **InternetBS Client** provides access to the following Internet.bs API endpoints:
|
90
92
|
|
@@ -131,7 +133,7 @@ API Endpoint | Description
|
|
131
133
|
[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
134
|
[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
135
|
|
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.
|
136
|
+
The **InternetBS Client** *does not* provide access to the following Internet.bs API endpoints and are not currently slated for inclusion since they are 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
137
|
|
136
138
|
API Endpoint | Description
|
137
139
|
--- | ---
|
@@ -153,8 +155,8 @@ We've attempted to make the **InternetBS Client** interface as consistent as pos
|
|
153
155
|
- All requests are `GET` or `POST` requests. The Internet.bs API doesn't accept `PATCH`, `PUT` or `DELETE` requests.
|
154
156
|
- Calling read-only endpoints use the `GET` HTTP verb and pass parameters as URL-endcoded.
|
155
157
|
- 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
|
157
|
-
- The
|
158
|
+
- As specified by the Internet.bs API, only SSL-secured endpoints using the HTTPS scheme are called.
|
159
|
+
- The reseller's API key and password are passed as parameters.
|
158
160
|
- The `responseformat` parameter requesting a JSON-encoded response is sent with every request.
|
159
161
|
|
160
162
|
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.
|
@@ -196,7 +198,7 @@ result = @domains.fetch #=> true
|
|
196
198
|
|
197
199
|
# If the fetch method fails it will return false
|
198
200
|
# and populate the errors collection attribute:
|
199
|
-
|
201
|
+
unless result
|
200
202
|
@account.errors.each do |error|
|
201
203
|
puts error
|
202
204
|
end
|
@@ -226,7 +228,7 @@ To retrieve the number of domains in an account, the **InternetBS Client** provi
|
|
226
228
|
|
227
229
|
Method | Description
|
228
230
|
--- | ---
|
229
|
-
`#
|
231
|
+
`#fetch_totals` | Call this method to retrieve the total number of domains. The total number of domains can be queried on the `#total_domains` attribute. The number of domains for each TLD can be queried on the `#total_domains_by_tld` attribute.
|
230
232
|
|
231
233
|
### Account Prices
|
232
234
|
Fetch the price list for the current reseller. Prices are returned as a collection of `AccountPrice`.
|
@@ -237,7 +239,7 @@ result = @prices.fetch #=> true
|
|
237
239
|
|
238
240
|
# If the fetch method fails it will return false
|
239
241
|
# and populate the errors collection attribute:
|
240
|
-
|
242
|
+
unless result
|
241
243
|
@prices.errors.each do |error|
|
242
244
|
puts error
|
243
245
|
end
|
@@ -300,7 +302,7 @@ unless result
|
|
300
302
|
end
|
301
303
|
|
302
304
|
# Is the domain available?
|
303
|
-
puts @domain.
|
305
|
+
puts @domain.available? #=> true
|
304
306
|
|
305
307
|
# Other properties you can check:
|
306
308
|
puts @domain.transaction_id #=> 234678268342423876
|
@@ -309,6 +311,9 @@ puts @domain.min_registration_period #=> 1 # year
|
|
309
311
|
puts @domain.private_whois_allowed #=> true
|
310
312
|
puts @domain.realtime_registration #=> true
|
311
313
|
puts @domain.registrar_lock_allowed #=> true
|
314
|
+
|
315
|
+
# You can also heck the status attribute which will return a String containing one of the following: AVAILABLE, UNAVAILABLE or FAILURE:
|
316
|
+
puts @domains.status #=> AVAILABLE
|
312
317
|
```
|
313
318
|
|
314
319
|
### Domain Information
|
@@ -464,7 +469,7 @@ result = @ns.fetch #=> true
|
|
464
469
|
|
465
470
|
# If the fetch method fails it will return false
|
466
471
|
# and populate the errors collection attribute:
|
467
|
-
|
472
|
+
unless result
|
468
473
|
@ns.errors.each do |err|
|
469
474
|
puts err
|
470
475
|
end
|
@@ -512,7 +517,7 @@ result = @dns_records.fetch #=> true
|
|
512
517
|
|
513
518
|
# If the fetch method fails it will return false
|
514
519
|
# and populate the errors collection attribute:
|
515
|
-
|
520
|
+
unless result
|
516
521
|
@dns_records.errors.each do |err|
|
517
522
|
puts err
|
518
523
|
end
|
@@ -561,7 +566,7 @@ result = @private_whois.fetch #=> true
|
|
561
566
|
|
562
567
|
# If the fetch method fails it will return false
|
563
568
|
# and populate the errors collection attribute:
|
564
|
-
|
569
|
+
unless result
|
565
570
|
@private_whois.errors.each do |err|
|
566
571
|
puts err
|
567
572
|
end
|
@@ -584,8 +589,9 @@ This API is intended for checking and/or changing the registrar lock for a domai
|
|
584
589
|
|
585
590
|
result = @registrar_lock.fetch #=> true
|
586
591
|
|
587
|
-
# If the fetch method fails it will return false
|
588
|
-
|
592
|
+
# If the fetch method fails it will return false
|
593
|
+
# and populate the errors collection attribute:
|
594
|
+
unless result
|
589
595
|
@registrar_lock.errors.each do |err|
|
590
596
|
puts err
|
591
597
|
end
|
@@ -609,7 +615,7 @@ result = @registry_status.fetch #=> true
|
|
609
615
|
|
610
616
|
# If the fetch method fails it will return false
|
611
617
|
# and populate the errors collection attribute:
|
612
|
-
|
618
|
+
unless result
|
613
619
|
@registry_status.errors.each do |err|
|
614
620
|
puts err
|
615
621
|
end
|
@@ -627,7 +633,7 @@ result = @domain.fetch #=> true
|
|
627
633
|
|
628
634
|
# If the fetch method fails it will return false
|
629
635
|
# and populate the errors collection attribute:
|
630
|
-
|
636
|
+
unless result
|
631
637
|
@domain.errors.each do |err|
|
632
638
|
puts err
|
633
639
|
end
|
@@ -682,7 +688,7 @@ result = @order.purchase! #=> true
|
|
682
688
|
|
683
689
|
# If the purchase! method fails it will return false
|
684
690
|
# and populate the errors collection attribute:
|
685
|
-
|
691
|
+
unless result
|
686
692
|
@order.errors.each do |err|
|
687
693
|
puts err
|
688
694
|
end
|
@@ -694,21 +700,40 @@ end
|
|
694
700
|
@order.total_price #=> 13.9
|
695
701
|
```
|
696
702
|
|
703
|
+
### Pushing a Domain
|
704
|
+
Use this class to change the account that is responsible for managing the domain. Pushing a domain does not automatically change the official Registrant/Admin contacts.
|
705
|
+
```ruby
|
706
|
+
@domain = InternetBS::DomainPush.new(
|
707
|
+
:domain => "bigacme.com", # the domain to push
|
708
|
+
:email_address => "jane.doe@somewhere.else.com" # the new manager
|
709
|
+
)
|
710
|
+
|
711
|
+
result = @domain.push! #=> true
|
712
|
+
|
713
|
+
# If the push! method fails it will return false
|
714
|
+
# and populate the errors collection attribute:
|
715
|
+
unless result
|
716
|
+
@domain.errors.each do |err|
|
717
|
+
puts err
|
718
|
+
end
|
719
|
+
end
|
720
|
+
```
|
721
|
+
|
697
722
|
### Renewing a Domain
|
698
723
|
Use this class to renew a domain. Currency will default to `USD` and the period will default to one year (`1Y`).
|
699
724
|
```ruby
|
700
725
|
@renewal = InternetBS::RenewDomain.new(
|
701
|
-
:domain
|
702
|
-
:currency
|
703
|
-
:period
|
704
|
-
:discount_code
|
726
|
+
:domain => "bigacme.com",
|
727
|
+
:currency => "USD", # default
|
728
|
+
:period => "1Y", # default
|
729
|
+
:discount_code => '10PERCENT' # optional
|
705
730
|
)
|
706
731
|
|
707
732
|
result = @renewal.purchase! #=> true
|
708
733
|
|
709
734
|
# If the purchase! method fails it will return false
|
710
735
|
# and populate the errors collection attribute:
|
711
|
-
|
736
|
+
unless result
|
712
737
|
@renewal.errors.each do |err|
|
713
738
|
puts err
|
714
739
|
end
|
@@ -747,7 +772,7 @@ TBA - Currently partially tested using reseller account and testapi endpoints.
|
|
747
772
|
- Test suite with mocks for CI/CD scenarios.
|
748
773
|
|
749
774
|
## Acknowledgements
|
750
|
-
#### Version 1.0.
|
775
|
+
#### Version >= 1.0.1
|
751
776
|
- Jurgen Jocubeit - President & CEO, [Brightcommerce, Inc.](https://twitter.com/brightcommerce)
|
752
777
|
|
753
778
|
## License
|
@@ -1,11 +1,16 @@
|
|
1
1
|
module InternetBS
|
2
2
|
class DomainAvailability < Base
|
3
|
-
attribute :
|
4
|
-
attribute :
|
5
|
-
attribute :
|
6
|
-
attribute :
|
7
|
-
attribute :
|
8
|
-
attribute :
|
3
|
+
attribute :available, Boolean, :default => false
|
4
|
+
attribute :domain, String
|
5
|
+
attribute :max_registration_period, String
|
6
|
+
attribute :min_registration_period, String
|
7
|
+
attribute :private_whois_allowed, Boolean
|
8
|
+
attribute :realtime_registration, Boolean
|
9
|
+
attribute :registrar_lock_allowed, Boolean
|
10
|
+
|
11
|
+
def available?
|
12
|
+
@available
|
13
|
+
end
|
9
14
|
|
10
15
|
def fetch
|
11
16
|
ensure_attribute_has_value :domain
|
@@ -21,11 +26,16 @@ module InternetBS
|
|
21
26
|
|
22
27
|
@status = hash['status']
|
23
28
|
@transaction_id = hash['transactid']
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
|
30
|
+
if @status == 'AVAILABLE'
|
31
|
+
@available = true
|
32
|
+
|
33
|
+
@max_registration_period = hash['maxregperiod']
|
34
|
+
@min_registration_period = hash['minregperiod']
|
35
|
+
@private_whois_allowed = hash['privatewhoisallowed'] == 'YES' ? true : false
|
36
|
+
@realtime_registration = hash['realtimeregistration'] == 'YES' ? true : false
|
37
|
+
@registrar_lock_allowed = hash['registrarlockallowed'] == 'YES' ? true : false
|
38
|
+
end
|
29
39
|
|
30
40
|
return true
|
31
41
|
else
|
data/lib/internetbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: internetbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurgen Jocubeit
|
@@ -99,6 +99,6 @@ rubyforge_project:
|
|
99
99
|
rubygems_version: 2.4.5
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
|
-
summary: InternetBS Ruby Client v1.0.
|
102
|
+
summary: InternetBS Ruby Client v1.0.1
|
103
103
|
test_files: []
|
104
104
|
has_rdoc:
|