globodns_client 0.1.4 → 0.2.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: a6938e5d42e2ffa2e0eb7ac0646776194fb31ae3
4
- data.tar.gz: ba16c9d3834b12f8765c0612608a9f5d21f37a2f
3
+ metadata.gz: fd7ba5a0fefa7e06cabe7d77e6d71235c1c9feaf
4
+ data.tar.gz: bb245192fe6ba4f17142106a0f6a68c98f6d816c
5
5
  SHA512:
6
- metadata.gz: 222255e573e49e9240b6321eea32571534852644645b55f5985f79304319595043e0ef82fdf59661475b9dccdc4668bb51faccb905f1930ae0495e6b622a6ff9
7
- data.tar.gz: bbcd1b3ed9d9aa672428006bd699a67644ab0ea2d687b3c28fa29ee52edf5a1200bdeb1444aab7054a21f23fe16f10818d558105ba12a314f7e0ca05d82c2e7c
6
+ metadata.gz: '0943026588a318eb62a88510f4b1cd7d3591b49b6be51eb58840e575a80870b625e0321b2e335d9c3d93dceb1b0ecab8eb0035435a3c5e1458282812b11bb20d'
7
+ data.tar.gz: 0721e82fc8f5426ed2e85c2f4614b2793d980b07431cdb5b9d75e0bf42e0a41de3ad433bc69994a6c7caab173ae84f0e4d5f873202be408ff915d31de08b416f
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://github.com/globocom/globodns-client-ruby/releases/tag/v0.2.0) (25/01/17)
4
+ ##### - Enhancements
5
+ * Authenticantion using bearer_token
6
+ ##### - Bug fixes
7
+ * Typo fixed
8
+
9
+
10
+
11
+ ## [0.1.x]
12
+ * Authentication using auth_token
@@ -4,10 +4,14 @@ require 'json'
4
4
  module GlobodnsClient
5
5
  class Connection
6
6
  def initialize(options)
7
- @auth_token = options[:auth_token]
7
+ @bearer_token = options[:bearer_token]
8
8
  @host = options[:host]
9
9
  @timeout = options[:timeout] || 30
10
- raise ArgumentError, "You must inform the auth_token and host for GloboDNS" unless @auth_token && @host
10
+ raise ArgumentError, "You must inform the bearer token and host for GloboDNS" unless @bearer_token && @host
11
+ end
12
+
13
+ def set_token token
14
+ @bearer_token = token
11
15
  end
12
16
 
13
17
  def get_zone(key, kind = 'A')
@@ -43,7 +47,7 @@ module GlobodnsClient
43
47
  res
44
48
  end
45
49
 
46
- def get_record(key, kind, zones=[] )
50
+ def get_record(key, kind, zones=[])
47
51
  zones.flatten!
48
52
  res = []
49
53
  zones = get_zone(key, kind) if zones.nil?
@@ -90,6 +94,12 @@ module GlobodnsClient
90
94
  def get_host(key, zone, kind)
91
95
  if kind.eql?('A')
92
96
  host = key.split('.'+zone['domain']['name'])[0]
97
+ # não sei pq fiz esse bloco em baixo (if/else)
98
+ # if key == zone['domain']['name']
99
+ # host = nil
100
+ # else
101
+ # host = key.split('.'+zone['domain']['name'])[0]
102
+ # end
93
103
  elsif kind.eql?('PTR')
94
104
  case zone['domain']['name'].count('.')
95
105
  when 4, 5
@@ -109,7 +119,7 @@ module GlobodnsClient
109
119
  def request(method,kind,value,id = nil, type = nil, addr = nil)
110
120
 
111
121
  raise ArgumentError, "Invalid request. id shouldn't be nil" if kind.eql?('record') && id.nil?
112
- headers = {'X-Auth-Token' => @auth_token, 'Content-type' => 'application/json'}
122
+ headers = {'Authorization' => "Bearer #{@bearer_token}", 'Content-type' => 'application/json'}
113
123
 
114
124
  case kind
115
125
  when 'domain'
@@ -117,7 +127,7 @@ module GlobodnsClient
117
127
  when 'record'
118
128
  uri = "domains/#{id}/records.json"
119
129
  when 'export'
120
- uri = 'bind9/squedule_export.json'
130
+ uri = 'bind9/schedule_export.json'
121
131
  end
122
132
 
123
133
  case method
@@ -1,3 +1,3 @@
1
1
  module GlobodnsClient
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
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.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Thorp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".travis.yml"
92
+ - CHANGELOG.md
92
93
  - CODE_OF_CONDUCT.md
93
94
  - Gemfile
94
95
  - LICENSE.txt