From fdb90eda3076933675d6140572f5a31c30e86e40 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Thu, 16 Jun 2011 14:51:13 -0700 Subject: [PATCH] WIP: add stub model classes --- Rakefile | 1 + lib/fog/dns/dynect.rb | 10 +++---- lib/fog/dns/models/dynect/record.rb | 38 ++++++++++++++++++++++++++ lib/fog/dns/models/dynect/records.rb | 27 ++++++++++++++++++ lib/fog/dns/models/dynect/zone.rb | 32 ++++++++++++++++++++++ lib/fog/dns/models/dynect/zones.rb | 22 +++++++++++++++ tests/dns/requests/dynect/dns_tests.rb | 5 ++++ 7 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 lib/fog/dns/models/dynect/record.rb create mode 100644 lib/fog/dns/models/dynect/records.rb create mode 100644 lib/fog/dns/models/dynect/zone.rb create mode 100644 lib/fog/dns/models/dynect/zones.rb diff --git a/Rakefile b/Rakefile index 890f39e69..39b0d745c 100644 --- a/Rakefile +++ b/Rakefile @@ -50,6 +50,7 @@ namespace :test do task :dynect do [false, true].each do |mock| sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/dns/requests/dynect") + sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/dns/models/") end end end diff --git a/lib/fog/dns/dynect.rb b/lib/fog/dns/dynect.rb index c3d63008f..678c37946 100644 --- a/lib/fog/dns/dynect.rb +++ b/lib/fog/dns/dynect.rb @@ -6,11 +6,11 @@ module Fog recognizes :timeout, :persistent recognizes :provider # remove post deprecation - # model_path 'fog/dns/models/dynect' - # model :record - # collection :records - # model :zone - # collection :zones + model_path 'fog/dns/models/dynect' + model :record + collection :records + model :zone + collection :zones request_path 'fog/dns/requests/dynect' request :session diff --git a/lib/fog/dns/models/dynect/record.rb b/lib/fog/dns/models/dynect/record.rb new file mode 100644 index 000000000..ad13f4050 --- /dev/null +++ b/lib/fog/dns/models/dynect/record.rb @@ -0,0 +1,38 @@ +require 'fog/core/model' + +module Fog + module Dynect + class DNS + + class Record < Fog::Model + extend Fog::Deprecation + deprecate :ip, :value + deprecate :ip=, :value= + + identity :id + attribute :name + attribute :value, :aliases => "content" + attribute :ttl + attribute :created_at + attribute :updated_at + attribute :zone_id, :aliases => "domain_id" + attribute :type, :aliases => "record_type" + attribute :priority, :aliases => "prio" + + def initialize(attributes={}) + end + + def destroy + end + + def zone + end + + def save + end + + end + + end + end +end diff --git a/lib/fog/dns/models/dynect/records.rb b/lib/fog/dns/models/dynect/records.rb new file mode 100644 index 000000000..8309564b2 --- /dev/null +++ b/lib/fog/dns/models/dynect/records.rb @@ -0,0 +1,27 @@ +require 'fog/core/collection' +require 'fog/dns/models/dynect/record' + +module Fog + module Dynect + class DNS + + class Records < Fog::Collection + + attribute :zone + + model Fog::Dynect::DNS::Record + + def all + end + + def get(record_id) + end + + def new(attributes = {}) + end + + end + + end + end +end diff --git a/lib/fog/dns/models/dynect/zone.rb b/lib/fog/dns/models/dynect/zone.rb new file mode 100644 index 000000000..eb52fb204 --- /dev/null +++ b/lib/fog/dns/models/dynect/zone.rb @@ -0,0 +1,32 @@ +require 'fog/core/model' +require 'fog/dns/models/dynect/records' + +module Fog + module Dynect + class DNS + + class Zone < Fog::Model + + identity :id + + attribute :domain, :aliases => 'name' + attribute :created_at + attribute :updated_at + + def destroy + end + + def records + end + + def nameservers + end + + def save + end + + end + + end + end +end diff --git a/lib/fog/dns/models/dynect/zones.rb b/lib/fog/dns/models/dynect/zones.rb new file mode 100644 index 000000000..e2acf73b8 --- /dev/null +++ b/lib/fog/dns/models/dynect/zones.rb @@ -0,0 +1,22 @@ +require 'fog/core/collection' +require 'fog/dns/models/dynect/zone' + +module Fog + module Dynect + class DNS + + class Zones < Fog::Collection + + model Fog::Dynect::DNS::Zone + + def all + end + + def get(zone_id) + end + + end + + end + end +end diff --git a/tests/dns/requests/dynect/dns_tests.rb b/tests/dns/requests/dynect/dns_tests.rb index 9e783f062..a88968459 100644 --- a/tests/dns/requests/dynect/dns_tests.rb +++ b/tests/dns/requests/dynect/dns_tests.rb @@ -12,5 +12,10 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do returns(true) { response.body['zones'].first =~ /\.com/ && true } returns(true) { response.status == 200 } end + + tests "create record" + tests "delete record" + tests "update record" + tests "list jobs" end end