Class: Dapi::Client
- Inherits:
-
Object
- Object
- Dapi::Client
- Defined in:
- lib/dapi/client.rb,
lib/dapi/client/error.rb,
lib/dapi/client/version.rb
Defined Under Namespace
Classes: Error, OptimisticLockFailure
Constant Summary collapse
- OPTIMISTIC_LOCKING_CHECK_WAIT =
3.0
- OPTIMISTIC_LOCKING_RETRIES =
5
- VERSION =
"0.1.2"
Instance Method Summary collapse
- #delete_record(zone_name, lvalue, type) ⇒ Object
- #get_zone(zone_name) ⇒ Object
-
#initialize(url:, token:, http: HTTP) ⇒ Client
constructor
A new instance of Client.
-
#truncate_zone(zone_name) ⇒ Object
Useful for test suites, and staging domains.
- #upsert_record(zone_name, lvalue, type, rvalue, ttl) ⇒ Object
Constructor Details
#initialize(url:, token:, http: HTTP) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/dapi/client.rb', line 11 def initialize(url:, token:, http: HTTP) @url = url @http = http @token = token end |
Instance Method Details
#delete_record(zone_name, lvalue, type) ⇒ Object
17 18 19 |
# File 'lib/dapi/client.rb', line 17 def delete_record(zone_name, lvalue, type) with_optimistic_locking { delete_record!(zone_name, lvalue, type) } end |
#get_zone(zone_name) ⇒ Object
21 22 23 |
# File 'lib/dapi/client.rb', line 21 def get_zone(zone_name) unwrap { http.get(@url + "zone/" + zone_name) } end |
#truncate_zone(zone_name) ⇒ Object
Useful for test suites, and staging domains
26 27 28 |
# File 'lib/dapi/client.rb', line 26 def truncate_zone(zone_name) with_optimistic_locking { truncate_zone!(zone_name) } end |
#upsert_record(zone_name, lvalue, type, rvalue, ttl) ⇒ Object
30 31 32 |
# File 'lib/dapi/client.rb', line 30 def upsert_record(zone_name, lvalue, type, rvalue, ttl) with_optimistic_locking { upsert_record!(zone_name, lvalue, type, rvalue, ttl) } end |