porkbun 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/bin/porkbun +6 -0
- data/lib/porkbun/version.rb +1 -1
- data/lib/porkbun.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb0888f42796fb19dfde0c817a15c707965abc4e67a177c7a5d0c7fa1052322e
|
4
|
+
data.tar.gz: 4247934278026c1d90e1ce737719a233c61763324d14f48308fc13fd4a91a897
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eeeca53624c7b7bda72d190390e9977461d1680a7446642ec7ce111bc591d753ba5db83ef4716d59f90470159052955db6eeb610120da2cc212c1cf005ffe4c
|
7
|
+
data.tar.gz: b9b4fc53993bc4b3138d0cc43af698d118fbca85ab722be03971d77763832241a0a22ce2baa3ddfebb6aeb1aeab0da217a78c32af3b9a911ac9d49016dcac8d1
|
data/README.md
CHANGED
@@ -58,6 +58,10 @@ The gem also comes with a CLI
|
|
58
58
|
porkbun retrieve <domain> [<id>] # List all records for a domain
|
59
59
|
|
60
60
|
|
61
|
+
be sure to set the environmental variables for it to work
|
62
|
+
|
63
|
+
export PORKBUN_API_KEY = YOUR_API_KEY
|
64
|
+
export PORKBUN_SECRET_API_KEY = YOUR_SECRET_API_KEY
|
61
65
|
|
62
66
|
## Development
|
63
67
|
|
data/bin/porkbun
CHANGED
@@ -36,6 +36,12 @@ class CLI < Thor
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
desc 'env', 'Print environment variables'
|
40
|
+
def env
|
41
|
+
puts 'PORKBUN_API_KEY: ' + ENV['PORKBUN_API_KEY'].to_s
|
42
|
+
puts 'BUN_SECRET_API_KEY: ' + ENV['PORKBUN_SECRET_API_KEY'].to_s
|
43
|
+
end
|
44
|
+
|
39
45
|
desc 'delete_all <domain>', 'deletes all records for a domain. this is destructive. use with caution'
|
40
46
|
def delete_all(domain, id = '')
|
41
47
|
records = get_all(domain, id)
|
data/lib/porkbun/version.rb
CHANGED
data/lib/porkbun.rb
CHANGED
@@ -7,6 +7,9 @@ module Porkbun
|
|
7
7
|
class Error < StandardError; end
|
8
8
|
|
9
9
|
def self.porkbun(path, options = {})
|
10
|
+
if ENV.fetch('PORKBUN_API_KEY', nil).nil? || ENV.fetch('PORKBUN_SECRET_API_KEY', nil).nil?
|
11
|
+
abort 'PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY must be set'
|
12
|
+
end
|
10
13
|
res = HTTP.post File.join('https://porkbun.com/api/json/v3', path), json: {
|
11
14
|
secretapikey: ENV.fetch('PORKBUN_SECRET_API_KEY', nil),
|
12
15
|
apikey: ENV.fetch('PORKBUN_API_KEY', nil)
|
@@ -102,6 +105,18 @@ module Porkbun
|
|
102
105
|
"#{name}. #{ttl} IN #{type} #{prio_str} #{content_str}".tr_s(' ', ' ')
|
103
106
|
end
|
104
107
|
|
108
|
+
def to_h
|
109
|
+
{
|
110
|
+
name: name,
|
111
|
+
content: content,
|
112
|
+
type: type,
|
113
|
+
ttl: ttl,
|
114
|
+
prio: prio,
|
115
|
+
domain: domain,
|
116
|
+
id: id
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
105
120
|
def create
|
106
121
|
res = Porkbun.porkbun File.join('dns/create', domain), get_options
|
107
122
|
parse_response res
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: porkbun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bretoi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.5.3
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Porkbun API wrapper for Ruby.
|