hover 0.0.2 → 0.0.3
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/.ruby-version +1 -1
- data/README.md +4 -0
- data/lib/hover.rb +1 -1
- data/lib/hover/api.rb +2 -2
- data/lib/hover/version.rb +1 -1
- data/script/dns +43 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb17f2689084081199895642c2b44998a5d78e93
|
4
|
+
data.tar.gz: a76592e80b06e17700b1dd7930b85f47c79b1982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a8742c571e8f410c7364416d3e044a36b3fa83b4d0a28af3e9cb392a7bb50a65fb7d0be17316f973cd031d2df6c2edd29209ce94648db5fe30aced7af34fbf
|
7
|
+
data.tar.gz: 91d2198c7709463fd10ec91154766314e03f81245b40ac9ced76988c79eeaaab1a7091c93a0e161c7d97c77daddc9d2c70dc715d863556b86031510532a1a841
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0
|
1
|
+
2.0.0-p247
|
data/README.md
CHANGED
data/lib/hover.rb
CHANGED
@@ -2,7 +2,7 @@ require "hover/version"
|
|
2
2
|
require "hover/api"
|
3
3
|
|
4
4
|
# rest-client doesn't allow use to ssl_version (as of 1.6.7)
|
5
|
-
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version] =
|
5
|
+
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version] = :TLSv1_2
|
6
6
|
|
7
7
|
module Hover
|
8
8
|
# Your code goes here...
|
data/lib/hover/api.rb
CHANGED
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
module Hover
|
5
5
|
class Api
|
6
6
|
URL = 'https://www.hover.com/api/'
|
7
|
-
AUTH_URL = 'https://www.hover.com/
|
7
|
+
AUTH_URL = 'https://www.hover.com/api/login'
|
8
8
|
|
9
9
|
attr_accessor :client, :username, :password
|
10
10
|
|
@@ -19,7 +19,7 @@ module Hover
|
|
19
19
|
def authenticate(username, password)
|
20
20
|
auth = {username: username, password: password}
|
21
21
|
RestClient.post(AUTH_URL, auth) do |response, request, result|
|
22
|
-
if response.code
|
22
|
+
if [302,200].include?(response.code)
|
23
23
|
return response.cookies["hoverauth"]
|
24
24
|
else
|
25
25
|
raise "Failed to authenticate"
|
data/lib/hover/version.rb
CHANGED
data/script/dns
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# DNS update
|
5
|
+
# Example script for updating hover domains
|
6
|
+
#
|
7
|
+
# This should be pretty self explanatory. Domains should
|
8
|
+
# just be in the format www.google.com or so. Also, this
|
9
|
+
# requires curl if you don't set IP_ADDRESS in your env.
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require 'hover'
|
14
|
+
|
15
|
+
current_ip = ENV['IP_ADDRESS'] || %x{curl icanhazip.com}
|
16
|
+
username = ENV['HOVER_USER'] or fail "No hover username supplied"
|
17
|
+
password = ENV['HOVER_PASS'] or fail "No hover password supplied"
|
18
|
+
domains = ENV['HOVER_DOMAINS'].split(",") or fail "No hover domains supplied"
|
19
|
+
|
20
|
+
$api = Hover::Api.new(username, password)
|
21
|
+
|
22
|
+
def update_domain(full_name, ip)
|
23
|
+
subdomain = full_name[/^[^.]*/, 0]
|
24
|
+
domain_name = full_name[/^[^.]*\.(.*)$/, 1]
|
25
|
+
|
26
|
+
domains = $api.dns
|
27
|
+
domains.each do |domain|
|
28
|
+
if domain["domain_name"] == domain_name
|
29
|
+
domain["entries"].each do |entry|
|
30
|
+
next if entry["type"] != "A"
|
31
|
+
|
32
|
+
if entry["name"] == subdomain
|
33
|
+
dns_id = entry["id"]
|
34
|
+
$api.update_record(dns_id, {content: ip})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
domains.each do |domain|
|
42
|
+
update_domain(domain, current_ip)
|
43
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/hover.rb
|
85
85
|
- lib/hover/api.rb
|
86
86
|
- lib/hover/version.rb
|
87
|
+
- script/dns
|
87
88
|
homepage: https://github.com/daviddavis/hover
|
88
89
|
licenses:
|
89
90
|
- MIT
|
@@ -104,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
105
|
version: '0'
|
105
106
|
requirements: []
|
106
107
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.10
|
108
109
|
signing_key:
|
109
110
|
specification_version: 4
|
110
111
|
summary: Gem for using Hover.com's API.
|