fog-dynect-0.0.2/0000755000175000017500000000000012653713215013003 5ustar debiandebianfog-dynect-0.0.2/.gitignore0000644000175000017500000000025212653713215014772 0ustar debiandebian*.gem *.rbc .bundle .config .yardoc Gemfile.lock gemfiles/*.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp fog-dynect-0.0.2/gemfiles/0000755000175000017500000000000012653713215014576 5ustar debiandebianfog-dynect-0.0.2/gemfiles/Gemfile-1.8.70000644000175000017500000000015712653713215016545 0ustar debiandebiansource "https://rubygems.org" gem 'mime-types', '~> 1.16' gem 'nokogiri', '~> 1.5.11' gemspec :path => "../" fog-dynect-0.0.2/CONTRIBUTING.md0000644000175000017500000000154312653713215015237 0ustar debiandebian## Getting Involved New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another. ### Coding * Pick a task: * Offer feedback on open [pull requests](https://github.com/fog/fog-dynect/pulls). * Review open [issues](https://github.com/fog/fog-dynect/issues) for things to help on. * [Create an issue](https://github.com/fog/fog-dynect/issues/new) to start a discussion on additions or features. * Fork the project, add your changes and tests to cover them in a topic branch. * Commit your changes and rebase against `fog/fog-dynect` to ensure everything is up to date. * [Submit a pull request](https://github.com/fog/fog-dynect/compare/). ### Non-Coding * Offer feedback on open [issues](https://github.com/fog/fog-dynect/issues). * Organize or volunteer at events. fog-dynect-0.0.2/LICENSE.md0000644000175000017500000000217312653713215014412 0ustar debiandebianThe MIT License (MIT) Copyright (c) 2014 [CONTRIBUTORS.md](https://github.com/fog/fog-dynect/blob/master/CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fog-dynect-0.0.2/Gemfile0000644000175000017500000000013712653713215014277 0ustar debiandebiansource 'https://rubygems.org' # Specify your gem's dependencies in fog-dynect.gemspec gemspec fog-dynect-0.0.2/Rakefile0000644000175000017500000000024012653713215014444 0ustar debiandebianrequire 'bundler/gem_tasks' task :default => :test mock = ENV['FOG_MOCK'] || 'true' task :test do sh("export FOG_MOCK=#{mock} && bundle exec shindont") end fog-dynect-0.0.2/metadata.yml0000644000175000017500000001036112653713215015307 0ustar debiandebian--- !ruby/object:Gem::Specification name: fog-dynect version: !ruby/object:Gem::Version version: 0.0.2 platform: ruby authors: - Wesley Beary - The fog team autorequire: bindir: bin cert_chain: [] date: 2015-08-24 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: shindo requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '0.3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '0.3' - !ruby/object:Gem::Dependency name: fog-core requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: fog-json requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: fog-xml requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' description: |- This library can be used as a module for `fog` or as standalone provider to use Dynect DNS in applications. email: - geemus@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".travis.yml" - CHANGELOG.md - CONTRIBUTING.md - CONTRIBUTORS.md - Gemfile - LICENSE.md - README.md - Rakefile - fog-dynect.gemspec - gemfiles/Gemfile-1.8.7 - lib/fog/bin/dynect.rb - lib/fog/dynect.rb - lib/fog/dynect/dns.rb - lib/fog/dynect/models/dns/record.rb - lib/fog/dynect/models/dns/records.rb - lib/fog/dynect/models/dns/zone.rb - lib/fog/dynect/models/dns/zones.rb - lib/fog/dynect/requests/dns/delete_record.rb - lib/fog/dynect/requests/dns/delete_zone.rb - lib/fog/dynect/requests/dns/get_all_records.rb - lib/fog/dynect/requests/dns/get_node_list.rb - lib/fog/dynect/requests/dns/get_record.rb - lib/fog/dynect/requests/dns/get_zone.rb - lib/fog/dynect/requests/dns/post_record.rb - lib/fog/dynect/requests/dns/post_session.rb - lib/fog/dynect/requests/dns/post_zone.rb - lib/fog/dynect/requests/dns/put_record.rb - lib/fog/dynect/requests/dns/put_zone.rb - lib/fog/dynect/version.rb - tests/dns/helper.rb - tests/dns/models/record_tests.rb - tests/dns/models/records_tests.rb - tests/dns/models/zone_tests.rb - tests/dns/models/zones_tests.rb - tests/dynect/requests/dns/dns_tests.rb - tests/helper.rb homepage: http://github.com/fog/fog-dynect licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.8 signing_key: specification_version: 4 summary: Module for the 'fog' gem to support Dynect DNS. test_files: [] fog-dynect-0.0.2/CHANGELOG.md0000644000175000017500000000007312653713215014614 0ustar debiandebianv0.0.1 Initial extraction from fog v1.18.0-2712-g388983f. fog-dynect-0.0.2/lib/0000755000175000017500000000000012653713215013551 5ustar debiandebianfog-dynect-0.0.2/lib/fog/0000755000175000017500000000000012653713215014324 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/0000755000175000017500000000000012653713215015612 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/models/0000755000175000017500000000000012653713215017075 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/models/dns/0000755000175000017500000000000012653713215017661 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/models/dns/zones.rb0000644000175000017500000000075412653713215021352 0ustar debiandebianrequire 'fog/dynect/models/dns/zone' module Fog module DNS class Dynect class Zones < Fog::Collection model Fog::DNS::Dynect::Zone def all data = service.get_zone.body['data'].map do |zone| { :domain => zone } end load(data) end def get(zone_id) new(service.get_zone('zone' => zone_id).body['data']) rescue Excon::Errors::NotFound nil end end end end end fog-dynect-0.0.2/lib/fog/dynect/models/dns/record.rb0000644000175000017500000000334112653713215021465 0ustar debiandebianmodule Fog module DNS class Dynect class Record < Fog::Model extend Fog::Deprecation identity :id attribute :name, :aliases => [:fqdn, 'fqdn'] attribute :rdata attribute :serial_style attribute :ttl attribute :type, :aliases => 'record_type' def destroy requires :identity, :name, :type, :zone service.delete_record(type, zone.identity, name, identity) true end def save(replace=false) requires :name, :type, :rdata, :zone options = { :ttl => ttl } options.delete_if {|key, value| value.nil?} if replace data = service.put_record(type, zone.identity, name, rdata, options).body['data'] else data = service.post_record(type, zone.identity, name, rdata, options).body['data'] end # avoid overwriting zone object with zone string data = data.reject {|key, value| key == 'zone'} merge_attributes(data) zone.publish records = service.get_record(type, zone.identity, name).body['data'] # data in format ['/REST/xRecord/domain/fqdn/identity] records.map! do |record| tokens = record.split('/') { :identity => tokens.last, :type => tokens[2][0...-6] # everything before 'Record' } end record = records.find {|record| record[:type] == type} merge_attributes(record) true end def zone @zone end private def zone=(new_zone) @zone = new_zone end end end end end fog-dynect-0.0.2/lib/fog/dynect/models/dns/records.rb0000644000175000017500000000220612653713215021647 0ustar debiandebianrequire 'fog/dynect/models/dns/record' module Fog module DNS class Dynect class Records < Fog::Collection attribute :zone model Fog::DNS::Dynect::Record def all(options = {}) requires :zone data = [] service.get_all_records(zone.domain, options).body['data'].each do |records| (type, list) = records list.each do |record| data << { :identity => record['record_id'], :fqdn => record['fqdn'], :type => record['record_type'], :rdata => record['rdata'] } end end load(data) end def get(record_id) requires :zone # there isn't a way to look up by just id # must have type and domain for 'get_record' request # so we pick it from the list returned by 'all' list = all list.detect {|e| e.id == record_id} end def new(attributes = {}) requires :zone super({:zone => zone}.merge!(attributes)) end end end end end fog-dynect-0.0.2/lib/fog/dynect/models/dns/zone.rb0000644000175000017500000000240712653713215021164 0ustar debiandebianrequire 'fog/dynect/models/dns/records' module Fog module DNS class Dynect class Zone < Fog::Model identity :domain attribute :domain, :aliases => 'zone' attribute :email, :aliases => 'rname' attribute :serial attribute :serial_style attribute :ttl attribute :type, :aliases => 'zone_type' def initialize(attributes={}) super end def destroy requires :domain service.delete_zone(domain) true end undef_method :domain= def domain=(new_domain) attributes[:domain] = new_domain.split('/').last end def publish requires :identity data = service.put_zone(identity, 'publish' => true) true end def records @records ||= Fog::DNS::Dynect::Records.new(:zone => self, :service => service) end def nameservers raise 'nameservers Not Implemented' end def save self.ttl ||= 3600 requires :domain, :email, :ttl data = service.post_zone(email, ttl, domain).body['data'] merge_attributes(data) true end end end end end fog-dynect-0.0.2/lib/fog/dynect/dns.rb0000644000175000017500000001155712653713215016734 0ustar debiandebianmodule Fog module DNS class Dynect < Fog::Service requires :dynect_customer, :dynect_username, :dynect_password recognizes :timeout, :persistent, :job_poll_timeout recognizes :provider # remove post deprecation model_path 'fog/dynect/models/dns' model :record collection :records model :zone collection :zones request_path 'fog/dynect/requests/dns' request :delete_record request :delete_zone request :get_node_list request :get_all_records request :get_record request :get_zone request :post_record request :post_session request :post_zone request :put_zone request :put_record class JobIncomplete < Error; end class Mock def initialize(options={}) @dynect_customer = options[:dynect_customer] @dynect_username = options[:dynect_username] @dynect_password = options[:dynect_password] end def self.data @data ||= { :zones => {} } end def self.reset @data = nil end def auth_token @auth_token ||= Fog::Dynect::Mock.token end def data self.class.data end def reset_data self.class.reset end end class Real def initialize(options={}) @dynect_customer = options[:dynect_customer] @dynect_username = options[:dynect_username] @dynect_password = options[:dynect_password] @connection_options = options[:connection_options] || {} @host = 'api-v4.dynect.net' @port = options[:port] || 443 @path = options[:path] || '/REST' @persistent = options[:persistent] || false @scheme = options[:scheme] || 'https' @version = options[:version] || '3.5.2' @job_poll_timeout = options[:job_poll_timeout] || 10 @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def auth_token @auth_token ||= post_session.body['data']['token'] end def request(params) begin # any request could redirect to a job params[:expects] = Array(params[:expects]) | [307] params[:headers] ||= {} params[:headers]['Content-Type'] = 'application/json' params[:headers]['API-Version'] = @version params[:headers]['Auth-Token'] = auth_token unless params[:path] == 'Session' params[:path] = "#{@path}/#{params[:path]}" unless params[:path] =~ %r{^#{Regexp.escape(@path)}/} response = @connection.request(params) if response.body.empty? response.body = {} elsif response.headers['Content-Type'] == 'application/json' response.body = Fog::JSON.decode(response.body) end if response.body['status'] == 'failure' raise Error, response.body['msgs'].first['INFO'] end if params[:path] !~ %r{^/REST/Job/} if response.status == 307 response = poll_job(response, params[:expects], @job_poll_timeout) # Dynect intermittently returns 200 with an incomplete status. When this # happens, the job should still be polled. elsif response.status == 200 && response.body['status'].eql?('incomplete') response.headers['Location'] = "/REST/Job/#{ response.body['job_id'] }" response = poll_job(response, params[:expects], @job_poll_timeout) end end response rescue Excon::Errors::HTTPStatusError => error if @auth_token && error.message =~ /login: (Bad or expired credentials|inactivity logout)/ @auth_token = nil retry else raise error end end response end def poll_job(response, original_expects, time_to_wait) job_location = response.headers['Location'] begin Fog.wait_for(time_to_wait) do response = request( :expects => original_expects, :idempotent => true, :method => :get, :path => job_location ) response.body['status'] != 'incomplete' end rescue Errors::TimeoutError => error if response.body['status'] == 'incomplete' raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete") else raise error end end response end end end end end fog-dynect-0.0.2/lib/fog/dynect/version.rb0000644000175000017500000000007312653713215017624 0ustar debiandebianmodule Fog module Dynect VERSION = '0.0.2' end end fog-dynect-0.0.2/lib/fog/dynect/requests/0000755000175000017500000000000012653713215017465 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/requests/dns/0000755000175000017500000000000012653713215020251 5ustar debiandebianfog-dynect-0.0.2/lib/fog/dynect/requests/dns/put_record.rb0000644000175000017500000000457212653713215022754 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Update or replace a record # # ==== Parameters # * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT'] # * zone<~String> - zone of record # * rdata<~Hash> - rdata for record # * options<~Hash>: (options vary by type, listing below includes common parameters) # * ttl<~Integer> - ttl for the record, defaults to zone ttl def put_record(type, zone, fqdn, rdata, options = {}) options.merge!('rdata' => rdata) type.to_s.upcase! options = {"#{type}Records" => [options]} unless options['record_id'] path = ["#{type}Record", zone, fqdn].join('/') path += "/#{options.delete('record_id')}" if options['record_id'] request( :body => Fog::JSON.encode(options), :expects => 200, :idempotent => true, :method => :put, :path => path ) end end class Mock def put_record(type, zone, fqdn, rdata, options = {}) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] records = zone[:records] record_id = zone[:next_record_id] zone[:next_record_id] += 1 record = { :type => type, :zone => zone, :fqdn => fqdn, :rdata => rdata, :ttl => options[:ttl] || zone[:ttl], :record_id => record_id } records[type] << record response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => { "zone" => record[:zone][:zone], "ttl" => record[:ttl], "fqdn" => record[:fqdn], "record_type" => record[:type], "rdata" => record[:rdata], "record_id" => record[:record_id] }, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO"=>"add: Record added", "SOURCE"=>"BLL", "ERR_CD"=>nil, "LVL"=>"INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/post_session.rb0000644000175000017500000000207212653713215023327 0ustar debiandebianmodule Fog module DNS class Dynect class Real def post_session request( :expects => 200, :idempotent => true, :method => :post, :path => "Session", :body => Fog::JSON.encode({ :customer_name => @dynect_customer, :user_name => @dynect_username, :password => @dynect_password }) ) end end class Mock def post_session response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => { "token" => auth_token, "version" => Fog::Dynect::Mock.version }, "job_id" => Fog::Dynect::Mock.job_id, "msgs"=>[{ "INFO"=>"login: Login successful", "SOURCE"=>"BLL", "ERR_CD"=>nil, "LVL"=>"INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/post_zone.rb0000644000175000017500000000405612653713215022623 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Create a zone # # ==== Parameters # * rname<~String> - administrative contact # * ttl<~Integer> - time to live (in seconds) for records in this zone # * zone<~String> - name of zone to host # * options<~Hash>: # * serial_style<~String> - style of serial number, in ['day', 'epoch', 'increment', 'minute']. Defaults to increment def post_zone(rname, ttl, zone, options = {}) body = Fog::JSON.encode({ :rname => rname, :token => auth_token, :ttl => ttl }.merge!(options)) request( :body => body, :expects => 200, :method => :post, :path => 'Zone/' << zone ) end end class Mock def post_zone(rname, ttl, zone, options = {}) new_zone = self.data[:zones][zone] = { :next_record_id => 0, :records => Hash.new do |records_hash, type| records_hash[type] = [] end, :records_to_delete => [], :rname => rname, :serial_style => options[:serial_style] || "increment", :serial => 0, :ttl => ttl, :zone => zone, :zone_type => "Primary" } response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => { "zone_type" => new_zone[:zone_type], "serial_style" => new_zone[:serial_style], "serial" => new_zone[:serial], "zone" => zone }, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "create: New zone #{zone} created. Publish it to put it on our server.", "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/get_zone.rb0000644000175000017500000000300712653713215022410 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Get one or more zones # # ==== Parameters # * options<~Hash>: # * zone<~String> - name of zone to lookup, or omit to return list of zones def get_zone(options = {}) request( :expects => 200, :idempotent => true, :method => :get, :path => ['Zone', options['zone']].compact.join('/') ) end end class Mock def get_zone(options = {}) if options['zone'] raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][options['zone']] data = { "zone_type" => zone[:zone_type], "serial_style" => zone[:serial_style], "serial" => zone[:serial], "zone" => zone[:zone] } info = "get: Your zone, #{zone[:zone]}" else data = self.data[:zones].map { |zone, data| "/REST/Zone/#{zone}/" } info = "get: Your #{data.size} zones" end response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => data, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => info, "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/delete_zone.rb0000644000175000017500000000155212653713215023076 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Delete a zone # # ==== Parameters # * zone<~String> - zone to host def delete_zone(zone) request( :expects => 200, :method => :delete, :path => "Zone/#{zone}" ) end end class Mock def delete_zone(zone) self.data[:zones].delete(zone) response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => {}, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "ERR_CD" => '', "INFO" => '', "LVL" => '', "SOURCE" => '' }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/post_record.rb0000644000175000017500000000420712653713215023124 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Create a record # # ==== Parameters # * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT'] # * zone<~String> - zone of record # * rdata<~Hash> - rdata for record # * options<~Hash>: (options vary by type, listing below includes common parameters) # * ttl<~Integer> - ttl for the record, defaults to zone ttl def post_record(type, zone, fqdn, rdata, options = {}) options.merge!('rdata' => rdata) request( :body => Fog::JSON.encode(options), :expects => 200, :method => :post, :path => ["#{type.to_s.upcase}Record", zone, fqdn].join('/') ) end end class Mock def post_record(type, zone, fqdn, rdata, options = {}) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] records = zone[:records] record_id = zone[:next_record_id] zone[:next_record_id] += 1 record = { :type => type, :zone => zone, :fqdn => fqdn, :rdata => rdata, :ttl => options[:ttl] || zone[:ttl], :record_id => record_id } records[type] << record response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => { "zone" => record[:zone][:zone], "ttl" => record[:ttl], "fqdn" => record[:fqdn], "record_type" => record[:type], "rdata" => record[:rdata], "record_id" => record[:record_id] }, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO"=>"add: Record added", "SOURCE"=>"BLL", "ERR_CD"=>nil, "LVL"=>"INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/get_record.rb0000644000175000017500000000567412653713215022727 0ustar debiandebianmodule Fog module DNS class Dynect class Real # List records of a given type # # ==== Parameters # * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT'] # * zone<~String> - name of zone to lookup # * fqdn<~String> - name of fqdn to lookup # * options<~Hash>: # * record_id<~String> - id of record def get_record(type, zone, fqdn, options = {}) request( :expects => 200, :idempotent => true, :method => :get, :path => ["#{type.to_s.upcase}Record", zone, fqdn, options['record_id']].compact.join('/') ) end end class Mock def get_record(type, zone, fqdn, options = {}) raise ArgumentError unless [ 'AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT' ].include? type raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] response = Excon::Response.new response.status = 200 if record_id = options['record_id'] raise Fog::DNS::Dynect::NotFound unless record = zone[:records][type].find { |record| record[:record_id] == record_id.to_i } response.body = { "status" => "success", "data" => { "zone" => record[:zone][:zone], "ttl" => record[:ttl], "fqdn" => record[:fqdn], "record_type" => type, "rdata" => record[:rdata], "record_id" => record[:record_id] }, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "get: Found the record", "SOURCE" => "API-B", "ERR_CD" => nil, "LVL" => "INFO" }] } else records = if type == "ANY" zone[:records].values.flatten.select { |record| record[:fqdn] == fqdn } else zone[:records][type].select { |record| record[:fqdn] == fqdn } end response.body = { "status" => "success", "data" => records.map { |record| "/REST/#{record[:type]}Record/#{record[:zone][:zone]}/#{record[:fqdn]}/#{record[:record_id]}" }, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "detail: Found #{records.size} record", "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } end response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/get_node_list.rb0000644000175000017500000000307112653713215023416 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Get one or more node lists # # ==== Parameters # * zone<~String> - zone to lookup node lists for # * options<~Hash> # * fqdn<~String> - fully qualified domain name of node to lookup def get_node_list(zone, options = {}) requested_fqdn = options['fqdn'] || options[:fqdn] request( :expects => 200, :idempotent => true, :method => :get, :path => ['AllRecord', zone, requested_fqdn].compact.join('/') ) end end class Mock def get_node_list(zone, options = {}) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] response = Excon::Response.new response.status = 200 data = [zone[:zone]] if fqdn = options[:fqdn] data = data | zone[:records].map { |type, records| records.select { |record| record[:fqdn] == fqdn } }.flatten.compact else data = data | zone[:records].map { |type, records| records.map { |record| record[:fqdn] } }.flatten end response.body = { "status" => "success", "data" => data, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "get_tree: Here is your zone tree", "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/put_zone.rb0000644000175000017500000000432412653713215022444 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Update a zone # # ==== Parameters # * zone<~String> - name or id of zone # * options<~Hash>: # * freeze<~Boolean> - causes zone to become frozen # * publish<~Boolean> - causes all pending changes to be pushed to nameservers # * thaw<~Boolean> - causes zone to cease being frozen def put_zone(zone, options = {}) request( :body => Fog::JSON.encode(options), :expects => 200, :idempotent => true, :method => :put, :path => 'Zone/' << zone ) end end class Mock def put_zone(zone, options = {}) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] raise ArgumentError unless options.size == 1 response = Excon::Response.new response.status = 200 data = {} if options['freeze'] zone['frozen'] = true info = "freeze: Your zone is now frozen" elsif options['publish'] zone[:changes] = {} zone[:records_to_delete].each do |record| zone[:records][record[:type]].delete_if { |r| r[:fqdn] == record[:fqdn] && r[:record_id] == record[:record_id] } end zone[:records_to_delete] = [] data = { "zone_type" => zone[:zone_type], "serial_style" => zone[:serial_style], "serial" => zone[:serial] += 1, "zone" => zone[:zone] } info = "publish: #{zone[:zone]} published" elsif options['thaw'] zone[:frozen] = false info = "thaw: Your zone is now thawed, you may edit normally" else raise ArgumentError end response.body = { "status" => "success", "data" => data, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => info, "SOURCE"=>"BLL", "ERR_CD"=>nil, "LVL"=>"INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/delete_record.rb0000644000175000017500000000323512653713215023401 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Delete a record # # ==== Parameters # * type<~String> - type of record in ['AAAA', 'ANY', 'A', 'CNAME', 'DHCID', 'DNAME', 'DNSKEY', 'DS', 'KEY', 'LOC', 'MX', 'NSA', 'NS', 'PTR', 'PX', 'RP', 'SOA', 'SPF', 'SRV', 'SSHFP', 'TXT'] # * zone<~String> - zone of record # * fqdn<~String> - fqdn of record # * record_id<~String> - id of record def delete_record(type, zone, fqdn, record_id) request( :expects => 200, :idempotent => true, :method => :delete, :path => ["#{type.to_s.upcase}Record", zone, fqdn, record_id].join('/') ) end end class Mock def delete_record(type, zone, fqdn, record_id) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] raise Fog::DNS::Dynect::NotFound unless zone[:records][type].find { |record| record[:fqdn] == fqdn && record[:record_id] == record_id.to_i } zone[:records_to_delete] << { :type => type, :fqdn => fqdn, :record_id => record_id.to_i } response = Excon::Response.new response.status = 200 response.body = { "status" => "success", "data" => {}, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "delete: Record will be deleted on zone publish", "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect/requests/dns/get_all_records.rb0000644000175000017500000000323612653713215023732 0ustar debiandebianmodule Fog module DNS class Dynect class Real # Get one or more node lists # # ==== Parameters # * zone<~String> - zone to lookup node lists for # * options<~Hash> # * fqdn<~String> - fully qualified domain name of node to lookup def get_all_records(zone, options = {}) requested_fqdn = options['fqdn'] || options[:fqdn] request( :expects => 200, :idempotent => true, :method => :get, :path => ['AllRecord', zone, requested_fqdn].compact.join('/'), :query => {'detail' => 'Y'} # return full records, instead of just resource URLs ) end end class Mock def get_all_records(zone, options = {}) raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone] response = Excon::Response.new response.status = 200 data = [zone[:zone]] if fqdn = options[:fqdn] data = data | zone[:records].map { |type, records| records.select { |record| record[:fqdn] == fqdn } }.flatten.compact else data = data | zone[:records].map { |type, records| records.map { |record| record[:fqdn] } }.flatten end response.body = { "status" => "success", "data" => data, "job_id" => Fog::Dynect::Mock.job_id, "msgs" => [{ "INFO" => "get_tree: Here is your zone tree", "SOURCE" => "BLL", "ERR_CD" => nil, "LVL" => "INFO" }] } response end end end end end fog-dynect-0.0.2/lib/fog/dynect.rb0000644000175000017500000000116112653713215016136 0ustar debiandebianrequire 'nokogiri' require 'fog/core' require 'fog/json' require 'fog/xml' module Fog module DNS autoload :Dynect, File.expand_path('../dynect/dns', __FILE__) end module Dynect extend Fog::Provider autoload :VERSION, File.expand_path('../dynect/version', __FILE__) service(:dns, 'DNS') class Mock def self.job_id Fog::Mock.random_numbers(8).to_i end def self.token Fog::Mock.random_hex(48) end def self.version [Fog::Mock.random_numbers(1), Fog::Mock.random_numbers(1), Fog::Mock.random_numbers(1)].join('.') end end end end fog-dynect-0.0.2/lib/fog/bin/0000755000175000017500000000000012653713215015074 5ustar debiandebianfog-dynect-0.0.2/lib/fog/bin/dynect.rb0000644000175000017500000000105512653713215016710 0ustar debiandebianclass Dynect < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::Dynect else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::DNS.new(:provider => 'Dynect') else raise ArgumentError, "Unrecognized service: #{service}" end end @@connections[service] end def services [:dns] end end end fog-dynect-0.0.2/tests/0000755000175000017500000000000012653713215014145 5ustar debiandebianfog-dynect-0.0.2/tests/dynect/0000755000175000017500000000000012653713215015433 5ustar debiandebianfog-dynect-0.0.2/tests/dynect/requests/0000755000175000017500000000000012653713215017306 5ustar debiandebianfog-dynect-0.0.2/tests/dynect/requests/dns/0000755000175000017500000000000012653713215020072 5ustar debiandebianfog-dynect-0.0.2/tests/dynect/requests/dns/dns_tests.rb0000644000175000017500000002411112653713215022424 0ustar debiandebianShindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do shared_format = { 'job_id' => Integer, 'msgs' => [{ 'ERR_CD' => Fog::Nullable::String, 'INFO' => String, 'LVL' => String, 'SOURCE' => String }], 'status' => String } tests "success" do @dns = Fog::DNS[:dynect] @domain = generate_unique_domain @fqdn = "www.#{@domain}" post_session_format = shared_format.merge({ 'data' => { 'token' => String, 'version' => String } }) tests("post_session").formats(post_session_format) do @dns.post_session.body end post_zone_format = shared_format.merge({ 'data' => { 'serial' => Integer, 'zone' => String, 'zone_type' => String, 'serial_style' => String } }) tests("post_zone('netops@#{@domain}', 3600, '#{@domain}')").formats(post_zone_format) do @dns.post_zone("netops@#{@domain}", 3600, @domain).body end get_zones_format = shared_format.merge({ 'data' => [String] }) tests("get_zone").formats(get_zones_format) do @dns.get_zone.body end get_zone_format = shared_format.merge({ 'data' => { "serial" => Integer, "serial_style" => String, "zone" => String, "zone_type" => String } }) tests("get_zone('zone' => '#{@domain}')").formats(get_zone_format) do @dns.get_zone('zone' => @domain).body end post_record_format = shared_format.merge({ 'data' => { 'fqdn' => String, 'rdata' => { 'address' => String }, 'record_id' => Integer, 'record_type' => String, 'ttl' => Integer, 'zone' => String } }) tests("post_record('A', '#{@domain}', '#{@fqdn}', 'address' => '1.2.3.4')").formats(post_record_format) do @dns.post_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}).body end put_record_format = shared_format.merge({ 'data' => { 'fqdn' => String, 'ARecords' => [ { 'rdata' => { 'address' => String } } ], 'record_id' => Integer, 'record_type' => String, 'ttl' => Integer, 'zone' => String } }) tests("put_record('A', '#{@domain}', '#{@fqdn}', 'address' => '1.2.3.4')").formats(post_record_format) do @dns.put_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}).body end publish_zone_format = shared_format.merge({ 'data' => { 'serial' => Integer, 'serial_style' => String, 'zone' => String, 'zone_type' => String } }) tests("put_zone('#{@domain}', 'publish' => true)").formats(publish_zone_format) do @dns.put_zone(@domain, 'publish' => true).body end freeze_zone_format = shared_format.merge({ 'data' => {} }) tests("put_zone('#{@domain}', 'freeze' => true)").formats(freeze_zone_format) do @dns.put_zone(@domain, 'freeze' => true).body end thaw_zone_format = shared_format.merge({ 'data' => {} }) tests("put_zone('#{@domain}', 'thaw' => true)").formats(thaw_zone_format) do @dns.put_zone(@domain, 'thaw' => true).body end get_node_list_format = shared_format.merge({ 'data' => [String] }) tests("get_node_list('#{@domain}')").formats(get_node_list_format) do @dns.get_node_list(@domain).body end get_all_records_format = shared_format.merge({ 'data' => [String] }) tests("get_all_records('#{@domain}')").formats(get_all_records_format) do @dns.get_all_records(@domain).body end get_records_format = shared_format.merge({ 'data' => [String] }) tests("get_record('A', '#{@domain}', '#{@fqdn}')").formats(get_records_format) do data = @dns.get_record('A', @domain, @fqdn).body @record_id = data['data'].first.split('/').last data end sleep 5 unless Fog.mocking? @dns.post_record('CNAME', @domain, "cname.#{@fqdn}", {'cname' => "#{@fqdn}."}) tests("get_record('ANY', '#{@domain}', 'cname.#{@fqdn}')").formats(get_records_format) do @dns.get_record('ANY', @domain, "cname.#{@fqdn}").body end get_record_format = shared_format.merge({ 'data' => { 'zone' => String, 'ttl' => Integer, 'fqdn' => String, 'record_type' => String, 'rdata' => { 'address' => String }, 'record_id' => Integer } }) tests("get_record('A', '#{@domain}', '#{@fqdn}', 'record_id' => '#{@record_id}')").formats(get_record_format) do @dns.get_record('A', @domain, @fqdn, 'record_id' => @record_id).body end delete_record_format = shared_format.merge({ 'data' => {} }) tests("delete_record('A', '#{@domain}', '#{@fqdn}', '#{@record_id}')").formats(delete_record_format) do @dns.delete_record('A', @domain, "#{@fqdn}", @record_id).body end delete_zone_format = shared_format.merge({ 'data' => {} }) sleep 5 unless Fog.mocking? tests("delete_zone('#{@domain}')").formats(delete_zone_format) do @dns.delete_zone(@domain).body end tests("job handling") do pending unless Fog.mocking? old_mock_value = Excon.defaults[:mock] Excon.stubs.clear tests("returns final response from a complete job").returns({"status" => "success"}) do begin Excon.defaults[:mock] = true Excon.stub({:method => :post, :path => "/REST/Session"}, {:body=>"{\"status\": \"success\", \"data\": {\"token\": \"foobar\", \"version\": \"2.3.1\"}, \"job_id\": 150583906, \"msgs\": [{\"INFO\": \"login: Login successful\", \"SOURCE\": \"BLL\", \"ERR_CD\": null, \"LVL\": \"INFO\"}]}", :headers=>{"Content-Type"=>"application/json"}, :status=>200}) Excon.stub({:method => :get, :path => "/REST/Zone/example.com"}, {:status => 307, :body => '/REST/Job/150576635', :headers => {'Content-Type' => 'text/html', 'Location' => '/REST/Job/150576635'}}) Excon.stub({:method => :get, :path => "/REST/Job/150576635"}, {:status => 307, :body => '{"status":"success"}', :headers => {'Content-Type' => 'application/json'}}) Fog::DNS::Dynect::Real.new.request(:method => :get, :path => "Zone/example.com").body ensure Excon.stubs.clear Excon.defaults[:mock] = old_mock_value end end tests("passes expects through when polling a job").returns({"status" => "success"}) do begin Excon.defaults[:mock] = true Excon.stub({:method => :post, :path => "/REST/Session"}, {:body=>"{\"status\": \"success\", \"data\": {\"token\": \"foobar\", \"version\": \"2.3.1\"}, \"job_id\": 150583906, \"msgs\": [{\"INFO\": \"login: Login successful\", \"SOURCE\": \"BLL\", \"ERR_CD\": null, \"LVL\": \"INFO\"}]}", :headers=>{"Content-Type"=>"application/json"}, :status=>200}) Excon.stub({:method => :get, :path => "/REST/Zone/example.com"}, {:status => 307, :body => '/REST/Job/150576635', :headers => {'Content-Type' => 'text/html', 'Location' => '/REST/Job/150576635'}}) Excon.stub({:method => :get, :path => "/REST/Job/150576635"}, {:status => 404, :body => '{"status":"success"}', :headers => {'Content-Type' => 'application/json'}}) Fog::DNS::Dynect::Real.new.request(:method => :get, :expects => 404, :path => "Zone/example.com").body ensure Excon.stubs.clear Excon.defaults[:mock] = old_mock_value end end end end tests('failure') do tests("#auth_token with expired credentials").raises(Excon::Errors::BadRequest) do pending if Fog.mocking? @dns = Fog::DNS[:dynect] @dns.instance_variable_get(:@connection).stub(:request) { raise Excon::Errors::BadRequest.new('Expected(200) <=> Actual(400 Bad Request) request => {:headers=>{"Content-Type"=>"application/json", "API-Version"=>"2.3.1", "Auth-Token"=>"auth-token", "Host"=>"api2.dynect.net:443", "Content-Length"=>0}, :host=>"api2.dynect.net", :mock=>nil, :path=>"/REST/CNAMERecord/domain.com/www.domain.com", :port=>"443", :query=>nil, :scheme=>"https", :expects=>200, :method=>:get} response => #"nginx/0.7.67", "Date"=>"Thu, 08 Sep 2011 20:04:21 GMT", "Content-Type"=>"application/json", "Transfer-Encoding"=>"chunked", "Connection"=>"keep-alive"}, @status=400>') } @dns.instance_variable_get(:@connection).should_receive(:request).exactly(2).times @dns.auth_token end tests("#auth_token with inactivity logout").raises(Excon::Errors::BadRequest) do pending if Fog.mocking? @dns = Fog::DNS[:dynect] @dns.instance_variable_get(:@connection).stub(:request) { raise Excon::Errors::BadRequest.new('Expected(200) <=> Actual(400 Bad Request) request => {:headers=>{"Content-Type"=>"application/json", "API-Version"=>"2.3.1", "Auth-Token"=>"auth-token", "Host"=>"api2.dynect.net:443", "Content-Length"=>0}, :host=>"api2.dynect.net", :mock=>nil, :path=>"/REST/CNAMERecord/domain.com/www.domain.com", :port=>"443", :query=>nil, :scheme=>"https", :expects=>200, :method=>:get} response => #"nginx/0.7.67", "Date"=>"Thu, 08 Sep 2011 20:04:21 GMT", "Content-Type"=>"application/json", "Transfer-Encoding"=>"chunked", "Connection"=>"keep-alive"}, @status=400>') } @dns.instance_variable_get(:@connection).should_receive(:request).exactly(2).times @dns.auth_token end end end fog-dynect-0.0.2/tests/helper.rb0000644000175000017500000000053212653713215015751 0ustar debiandebianbegin require 'codeclimate-test-reporter' CodeClimate::TestReporter.start rescue LoadError => e $stderr.puts "not recording test coverage: #{e.inspect}" end require 'fog/test_helpers' require File.expand_path('../../lib/fog/dynect', __FILE__) Bundler.require(:test) Excon.defaults.merge!(:debug_request => true, :debug_response => true) fog-dynect-0.0.2/tests/dns/0000755000175000017500000000000012653713215014731 5ustar debiandebianfog-dynect-0.0.2/tests/dns/models/0000755000175000017500000000000012653713215016214 5ustar debiandebianfog-dynect-0.0.2/tests/dns/models/zone_tests.rb0000644000175000017500000000064712653713215020745 0ustar debiandebianfor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | zone", [provider.to_s]) do zone_attributes = { :domain => domain_name }.merge!(config[:zone_attributes] || {}) model_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked]) end end fog-dynect-0.0.2/tests/dns/models/records_tests.rb0000644000175000017500000000132412653713215021424 0ustar debiandebianfor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | records", [provider.to_s]) do record_attributes = { :name => 'www.' + domain_name, :type => 'A', :value => '1.2.3.4' }.merge!(config[:record_attributes] || {}) if !Fog.mocking? || config[:mocked] zone_attributes = { :domain => domain_name }.merge(config[:zone_attributes] || {}) @zone = Fog::DNS[provider].zones.create(zone_attributes) collection_tests(@zone.records, record_attributes, config[:mocked]) @zone.destroy end end end fog-dynect-0.0.2/tests/dns/models/zones_tests.rb0000644000175000017500000000065512653713215021127 0ustar debiandebianfor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | zones", [provider.to_s]) do zone_attributes = { :domain => domain_name }.merge!(config[:zone_attributes] || {}) collection_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked]) end end fog-dynect-0.0.2/tests/dns/models/record_tests.rb0000644000175000017500000000235212653713215021243 0ustar debiandebianfor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | record", [provider.to_s]) do a_record_attributes = { :name => 'a.' + domain_name, :type => 'A', :value => '1.2.3.4' }.merge!(config[:record_attributes] || {}) aaaa_record_attributes = { :name => 'aaaa.' + domain_name, :type => 'AAAA', :value => '2001:0db8:0000:0000:0000:ff00:0042:8329' }.merge!(config[:record_attributes] || {}) cname_record_attributes = { :name => 'cname.' + domain_name, :type => 'CNAME', :value => 'real.' + domain_name }.merge!(config[:record_attributes] || {}) if !Fog.mocking? || config[:mocked] zone_attributes = { :domain => domain_name }.merge(config[:zone_attributes] || {}) @zone = Fog::DNS[provider].zones.create(zone_attributes) model_tests(@zone.records, a_record_attributes, config[:mocked]) model_tests(@zone.records, aaaa_record_attributes, config[:mocked]) model_tests(@zone.records, cname_record_attributes, config[:mocked]) @zone.destroy end end end fog-dynect-0.0.2/tests/dns/helper.rb0000644000175000017500000000074612653713215016544 0ustar debiandebiandef dns_providers { :dynect => { :mocked => false, :zone_attributes => { :email => 'fog@example.com' } } } end def generate_unique_domain( with_trailing_dot = false) #get time (with 1/100th of sec accuracy) #want unique domain name and if provider is fast, this can be called more than once per second time= (Time.now.to_f * 100).to_i domain = 'test-' + time.to_s + '.com' if with_trailing_dot domain+= '.' end domain end fog-dynect-0.0.2/README.md0000644000175000017500000000214612653713215014265 0ustar debiandebian# Fog::Dynect [![Build Status](https://travis-ci.org/fog/fog-dynect.svg?branch=master)](https://travis-ci.org/fog/fog-dynect) ## Installation Add this line to your application's Gemfile: ```ruby gem 'fog-dynect' ``` And then execute: $ bundle Or install it yourself as: $ gem install fog-dynect ## Usage Initialize a `Fog::DNS` object using the Dynect provider. ```ruby dns = Fog::DNS.new({ :provider => 'Dynect', :dynect_customer => 'dynect_customer', :dynect_username => 'dynect_username', :dynect_password => 'dynect_password' }) ``` This can then be used like other [Fog DNS](http://fog.io/dns/) providers. ```ruby zone = dns.zones.create( :domain => 'example.com', :email => 'admin@example.com' ) record = zone.records.create( :value => '1.2.3.4', :name => 'example.com', :type => 'A' ) ``` ## Contributing 1. Fork it ( https://github.com/fog/fog-dynect/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request fog-dynect-0.0.2/.travis.yml0000644000175000017500000000031012653713215015106 0ustar debiandebianlanguage: ruby rvm: - 2.2 - 2.1 - 2.0 - 1.9 - jruby matrix: include: - rvm: 1.8.7 gemfile: gemfiles/Gemfile-1.8.7 - rvm: jruby-18mode gemfile: gemfiles/Gemfile-1.8.7 fog-dynect-0.0.2/fog-dynect.gemspec0000644000175000017500000000217112653713215016410 0ustar debiandebian# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fog/dynect/version' Gem::Specification.new do |spec| spec.name = 'fog-dynect' spec.version = Fog::Dynect::VERSION spec.authors = ['Wesley Beary', 'The fog team'] spec.email = ['geemus@gmail.com'] spec.summary = "Module for the 'fog' gem to support Dynect DNS." spec.description = 'This library can be used as a module for `fog` or as standalone provider to use Dynect DNS in applications.' spec.homepage = 'http://github.com/fog/fog-dynect' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' spec.add_development_dependency 'shindo', '~> 0.3' spec.add_dependency 'fog-core' spec.add_dependency 'fog-json' spec.add_dependency 'fog-xml' end fog-dynect-0.0.2/CONTRIBUTORS.md0000644000175000017500000000202112653713215015255 0ustar debiandebian* Brett Lentz * Chris Chalstrom * Dan Peterson * Dylan Egan * Dylan Egan * Eric Hankins * Frederick Cheung * geemus * James Herdman * Josh Blancett * Kevin Menard * Kyle Rames * Lance Ivy * Marc Seeger * Matt Darby * Michael Hale * Nick Janus * Paul Thornthwaite * Paul Thornthwaite * Peter Drake * Richard Henning * Shawn Catanzarite * Steve Smith * Wesley Beary * Wesley Beary * Wesley Beary * Weston Platter