pdns 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9659eb12a56e9c113366ca00a69f4b6fe70c697c
4
- data.tar.gz: f0f4542546c9319a36c2ecfde821b763d50dfdcc
3
+ metadata.gz: 534df87960852275d6c803b259465e949b664806
4
+ data.tar.gz: 63af97e3363bc09fa1f423c779db35867679c556
5
5
  SHA512:
6
- metadata.gz: abbc23fce51320eb0474ef78d55b2aee616af277d4a79b03247e557cbe2371c0d121f49b96f4cb69046cafdfdd1f1586ccc784594d13f76c76f91f66cb7a6263
7
- data.tar.gz: 51e44156d49bd3f11e21a44926ce49f95c6ada9dd592a41b540abf20ce5b180567f9f8a852b59da0133887e4f609073f665d1b9296405a877d2ab7c6d73bbaac
6
+ metadata.gz: e5d439453e314c371a92552f89609780edf4711e914fbb8f91ea7867f2f5bfa606a47e6dd0a7e4b5a4aaaafb031d6f57af6aad8479f11a590127e2710998f18e
7
+ data.tar.gz: 11697e54b9c684076c74a419dd01c43bb864785ea71015cd041ef957c25568e9f445f971735fc89a9e32e938708431e41b95bbcda9f1eb14c995a77c59cf97af
@@ -2,5 +2,16 @@ module PDNS
2
2
  class ApplicationRecord < ActiveRecord::Base
3
3
  self.abstract_class = true
4
4
  establish_connection PDNS.db_conf[Rails.env.to_s]
5
+
6
+ def as_json(options = nil)
7
+ resource = self.class.name.split('::').last
8
+ method = :"#{resource}_as_json"
9
+
10
+ if PDNS.respond_to?(method) && PDNS.send(method).present?
11
+ PDNS.send(method).call(attributes, options)
12
+ else
13
+ super
14
+ end
15
+ end
5
16
  end
6
17
  end
@@ -1,3 +1,5 @@
1
+ require_dependency 'pdns/application_record'
2
+
1
3
  module PDNS
2
4
  class Domain < ApplicationRecord
3
5
  self.table_name = :domains
@@ -1,3 +1,5 @@
1
+ require_dependency 'pdns/application_record'
2
+
1
3
  module PDNS
2
4
  class Record < ApplicationRecord
3
5
  self.table_name = :records
data/db/schema.rb CHANGED
@@ -11,36 +11,76 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20130429134229) do
14
+ ActiveRecord::Schema.define(version: 20160711000000) do
15
15
  create_table 'domains', force: true do |t|
16
- t.string 'name'
17
- t.string 'master'
18
- t.integer 'last_check'
19
- t.string 'type', default: 'NATIVE'
20
- t.integer 'notified_serial'
21
- t.string 'account'
22
- t.integer 'ttl', default: 86400
23
- t.datetime 'created_at', null: false
24
- t.datetime 'updated_at', null: false
25
- t.integer 'user_id'
26
- t.text 'notes'
16
+ t.string 'name', null: false, limit: 255
17
+ t.string 'master', limit: 128
18
+ t.integer 'last_check'
19
+ t.string 'type', null: false, limit: 6
20
+ t.integer 'notified_serial'
21
+ t.string 'account', limit: 40
27
22
  end
28
23
 
29
- add_index 'domains', %w(name), name: 'index_domains_on_name'
24
+ add_index 'domains', %w(name), unique: true
30
25
 
31
26
  create_table 'records', force: true do |t|
32
- t.integer 'domain_id', null: false
33
- t.string 'name', null: false
34
- t.string 'type', null: false
35
- t.string 'content', null: false
36
- t.integer 'ttl', null: false
37
- t.integer 'prio'
38
- t.integer 'change_date'
39
- t.datetime 'created_at'
40
- t.datetime 'updated_at'
27
+ t.integer 'domain_id'
28
+ t.string 'name', limit: 255
29
+ t.string 'type', limit: 10
30
+ t.text 'content', limit: 64000
31
+ t.integer 'ttl'
32
+ t.integer 'prio'
33
+ t.integer 'change_date'
34
+ t.boolean 'disabled', default: 0
35
+ t.binary 'ordername', limit: 255
36
+ t.boolean 'auth', default: 1
41
37
  end
42
38
 
43
- add_index 'records', %w(domain_id), name: 'index_records_on_domain_id'
44
- add_index 'records', %w(name type), name: 'index_records_on_name_and_type'
45
- add_index 'records', %w(name), name: 'index_records_on_name'
39
+ add_index 'records', %w(name type)
40
+ add_index 'records', %w(domain_id)
41
+ add_index 'records', %w(domain_id ordername)
42
+
43
+ create_table 'supermasters', force: true do |t|
44
+ t.string 'ip', limit: 64, null: false
45
+ t.string 'nameserver', limit: 255, null: false
46
+ t.string 'account', limit: 40, null: false
47
+ end
48
+
49
+ create_table 'comments', force: true do |t|
50
+ t.integer 'domain_id', null: false
51
+ t.string 'name', null: false, limit: 255
52
+ t.string 'type', null: false, limit: 10
53
+ t.integer 'modified_at', null: false
54
+ t.string 'account', null: false, limit: 40
55
+ t.text 'comment', null: false, limit: 64000
56
+ end
57
+
58
+ add_index 'comments', %w(domain_id)
59
+ add_index 'comments', %w(name type)
60
+ add_index 'comments', %w(domain_id modified_at)
61
+
62
+ create_table 'domainmetadata', force: true do |t|
63
+ t.integer 'domain_id', null: false
64
+ t.string 'kind', null: false, limit: 32
65
+ t.text 'content'
66
+ end
67
+
68
+ add_index 'domainmetadata', %w(domain_id kind)
69
+
70
+ create_table 'cryptokeys', force: true do |t|
71
+ t.integer 'domain_id', null: false
72
+ t.integer 'flags', null: false
73
+ t.boolean 'active'
74
+ t.text 'content'
75
+ end
76
+
77
+ add_index 'cryptokeys', %w(domain_id)
78
+
79
+ create_table 'tsigkeys', force: true do |t|
80
+ t.string 'name', limit: 255
81
+ t.string 'algorithm', limit: 50
82
+ t.string 'secret', limit: 255
83
+ end
84
+
85
+ add_index 'tsigkeys', %w(name algorithm), unique: true
46
86
  end
data/lib/pdns/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PDNS
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
data/lib/pdns.rb CHANGED
@@ -16,6 +16,12 @@ module PDNS
16
16
  mattr_accessor :db_dir_path
17
17
  self.db_dir_path = File.expand_path('../../db', __FILE__)
18
18
 
19
+ mattr_accessor :domain_as_json
20
+ self.domain_as_json = nil
21
+
22
+ mattr_accessor :record_as_json
23
+ self.record_as_json = nil
24
+
19
25
  class << self
20
26
  def setup
21
27
  yield self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails