idcf-dns 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3400132f655289a5acc5bacb0089f51daa2775e
4
- data.tar.gz: 4b3a4d074de7a3996cd1962a20e34b31f288be87
3
+ metadata.gz: b861ba7b2191302c0ed3274701013ee502adf511
4
+ data.tar.gz: c28eb0197d213f6f3d68cabf592c385093800949
5
5
  SHA512:
6
- metadata.gz: ff8b191e6863afc2aeeb9d34c85d44b96e5bdb02d41048a17072a570073d70d950a0caa8edb8c1b929e844f2cf02480eb811059e90b99251dff3a2ef57468654
7
- data.tar.gz: 34e350511c35e53bdb40e815f5dd3f6df6b48852575d6aecc4588fabdb9a243ce9a090178bc42c18dd8bcac21b90f9e3e20dda8e0bdab87479724f575ce33138
6
+ metadata.gz: 5268d175b7674ccfc191b2c443a5415f04469710912c96324aa54b488cb6a230e2b5a928f5bddea479a2de5b2e308f5736050a55344739ab06d747705af8e553
7
+ data.tar.gz: d6da59613a8567de2e9c65569f4348424a32ac8ad1e5b6159c13ff99fdf38bf01886e19a0ffb7845d8a58030384f243d6c9f8f75d20c01fb544d86610c281c24
data/README.md CHANGED
@@ -34,12 +34,18 @@ client =
34
34
  secret_key: ENV["IDCF_SECRET_KEY"]
35
35
  )
36
36
 
37
+ # Call GET request directly
38
+ # returns Response object
37
39
  response = client.get("zones")
38
40
  response.success? #=> true
41
+ response.status #=> 200
42
+
43
+ # Response#body returns HTTP response body as a hash or an array
39
44
  response.body #=> [zone1, zone2, ...]
40
45
  response.body[0] #=> zone1
46
+
47
+ # Response#[] is alias to Response#body[]
41
48
  response[0] #=> zone1
42
- response.status #=> 200
43
49
  ```
44
50
 
45
51
  #### Zones
@@ -100,18 +106,18 @@ records = client.list_records(zone_uuid).body
100
106
  records[0]["name"] #=> "baz.foobar.example.com"
101
107
 
102
108
  # Get a record
103
- record = client.get_record(record_uuid, zone_uuid).body
109
+ record = client.get_record(zone_uuid, record_uuid).body
104
110
  record["name"] #=> "baz.foobar.example.com"
105
111
  ```
106
112
 
107
113
  ##### Update record
108
114
  ```ruby
109
- client.update_record(record_uuid, zone_uuid, content: "210.140.158.1")
115
+ client.update_record(zone_uuid, record_uuid, content: "210.140.158.1")
110
116
  ```
111
117
 
112
118
  ##### Delete record
113
119
  ```ruby
114
- client.delete_record(record_uuid, zone_uuid)
120
+ client.delete_record(zone_uuid, record_uuid)
115
121
  ```
116
122
 
117
123
  ### Advanced usage
@@ -22,21 +22,21 @@ module Idcf
22
22
 
23
23
  # Delete a record.
24
24
  #
25
- # @param uuid [String] UUID of record
26
25
  # @param zone_uuid [String] UUID of zone
26
+ # @param uuid [String] UUID of record
27
27
  # @param headers [Hash] HTTP request headers
28
28
  # @return [Response] HTTP response object
29
- def delete_record(uuid, zone_uuid, headers = {})
29
+ def delete_record(zone_uuid, uuid, headers = {})
30
30
  delete!("zones/#{zone_uuid}/records/#{uuid}", {}, headers)
31
31
  end
32
32
 
33
33
  # Get a record.
34
34
  #
35
- # @param uuid [String] UUID of record
36
35
  # @param zone_uuid [String] UUID of zone
36
+ # @param uuid [String] UUID of record
37
37
  # @param headers [Hash] HTTP request headers
38
38
  # @return [Response] HTTP response object
39
- def get_record(uuid, zone_uuid, headers = {})
39
+ def get_record(zone_uuid, uuid, headers = {})
40
40
  get!("zones/#{zone_uuid}/records/#{uuid}", {}, headers)
41
41
  end
42
42
 
@@ -50,8 +50,8 @@ module Idcf
50
50
 
51
51
  # Update a record.
52
52
  #
53
- # @param uuid [String] UUID of record
54
53
  # @param zone_uuid [String] UUID of zone
54
+ # @param uuid [String] UUID of record
55
55
  # @param attributes [Hash] request attributes
56
56
  # @option attributes [String] :name name of record
57
57
  # @option attributes [String] :type type of record
@@ -61,18 +61,18 @@ module Idcf
61
61
  # @option attributes [Integer] :priority priority of record
62
62
  # @param headers [Hash] HTTP request headers
63
63
  # @return [Response] HTTP response object
64
- def update_record(uuid, zone_uuid, attributes, headers = {})
64
+ def update_record(zone_uuid, uuid, attributes, headers = {})
65
65
  Validators::Record.validate_attributes!(attributes, :update)
66
66
  put!("zones/#{zone_uuid}/records/#{uuid}", attributes, headers)
67
67
  end
68
68
 
69
69
  # Get a record object.
70
70
  #
71
- # @param uuid [String] UUID of record
72
71
  # @param zone_uuid [String] UUID of zone
72
+ # @param uuid [String] UUID of record
73
73
  # @param headers [Hash] HTTP request headers
74
74
  # @return [Resources::Record] a record object
75
- def record(uuid, zone_uuid, headers = {})
75
+ def record(zone_uuid, uuid, headers = {})
76
76
  Resources::Record.new(self, get_record(uuid, zone_uuid, headers).body)
77
77
  end
78
78
 
@@ -32,11 +32,7 @@ module Idcf
32
32
  when Array
33
33
  body.size
34
34
  when Hash
35
- if body.key?("uuid")
36
- 1
37
- else
38
- 0
39
- end
35
+ body.key?("uuid") ? 1 : 0
40
36
  else
41
37
  0
42
38
  end
@@ -1,5 +1,5 @@
1
1
  module Idcf
2
2
  module Dns
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
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.5
4
+ version: 0.0.6
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-27 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler