czds 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
  SHA256:
3
- metadata.gz: b1b1669d9f2fbe5c01a32c851f56ba49470f26d563db177000bd082d6d114a06
4
- data.tar.gz: 113490aacf7138ca8d2cb2bcbd1118fccdf5114db48f28de1519c959add72a42
3
+ metadata.gz: bad75046d0a8d1900d29e4a949a7527749419b657ccec1f112db7f0b915c0086
4
+ data.tar.gz: 85cf821a7467c8c6645600d41d3691f793faad3c592a5c47d40b398527802c3d
5
5
  SHA512:
6
- metadata.gz: 7385c9935d178cf80078ecbda41c18b17ed5aab48e66eb6182eafd7dc9b6be5f83211870a0e558b0c26bd110f94d95d35c35cba9c7cf5007cd18c4d03b1b663c
7
- data.tar.gz: 84a57b7265e649a59a184bbf23b70e704c36b935a32cc3c39f6ee8f96088b7b9e3f61cde4ecf8967bdce5c12f838e853a768ae73901585d3b942bdcfd7b0a201
6
+ metadata.gz: 3a589c30e9ad8e7597433a3579839db51ac2cac0949d4baeeb1a51ae0258bbd5a67d3f239a7bb982e46aff3f6aeff34c2bdc93352de35874fdb105e8faeb01dc
7
+ data.tar.gz: e259a4e46235c252eb71527cd793b1d57df6e8458a17082de5256aa5da31cd892ca7d68d229fc543ca07586860ec9f81132a6f50bfc5abf6ef2ed66c9a73eff0
data/lib/czds/cli/main.rb CHANGED
@@ -24,6 +24,23 @@ module CZDS
24
24
  zone_file.download
25
25
  end
26
26
 
27
+ desc "status", "Show zone file status"
28
+ option :config_file, type: :string, default: './czds.config.json', desc: 'Path to config file'
29
+ option :tld, type: :string, desc: 'Top-level domain, default: com'
30
+ option :no_timestamp, type: :boolean, desc: 'Disable timestamp in file name'
31
+ option :username, type: :string, desc: 'CZDS username'
32
+ option :password, type: :string, desc: 'CZDS password'
33
+
34
+ def status
35
+ config_file = load_config(options[:config_file])
36
+ configure_client(options, config_file)
37
+
38
+ tld = options[:tld] || config_file['tld'] || CZDS::Configuration::DEFAULTS[:tld]
39
+
40
+ zone_file = CZDS::ZoneFile.new(tld)
41
+ puts zone_file.status.to_h
42
+ end
43
+
27
44
  private
28
45
 
29
46
  def configure_client(options, config_file)
data/lib/czds/client.rb CHANGED
@@ -86,7 +86,7 @@ module CZDS
86
86
 
87
87
  raise FileSizeError if File.size(file_path) != status.length
88
88
 
89
- status.length
89
+ status.to_h.merge(file_path:)
90
90
  end
91
91
 
92
92
  private
data/lib/czds/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CZDS
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -4,6 +4,15 @@ module CZDS
4
4
  def timestamp
5
5
  updated_at.gsub(':', '-')
6
6
  end
7
+
8
+ def to_h
9
+ {
10
+ file_name:,
11
+ length:,
12
+ updated_at:,
13
+ timestamp:,
14
+ }
15
+ end
7
16
  end
8
17
  end
9
18
  end
@@ -20,8 +20,6 @@ module CZDS
20
20
  client.download_zone_file(tld)
21
21
  end
22
22
 
23
- private
24
-
25
23
  def status
26
24
  @status ||= client.zone_file_status(tld)
27
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: czds
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
  - Marcin Doliwa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-22 00:00:00.000000000 Z
11
+ date: 2024-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.5.9
77
+ rubygems_version: 3.5.10
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Ruby client for the ICANN Centralized Zone Data Service (CZDS) API.