idcf-dns 0.0.3 → 0.0.4
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 +4 -4
- data/.gitignore +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +4 -1
- data/idcf-dns.gemspec +1 -0
- data/lib/idcf/dns/validators/base.rb +31 -17
- data/lib/idcf/dns/version.rb +1 -1
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98032912f6081933ba743910474df098a6fe6e52
|
4
|
+
data.tar.gz: b957f8dd35397928b1f0dcdd5b4c67318b3ae1a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d361f8adaba339dbab6ba919cabb5eb4a10b33fd5c75b6bec6cdfeb3b1b5afc0a1868e79c8b49fb1fd4c45ce9186321a7bf80de928ac727af9b7995cfad8287b
|
7
|
+
data.tar.gz: 7968f8c82d86121fffdf5751d7d25983edf1126b23b1546a8d16d5182a796dcb3528f552c1cff4cc72f72dbe1d52182f685136558c578a5c4c4d0cabccf5afd8
|
data/.gitignore
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://codeclimate.com/github/idcf/idcf-dns-ruby)
|
5
5
|
[](https://codeclimate.com/github/idcf/idcf-dns-ruby/coverage)
|
6
6
|
|
7
|
-
A Ruby client for IDCF Cloud DNS service.
|
7
|
+
A Ruby client for [IDCF Cloud DNS service](http://www.idcf.jp/cloud/dns/).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -116,6 +116,9 @@ client.delete_record(record_uuid, zone_uuid)
|
|
116
116
|
|
117
117
|
### Advanced usage
|
118
118
|
#### Custom expiration of requests
|
119
|
+
In default, requests will expire in 600 seconds.
|
120
|
+
You can use custom expirations for each request.
|
121
|
+
|
119
122
|
```ruby
|
120
123
|
expiration = Time.now.to_i + 10
|
121
124
|
|
data/idcf-dns.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler"
|
21
21
|
spec.add_development_dependency "codeclimate-test-reporter"
|
22
|
+
spec.add_development_dependency "dotenv"
|
22
23
|
spec.add_development_dependency "rake"
|
23
24
|
spec.add_development_dependency "rspec"
|
24
25
|
spec.add_development_dependency "simplecov"
|
@@ -14,24 +14,10 @@ module Idcf
|
|
14
14
|
# @param attributes [Hash] request attributes
|
15
15
|
# @param action [Symbol] request method
|
16
16
|
def validate_attributes!(attributes, action = nil)
|
17
|
-
|
18
|
-
|
19
|
-
fail(
|
20
|
-
MissingAttribute,
|
21
|
-
"`#{name}` is required in #{action} action"
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
17
|
+
validate_presence!(attributes, action)
|
18
|
+
validate_absence!(attributes, action)
|
25
19
|
attributes.each do |name, value|
|
26
|
-
|
27
|
-
(!valid_attributes[name] || !valid_attributes[name][action])
|
28
|
-
fail(
|
29
|
-
UnnecessaryAttribute,
|
30
|
-
"`#{name}` is unnecessary in #{action} action"
|
31
|
-
)
|
32
|
-
end
|
33
|
-
validate_attribute_name!(name)
|
34
|
-
validate_attribute_type!(name, value)
|
20
|
+
validate_attribute!(name, value)
|
35
21
|
end
|
36
22
|
end
|
37
23
|
|
@@ -59,6 +45,23 @@ module Idcf
|
|
59
45
|
end
|
60
46
|
end
|
61
47
|
|
48
|
+
def validate_absence!(attributes, action)
|
49
|
+
attributes.each do |name, value|
|
50
|
+
if action &&
|
51
|
+
(!valid_attributes[name] || !valid_attributes[name][action])
|
52
|
+
fail(
|
53
|
+
UnnecessaryAttribute,
|
54
|
+
"`#{name}` is unnecessary in #{action} action"
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def validate_attribute!(name, value)
|
61
|
+
validate_attribute_name!(name)
|
62
|
+
validate_attribute_type!(name, value)
|
63
|
+
end
|
64
|
+
|
62
65
|
def validate_attribute_name!(name)
|
63
66
|
return true if valid_attributes.key?(name.to_sym)
|
64
67
|
fail(
|
@@ -75,6 +78,17 @@ module Idcf
|
|
75
78
|
"`#{name}` is required to be a #{valid_type}"
|
76
79
|
)
|
77
80
|
end
|
81
|
+
|
82
|
+
def validate_presence!(attributes, action)
|
83
|
+
required_attributes(action).each do |name|
|
84
|
+
unless attributes.key?(name)
|
85
|
+
fail(
|
86
|
+
MissingAttribute,
|
87
|
+
"`#{name}` is required in #{action} action"
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
78
92
|
end
|
79
93
|
end
|
80
94
|
end
|
data/lib/idcf/dns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idcf-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nownabe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dotenv
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,4 +196,3 @@ signing_key:
|
|
182
196
|
specification_version: 4
|
183
197
|
summary: A Ruby client for IDCF Cloud DNS Service.
|
184
198
|
test_files: []
|
185
|
-
has_rdoc:
|