dynect_rest 0.4.4.beta → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07994682f1515d9cce892c91cf5eb92ce0334cc0
4
- data.tar.gz: 49137e17b91cbd4ec29b708b077923bee6c91a33
3
+ metadata.gz: 4e3ece239e7a35225b681fea9e263ecc6fa33d38
4
+ data.tar.gz: 5a2f1b86f1f946009f7b12467fbf0d8bde9667be
5
5
  SHA512:
6
- metadata.gz: a29ce73f1dc63214d49d1abc15bd8c6a7a913de695534607595aff9c2c48b9e14e9ed5c47aedf664619b34c5af718aef7ba431413dbc35106aa3a85f7a5561df
7
- data.tar.gz: 0aa2839499464941698332a55c5ec85a25ea368024356ff1e795022856432694ef38177fd10c770748bf7c8939d80ab28437e9fd479168f26c9e4bcfe161370a
6
+ metadata.gz: 170afc2b7b9c6969e5e702c81a05d5450d855bf56f2c2ad07bc99ba6c3f05c253f05e0fead2c1335fdc58f5d7e4c4bfbd0f8a7b2682ae86ecfb38369ae3b552e
7
+ data.tar.gz: eb8752f90fd7f70f03f3cdbec87ab80494d283e9c55599017e7fce5287675d36e3b8c30195cdac6533b5c57d6f850040d9d9d5fa6c82506154ae1c7efdf5a099
data/README.rdoc CHANGED
@@ -12,7 +12,7 @@ Since this is 90% of what you'll be doing, we make it easy.
12
12
  dyn.cname.fqdn("something.example.com").cname("ec2-10-10-10-10.amazonaws.com").save
13
13
  dyn.publish
14
14
 
15
- Will add an A record and a CNAME. You can use the chained method syntax for every resource record - we map unknown methods to the resource data you make in the call. See link:"example.rb" for an executable example using environment variables.
15
+ Will add an A record and a CNAME. You can use the chained method syntax for every resource record - we map unknown methods to the resource data you make in the call. See link: (example.rb)[https://github.com/adamhjk/dynect_rest/blob/master/example.rb] for an executable example using environment variables.
16
16
 
17
17
  == GSLB
18
18
 
@@ -156,7 +156,7 @@ class DynectRest
156
156
  def to_json
157
157
  {
158
158
  "ttl" => @ttl,
159
- "monitor" => @monitor,
159
+ "monitor" => @monitor.sort,
160
160
  "region" => {
161
161
  "region_code" => @region_code,
162
162
  "serve_count" => @serve_count,
@@ -133,7 +133,7 @@ class DynectRest
133
133
 
134
134
  def method_missing(method_symbol, *args, &block)
135
135
  method_string = method_symbol.to_s
136
- if (args.length > 0 && method_string !~ /=$/)
136
+ if (args.any? && method_string !~ /=$/)
137
137
  @rdata[method_string] = args.length == 1 ? args[0] : args
138
138
  self
139
139
  elsif @rdata.has_key?(method_string)
@@ -17,5 +17,5 @@
17
17
  #
18
18
 
19
19
  class DynectRest
20
- VERSION='0.4.4.beta'
20
+ VERSION='0.4.4'
21
21
  end
data/lib/dynect_rest.rb CHANGED
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,15 +39,15 @@ class DynectRest
39
39
  @user_name = user_name
40
40
  @password = password
41
41
  @rest = RestClient::Resource.new('https://api2.dynect.net/REST/', :headers => { :content_type => 'application/json' }, :max_redirects=>max_redirects)
42
- @zone = zone
42
+ @zone = zone
43
43
  @verbose = verbose
44
44
  login if connect
45
45
  end
46
46
 
47
47
  ##
48
48
  # Session Management
49
- ##
50
-
49
+ ##
50
+
51
51
  # Login to Dynect - must be done before any other methods called.
52
52
  #
53
53
  # See: https://manage.dynect.net/help/docs/api2/rest/resources/Session.html
@@ -68,6 +68,34 @@ class DynectRest
68
68
  delete('Session')
69
69
  end
70
70
 
71
+ # Get all the entries in a zone
72
+ #
73
+ # See: https://help.dynect.net/get-node-list-api/
74
+ #
75
+ # Get nodes under the FQDN -- https://api.dynect.net/REST/NodeLIst/<zone>/<FQDN>/
76
+ # Get nodes in the zone -- https://api.dynect.net/REST/NodeList/<zone>/
77
+ def node_list(zone=nil, fqdn=nil)
78
+ zone ||= @zone
79
+ resource = [zone,fqdn].compact.join("/")
80
+ get("NodeList/#{resource}").each do |ref|
81
+ ref.sub!(/^\/REST\//,'')
82
+ end
83
+ end
84
+
85
+ # Get all the entries in a zone
86
+ #
87
+ # See: https://help.dynect.net/get-all-records-api/
88
+ #
89
+ # Retrieves all records from the zone -- https://api.dynect.net/REST/AllRecord/<zone>
90
+ # Retrieves all records from the node -- https://api.dynect.net/REST/AllRecord/<zone>/<FQDN>/
91
+ def all_records(zone=nil, fqdn=nil)
92
+ zone ||= @zone
93
+ resource = [zone,fqdn].compact.join("/")
94
+ get("AllRecord/#{resource}").each do |ref|
95
+ ref.sub!(/^\/REST\//,'')
96
+ end
97
+ end
98
+
71
99
  ##
72
100
  # Zone
73
101
  ##
@@ -77,7 +105,7 @@ class DynectRest
77
105
  #
78
106
  # @param [String] The zone to fetch - if one is provided when instantiated, we use that.
79
107
  # @return [Hash] The dynect API response
80
- def get_zone(zone=nil)
108
+ def get_zone(zone=nil)
81
109
  zone ||= @zone
82
110
  get("Zone/#{zone}")
83
111
  end
@@ -89,7 +117,7 @@ class DynectRest
89
117
  # @param [String] The zone to publish - if one is provided when instantiated, we use that.
90
118
  # @return [Hash] The dynect API response
91
119
  def publish(zone=nil)
92
- zone ||= @zone
120
+ zone ||= @zone
93
121
  put("Zone/#{zone}", { "publish" => true })
94
122
  end
95
123
 
@@ -100,7 +128,7 @@ class DynectRest
100
128
  # @param [String] The zone to freeze - if one is provided when instantiated, we use that.
101
129
  # @return [Hash] The dynect API response
102
130
  def freeze(zone=nil)
103
- zone ||= @zone
131
+ zone ||= @zone
104
132
  put("Zone/#{zone}", { "freeze" => true })
105
133
  end
106
134
 
@@ -111,7 +139,7 @@ class DynectRest
111
139
  # @param [String] The zone to thaw - if one is provided when instantiated, we use that.
112
140
  # @return [Hash] The dynect API response
113
141
  def thaw(zone=nil)
114
- zone ||= @zone
142
+ zone ||= @zone
115
143
  put("Zone/#{zone}", { "thaw" => true })
116
144
  end
117
145
 
@@ -198,7 +226,7 @@ class DynectRest
198
226
  puts "I have #{e.inspect} with #{e.http_code}"
199
227
  end
200
228
  if e.http_code == 307
201
- e.response.sub!('/REST/','') if e.response =~ /^\/REST\//
229
+ e.response.sub!(/^\/REST\//,'')
202
230
  get(e.response)
203
231
  end
204
232
  e.response
@@ -225,7 +253,7 @@ class DynectRest
225
253
  response["msgs"].each do |error_message|
226
254
  error_messages << "#{error_message["LVL"]} #{error_message["ERR_CD"]} #{error_message["SOURCE"]} - #{error_message["INFO"]}"
227
255
  end
228
- raise DynectRest::Exceptions::RequestFailed, "Request failed: #{error_messages.join("\n")}"
256
+ raise DynectRest::Exceptions::RequestFailed, "Request failed: #{error_messages.join("\n")}"
229
257
  end
230
258
  end
231
259
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynect_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4.beta
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -15,70 +15,56 @@ dependencies:
15
15
  name: rest-client
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: json
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '>='
25
+ - - ">="
40
26
  - !ruby/object:Gem::Version
41
27
  version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rake
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
- - - '>='
32
+ - - ">="
47
33
  - !ruby/object:Gem::Version
48
34
  version: '0'
49
35
  type: :development
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - '>='
39
+ - - ">="
54
40
  - !ruby/object:Gem::Version
55
41
  version: '0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: rspec
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
- - - '>='
46
+ - - ">="
61
47
  - !ruby/object:Gem::Version
62
48
  version: 2.10.0
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - '>='
53
+ - - ">="
68
54
  - !ruby/object:Gem::Version
69
55
  version: 2.10.0
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: yard
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
- - - '>='
60
+ - - ">="
75
61
  - !ruby/object:Gem::Version
76
62
  version: '0'
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - '>='
67
+ - - ">="
82
68
  - !ruby/object:Gem::Version
83
69
  version: '0'
84
70
  description: Use the Dynect services REST API
@@ -89,17 +75,17 @@ extra_rdoc_files:
89
75
  - LICENSE
90
76
  - README.rdoc
91
77
  files:
92
- - Rakefile
93
78
  - LICENSE
79
+ - README.rdoc
80
+ - Rakefile
94
81
  - lib/dynect_rest.rb
95
- - lib/dynect_rest/version.rb
96
82
  - lib/dynect_rest/exceptions.rb
97
83
  - lib/dynect_rest/gslb.rb
98
84
  - lib/dynect_rest/resource.rb
99
- - spec/spec_helper.rb
85
+ - lib/dynect_rest/version.rb
100
86
  - spec/dynect_rest_spec.rb
101
- - README.rdoc
102
- homepage: http://github.com/adamhjk/dynect-rest
87
+ - spec/spec_helper.rb
88
+ homepage: http://github.com/adamhjk/dynect_rest
103
89
  licenses: []
104
90
  metadata: {}
105
91
  post_install_message:
@@ -108,17 +94,17 @@ require_paths:
108
94
  - lib
109
95
  required_ruby_version: !ruby/object:Gem::Requirement
110
96
  requirements:
111
- - - '>='
97
+ - - ">="
112
98
  - !ruby/object:Gem::Version
113
99
  version: '0'
114
100
  required_rubygems_version: !ruby/object:Gem::Requirement
115
101
  requirements:
116
- - - '>='
102
+ - - ">="
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  requirements: []
120
106
  rubyforge_project:
121
- rubygems_version: 2.0.3
107
+ rubygems_version: 2.2.2
122
108
  signing_key:
123
109
  specification_version: 4
124
110
  summary: Dynect REST API library