1
0
Fork 0
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:
Joshua Gross 2014-03-18 16:41:47 -04:00
parent 9f1eba6662
commit d59083b315
4 changed files with 38 additions and 0 deletions

View file

@ -23,6 +23,7 @@ module Fog
attribute :geo_long
attribute :geo_lock
attribute :is_active
attribute :udp_limit
def initialize(attributes={})
@ -51,6 +52,7 @@ module Fog
options[:geolock] = geo_lock if geo_lock
options[:geolat] = geo_lat if geo_lat
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
if id.nil?

View file

@ -17,6 +17,7 @@ module Fog
# * geolock <~Boolean> Lock geo coordinates, default false
# * geolat <~Double> Geo latitude, (nullable)
# * geolong <~Double> Geo longitude, (nullable)
# * udplimit <~Boolean> Limit number of records returned, (nullable, default false)
#
# ==== Returns
# * response<~Excon::Response>:
@ -49,6 +50,7 @@ module Fog
path << "&geolock=#{options[:geolock]}" if options[:geolock]
path << "&geolat=#{options[:geolat]}" if options[:geolat]
path << "&geolong=#{options[:geolong]}" if options[:geolong]
path << "&udplimit=#{options[:udplimit]}" if options[:udplimit]
request(
:expects => 200,

View file

@ -17,6 +17,7 @@ module Fog
# * geolock <~Boolean> Lock geo coordinates, default false
# * geolat <~Double> Geo latitude, (nullable)
# * geolong <~Double> Geo longitude, (nullable)
# * udplimit <~Boolean> Limit number of records returned, (nullable, default false)
#
# ==== Returns
# * response<~Excon::Response>:
@ -48,6 +49,7 @@ module Fog
path << "&geolock=#{options[:geolock]}" if options[:geolock]
path << "&geolat=#{options[:geolat]}" if options[:geolat]
path << "&geolong=#{options[:geolong]}" if options[:geolong]
path << "&udplimit=#{options[:udplimit]}" if options[:udplimit]
request(
:expects => 200,

View file

@ -167,6 +167,23 @@ Shindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do
response.body['status'] && !@record_id.nil?
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
pending if Fog.mocking?
@ -181,6 +198,21 @@ Shindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do
response.body['status']
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
pending if Fog.mocking?