globodns_client 0.1.1 → 0.1.2

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: ef189c0e0e8641ad46bce929c8e9b65ef9f7a8a8
4
- data.tar.gz: 679c80481af03e2fe7c957b874070d87c279e06e
3
+ metadata.gz: 0c26434dc9b3be19c2a94ddf9358ef8a0bb574dc
4
+ data.tar.gz: 9b575524550b1ad79868d5c8e26508f35f43b1ac
5
5
  SHA512:
6
- metadata.gz: 1a21db3fe2c80ce26a58ead6da080e104836ce5b3b8776f5f219395cdff6cc1a704e866ab4e32c30e39a478b2e67d74eba8add2b405c32c2db08d58ed47b8ebe
7
- data.tar.gz: 427778107dcc3dbb602f16b55a10fca3c31ff264495b09e5473d874ed09df367321da07ccf45e9184363e22f84a892fc582fac3d1334b85010dd9c9e325ddda6
6
+ metadata.gz: 10357b24abcd70987f1a44721ba76225d061b3f20eee3b395c979ee48369c56b422b7b839fecf0422ab90e6eb74e1d5833a11b8ef3ec7c9082a29eb1a67e8534
7
+ data.tar.gz: eb1b3fa03366843538c8f83c38d82d3b0b83fddfdff83bd431295fb177b2e2dfb737d78ea86b568ca49011905c96002ac7c81f5eaded4919b3566aa127e1e49f
@@ -52,6 +52,10 @@ module GlobodnsClient
52
52
  host = get_host(key, zone, kind)
53
53
  response = request('post', 'record', host, zone['id'], kind, value)
54
54
  end
55
+ begin
56
+ schedule_export
57
+ rescue Exception
58
+ end
55
59
  response['record']
56
60
  end
57
61
 
@@ -61,6 +65,11 @@ module GlobodnsClient
61
65
  raise GlobodnsClient::NotFound, "Record not found for (#{key})"
62
66
  end
63
67
  response = request('delete', 'record', nil, record['id'])
68
+ begin
69
+ schedule_export
70
+ rescue Exception
71
+ end
72
+ response
64
73
  end
65
74
 
66
75
  private
@@ -88,10 +97,14 @@ module GlobodnsClient
88
97
 
89
98
  raise ArgumentError, "Invalid request. id shouldn't be nil" if kind.eql?('record') && id.nil?
90
99
  headers = {'X-Auth-Token' => @auth_token, 'Content-type' => 'application/json'}
91
- if kind.eql?('domain')
100
+
101
+ case kind
102
+ when 'domain'
92
103
  uri = 'domains.json'
93
- else
104
+ when 'record'
94
105
  uri = "domains/#{id}/records.json"
106
+ when 'export'
107
+ uri = 'bind9/squedule_export.json'
95
108
  end
96
109
 
97
110
  case method
@@ -104,8 +117,10 @@ module GlobodnsClient
104
117
  raise "Not implemented"
105
118
  end
106
119
  when 'post'
107
- payload = {kind => {'name'=> value, 'type' => type, 'content' => addr}}
108
- payload = payload.to_json
120
+ if kind.eql?('record')
121
+ payload = {kind => {'name'=> value, 'type' => type, 'content' => addr}}
122
+ payload = payload.to_json
123
+ end
109
124
  when 'delete'
110
125
  uri = "records/#{id}.json"
111
126
  end
@@ -124,4 +139,8 @@ module GlobodnsClient
124
139
  method.eql?('delete') ? "" : JSON.parse(response.body)
125
140
  end
126
141
  end
142
+
143
+ def schedule_export
144
+ response = request('post', 'export', nil)
145
+ end
127
146
  end
@@ -1,3 +1,3 @@
1
1
  module GlobodnsClient
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globodns_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Thorp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client