Class: Idcf::Dns::Client
- Inherits:
-
Object
- Object
- Idcf::Dns::Client
- Defined in:
- lib/idcf/dns/client.rb
Overview
Client for IDCF DNS service
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
- #connection ⇒ Object
-
#delete(resource, parameters = {}, headers = {}) ⇒ Response
Send DELETE request.
-
#delete!(resource, parameters = {}, headers = {}) ⇒ Response
Send DELETE request with handling error.
-
#get(resource, parameters = {}, headers = {}) ⇒ Response
Send GET request.
-
#get!(resource, parameters = {}, headers = {}) ⇒ Response
Send GET request with handling error.
-
#initialize(api_key:, secret_key:, host: "dns.idcfcloud.com", endpoint: "/api/v1", verify_ssl: true) ⇒ Client
constructor
The constructor of Dns::Client uses keyword arguments.
-
#post(resource, parameters = {}, headers = {}) ⇒ Response
Send POST request.
-
#post!(resource, parameters = {}, headers = {}) ⇒ Response
Send POST request with handling error.
-
#put(resource, parameters = {}, headers = {}) ⇒ Response
Send PUT request.
-
#put!(resource, parameters = {}, headers = {}) ⇒ Response
Send PUT request with handling error.
Methods included from Idcf::Dns::ClientExtensions::Zone
#create_zone, #delete_zone, #get_token, #get_zone, #list_zones, #update_zone, #verify_zone, #zone, #zones
Methods included from Idcf::Dns::ClientExtensions::Record
#create_record, #delete_record, #get_record, #list_records, #record, #records, #update_record
Constructor Details
#initialize(api_key:, secret_key:, host: "dns.idcfcloud.com", endpoint: "/api/v1", verify_ssl: true) ⇒ Client
The constructor of Dns::Client uses keyword arguments.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/idcf/dns/client.rb', line 17 def initialize( api_key:, secret_key:, host: "dns.idcfcloud.com", endpoint: "/api/v1", verify_ssl: true ) @api_key = api_key @secret_key = secret_key @host = host @endpoint = endpoint @verify_ssl = verify_ssl end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/idcf/dns/client.rb', line 11 def api_key @api_key end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
11 12 13 |
# File 'lib/idcf/dns/client.rb', line 11 def endpoint @endpoint end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
11 12 13 |
# File 'lib/idcf/dns/client.rb', line 11 def host @host end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
11 12 13 |
# File 'lib/idcf/dns/client.rb', line 11 def secret_key @secret_key end |
Instance Method Details
#connection ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/idcf/dns/client.rb', line 33 def connection @connection ||= Faraday.new(url: url_prefix, ssl: ) do |connection| connection.request :json connection.response :json connection.adapter Faraday.default_adapter end end |
#delete(resource, parameters = {}, headers = {}) ⇒ Response
Send DELETE request.
48 49 50 |
# File 'lib/idcf/dns/client.rb', line 48 def delete(resource, parameters = {}, headers = {}) send(:delete, resource, parameters, headers) end |
#delete!(resource, parameters = {}, headers = {}) ⇒ Response
Send DELETE request with handling error
58 59 60 |
# File 'lib/idcf/dns/client.rb', line 58 def delete!(resource, parameters = {}, headers = {}) send!(:delete, resource, parameters, headers) end |
#get(resource, parameters = {}, headers = {}) ⇒ Response
Send GET request
68 69 70 |
# File 'lib/idcf/dns/client.rb', line 68 def get(resource, parameters = {}, headers = {}) send(:get, resource, parameters, headers) end |
#get!(resource, parameters = {}, headers = {}) ⇒ Response
Send GET request with handling error
78 79 80 |
# File 'lib/idcf/dns/client.rb', line 78 def get!(resource, parameters = {}, headers = {}) send!(:get, resource, parameters, headers) end |
#post(resource, parameters = {}, headers = {}) ⇒ Response
Send POST request
88 89 90 |
# File 'lib/idcf/dns/client.rb', line 88 def post(resource, parameters = {}, headers = {}) send(:post, resource, parameters, headers) end |
#post!(resource, parameters = {}, headers = {}) ⇒ Response
Send POST request with handling error
98 99 100 |
# File 'lib/idcf/dns/client.rb', line 98 def post!(resource, parameters = {}, headers = {}) send!(:post, resource, parameters, headers) end |
#put(resource, parameters = {}, headers = {}) ⇒ Response
Send PUT request
108 109 110 |
# File 'lib/idcf/dns/client.rb', line 108 def put(resource, parameters = {}, headers = {}) send(:put, resource, parameters, headers) end |
#put!(resource, parameters = {}, headers = {}) ⇒ Response
Send PUT request with handling error
118 119 120 |
# File 'lib/idcf/dns/client.rb', line 118 def put!(resource, parameters = {}, headers = {}) send!(:put, resource, parameters, headers) end |