mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Adding support for udplimit paramater in rage4 api
This commit is contained in:
parent
9f1eba6662
commit
d59083b315
4 changed files with 38 additions and 0 deletions
|
@ -23,6 +23,7 @@ module Fog
|
||||||
attribute :geo_long
|
attribute :geo_long
|
||||||
attribute :geo_lock
|
attribute :geo_lock
|
||||||
attribute :is_active
|
attribute :is_active
|
||||||
|
attribute :udp_limit
|
||||||
|
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
|
@ -51,6 +52,7 @@ module Fog
|
||||||
options[:geolock] = geo_lock if geo_lock
|
options[:geolock] = geo_lock if geo_lock
|
||||||
options[:geolat] = geo_lat if geo_lat
|
options[:geolat] = geo_lat if geo_lat
|
||||||
options[:geolong] = geo_long if geo_long
|
options[:geolong] = geo_long if geo_long
|
||||||
|
options[:udplimit] = udp_limit if udp_limit
|
||||||
|
|
||||||
# decide whether its a new record or update of an existing
|
# decide whether its a new record or update of an existing
|
||||||
if id.nil?
|
if id.nil?
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Fog
|
||||||
# * geolock <~Boolean> Lock geo coordinates, default false
|
# * geolock <~Boolean> Lock geo coordinates, default false
|
||||||
# * geolat <~Double> Geo latitude, (nullable)
|
# * geolat <~Double> Geo latitude, (nullable)
|
||||||
# * geolong <~Double> Geo longitude, (nullable)
|
# * geolong <~Double> Geo longitude, (nullable)
|
||||||
|
# * udplimit <~Boolean> Limit number of records returned, (nullable, default false)
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
|
@ -49,6 +50,7 @@ module Fog
|
||||||
path << "&geolock=#{options[:geolock]}" if options[:geolock]
|
path << "&geolock=#{options[:geolock]}" if options[:geolock]
|
||||||
path << "&geolat=#{options[:geolat]}" if options[:geolat]
|
path << "&geolat=#{options[:geolat]}" if options[:geolat]
|
||||||
path << "&geolong=#{options[:geolong]}" if options[:geolong]
|
path << "&geolong=#{options[:geolong]}" if options[:geolong]
|
||||||
|
path << "&udplimit=#{options[:udplimit]}" if options[:udplimit]
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Fog
|
||||||
# * geolock <~Boolean> Lock geo coordinates, default false
|
# * geolock <~Boolean> Lock geo coordinates, default false
|
||||||
# * geolat <~Double> Geo latitude, (nullable)
|
# * geolat <~Double> Geo latitude, (nullable)
|
||||||
# * geolong <~Double> Geo longitude, (nullable)
|
# * geolong <~Double> Geo longitude, (nullable)
|
||||||
|
# * udplimit <~Boolean> Limit number of records returned, (nullable, default false)
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
|
@ -48,6 +49,7 @@ module Fog
|
||||||
path << "&geolock=#{options[:geolock]}" if options[:geolock]
|
path << "&geolock=#{options[:geolock]}" if options[:geolock]
|
||||||
path << "&geolat=#{options[:geolat]}" if options[:geolat]
|
path << "&geolat=#{options[:geolat]}" if options[:geolat]
|
||||||
path << "&geolong=#{options[:geolong]}" if options[:geolong]
|
path << "&geolong=#{options[:geolong]}" if options[:geolong]
|
||||||
|
path << "&udplimit=#{options[:udplimit]}" if options[:udplimit]
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -167,6 +167,23 @@ Shindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do
|
||||||
response.body['status'] && !@record_id.nil?
|
response.body['status'] && !@record_id.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test("create_record with options") do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
|
name = "www." + @domain
|
||||||
|
type = 2 #"A"
|
||||||
|
data = "1.2.3.5"
|
||||||
|
options = { udplimit: true }
|
||||||
|
response = Fog::DNS[:rage4].create_record(@domain_id, name , data, type, options)
|
||||||
|
|
||||||
|
if response.status == 200
|
||||||
|
@record_id = response.body['id']
|
||||||
|
end
|
||||||
|
|
||||||
|
response.status == 200 && response.body['error'] == "" &&
|
||||||
|
response.body['status'] && !@record_id.nil?
|
||||||
|
end
|
||||||
|
|
||||||
test("update_record") do
|
test("update_record") do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
|
|
||||||
|
@ -181,6 +198,21 @@ Shindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do
|
||||||
response.body['status']
|
response.body['status']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test("update_record with options") do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
|
||||||
|
name = "www." + @domain
|
||||||
|
type = 2 #"A"
|
||||||
|
data = "4.3.2.1"
|
||||||
|
options = { udplimit: true }
|
||||||
|
response = Fog::DNS[:rage4].update_record(@record_id, name, data, type, options)
|
||||||
|
|
||||||
|
returns(@record_id) { response.body['id'] }
|
||||||
|
|
||||||
|
response.status == 200 && response.body['error'] == "" &&
|
||||||
|
response.body['status']
|
||||||
|
end
|
||||||
|
|
||||||
test("list_records") do
|
test("list_records") do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue