pdns 0.7.2 → 0.8.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: 203a53d5363539e9fd4147cbbd88401c2f8e5683
4
- data.tar.gz: 191ec0a2e5e9d2e64adefa5602276a710b0ada86
3
+ metadata.gz: 7581f5a6b0b3bc9fca4a123ae0940a4fbea80b74
4
+ data.tar.gz: 60262ba0711ed5da2d87c4e249a62f04e71d6c9a
5
5
  SHA512:
6
- metadata.gz: df323e88b51de7f93df6eb5366fd8b93e7a41511b786b6c1b1e9baa077ea0638fdb27fbb97f9041f3074b840d7aa1336f64011df57e3ba6fe6295dbfa655a71b
7
- data.tar.gz: c99b81265841b35bf879049cc7b9dce21a6338f0d5188bb426343317ec5d17f585362022d5fd3b22430fe6e1297ef12e7283453207e17c6ba97e4b8f211fc1f0
6
+ metadata.gz: 1c219d15df576cac18deb058556a91227a4a97f9a3e34fb93e9cd205f230e6ce71ff625b6405caf3cb7202354967aa81c8fee9cb7a1ade6b887bcd205557036b
7
+ data.tar.gz: 7f05241ac60161650bfa26cea4b35ff12e61342db36557c5ea9c2517b1bdc17da557d62e29dc628c3b213ea8d8c2db36de20816195ebb5b65b095670f73e50b1
data/README.md CHANGED
@@ -3,8 +3,16 @@ PDNS
3
3
 
4
4
  The PDNS is PowerDNS API mountable engine for Rails.
5
5
 
6
- [![Travis](https://img.shields.io/travis/linyows/pdns.svg?style=flat-square)](https://travis-ci.org/linyows/pdns)
6
+ Backends | Support
7
+ -------- | -------
8
+ MySQL | ○
9
+ PostgreSQL | -
10
+ Sqlite3 | -
11
+
7
12
  [![ruby gem](https://img.shields.io/gem/v/pdns.svg?style=flat-square)](https://rubygems.org/gems/pdns)
13
+ [![Travis](https://img.shields.io/travis/linyows/pdns.svg?style=flat-square)](https://travis-ci.org/linyows/pdns)
14
+ [![Coveralls](https://img.shields.io/coveralls/linyows/pdns/master.svg?style=flat-square)](https://coveralls.io/github/linyows/pdns)
15
+ [![Code Climate](https://img.shields.io/codeclimate/github/linyows/pdns.svg?style=flat-square)](https://codeclimate.com/github/linyows/pdns)
8
16
 
9
17
  Installation
10
18
  ------------
@@ -2,6 +2,12 @@ require_dependency 'pdns/application_controller'
2
2
 
3
3
  module PDNS
4
4
  class DomainsController < ApplicationController
5
+ def index
6
+ set_domains
7
+
8
+ render json: @domains, status: :ok
9
+ end
10
+
5
11
  def show
6
12
  set_domain
7
13
 
@@ -37,5 +43,13 @@ module PDNS
37
43
  def domain_params
38
44
  (params[:domain] || params).permit %i(name type)
39
45
  end
46
+
47
+ def set_domains
48
+ @domains = Domain.where(domain_params_for_index)
49
+ end
50
+
51
+ def domain_params_for_index
52
+ (params[:domain] || params).permit %i(account)
53
+ end
40
54
  end
41
55
  end
@@ -2,6 +2,13 @@ require_dependency 'pdns/application_controller'
2
2
 
3
3
  module PDNS
4
4
  class RecordsController < ApplicationController
5
+ def index
6
+ set_domain
7
+ set_records
8
+
9
+ render json: @records, status: :ok
10
+ end
11
+
5
12
  def show
6
13
  set_domain
7
14
  set_record
@@ -62,17 +69,17 @@ module PDNS
62
69
  end
63
70
 
64
71
  def set_record
65
- record = @domain.records.where(record_params_with_id_to_name)
72
+ set_records
66
73
 
67
74
  raise ActiveRecord::RecordNotFound.new(
68
75
  "record not found"
69
- ) if record.empty?
76
+ ) if @records.empty?
70
77
 
71
78
  raise ActiveRecord::ActiveRecordError.new(
72
79
  "record not unique"
73
- ) unless record.one?
80
+ ) unless @records.one?
74
81
 
75
- @record = record.first
82
+ @record = @records.first
76
83
  end
77
84
 
78
85
  def record_params
@@ -92,5 +99,9 @@ module PDNS
92
99
  def update_serial
93
100
  @record.update_serial if params[:skip_update_serial].nil?
94
101
  end
102
+
103
+ def set_records
104
+ @records = @domain.records.where(record_params)
105
+ end
95
106
  end
96
107
  end
@@ -1,6 +1,6 @@
1
1
  PDNS::Engine.routes.draw do
2
- resources :domains, only: %i(create show destroy), id: PDNS.domain_format_for_routes do
3
- resources :records, except: %i(index new edit), id: PDNS.domain_format_for_routes
2
+ resources :domains, only: %i(index create show destroy), id: PDNS.domain_format_for_routes do
3
+ resources :records, except: %i(new edit), id: PDNS.domain_format_for_routes
4
4
  put 'force_update_records', to: 'records#force_update_records'
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module PDNS
2
- VERSION = '0.7.2'
2
+ VERSION = '0.8.0'
3
3
  end
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.7.2
4
+ version: 0.8.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-15 00:00:00.000000000 Z
11
+ date: 2017-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails