gandi_v5 0.10.0 → 0.10.1

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: cc90c3434cb1207a7eed04d4b2331039f8ac8e32e2861e4d3693b034658eabb1
4
- data.tar.gz: 51b125b39d4b4fe71a2fc4f55815bf8c4e5c94a5d7e01bfd9e104be1886a91fa
3
+ metadata.gz: 1040cd55b98ae6f6d747d769a74e5b2cd92b09b1a8cbe5a4115851d76485f1da
4
+ data.tar.gz: afd99593144ae4650027b3bfa316bf2a49430954a2cfc846e4782a4123853ca1
5
5
  SHA512:
6
- metadata.gz: 6478500701daaeec1623ce28db9d0568a9971f6087d7d7064d13cded11afa76e24b987e7804b7a88a2b5f3b4aa0496b860352399be8fcd82cdb88b640ba1c5e8
7
- data.tar.gz: bd3089b11811fc944acaf7d39798d45a36c5e17a9a5be90d2a90d07270a2ca835e73428f58d641893d79f074b96a7c42671efb1ed2c4c40ca838840a0ee87759
6
+ metadata.gz: 1124d5fc0cc35cb3e9c41629ba9286b40c0b31a7f47f8dc7e76f7135143770c29b8da8acbecb6869ec1a9c93cd30115287f9f42b0a5e1126ee89b6ef4ff08aa2
7
+ data.tar.gz: 800b4b45ea100c39929ba4bae9ab0479b5c9d552e1d10a56029df2ff8b023a90d5794b939fb4de9ba0dc2f1b2abd71fe62f661cb5c85346ee5b53acf02d6b8f3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Gandi V5 API Gem Changelog
2
2
 
3
+ ## Version 0.10.1
4
+
5
+ * Fix issue with json not being included
6
+
3
7
  ## Version 0.10.0
4
8
 
5
9
  * GandiV5::Domain
data/README.md CHANGED
@@ -7,10 +7,10 @@
7
7
  This gem supports the following versions of ruby, it may work on other versions but is not tested against them so don't rely on it.
8
8
 
9
9
  * ruby:
10
- * 2.6.0 - 2.6.6
11
- * 2.7.0 - 2.7.2
12
- * 3.0.0
13
- * truffleruby 20.1.0 - 20.3.0
10
+ * 2.6.0 - 2.6.7
11
+ * 2.7.0 - 2.7.3
12
+ * 3.0.0 - 3.0.1
13
+ * truffleruby 20.1.0 - 21.0.0
14
14
 
15
15
  This gem doesn't yet support the following versions of ruby, although hopefully it soon will.
16
16
 
data/lib/gandi_v5/data.rb CHANGED
@@ -22,19 +22,17 @@ class GandiV5
22
22
  # Get a hash representation of the object.
23
23
  # @return [Hash<Symbol => Object>]
24
24
  def to_h
25
- Hash[
26
- data_members.map do |key|
27
- value = send(key)
28
- next [key, value] if value.nil?
29
-
30
- if value.is_a?(Enumerable)
31
- value = to_h_transform_enumerable(value)
32
- elsif value.respond_to?(:to_h)
33
- value = value.to_h
34
- end
35
- [key, value]
25
+ data_members.map do |key|
26
+ value = send(key)
27
+ next [key, value] if value.nil?
28
+
29
+ if value.is_a?(Enumerable)
30
+ value = to_h_transform_enumerable(value)
31
+ elsif value.respond_to?(:to_h)
32
+ value = value.to_h
36
33
  end
37
- ]
34
+ [key, value]
35
+ end.to_h
38
36
  end
39
37
 
40
38
  # Get a hash representation of this object suitable for passing back to Gandi.
@@ -136,7 +136,7 @@ class GandiV5
136
136
  transfer.instance_exec { @duration = data.dig('params', 'duration') }
137
137
  if data.key?('foa')
138
138
  transfer.instance_exec do
139
- @foa_status = Hash[data['foa'].map { |hash| hash.values_at('email', 'answer') }]
139
+ @foa_status = data['foa'].map { |hash| hash.values_at('email', 'answer') }.to_h
140
140
  end
141
141
  end
142
142
  transfer
@@ -84,10 +84,10 @@ class GandiV5
84
84
  hash = hash.transform_keys(&:to_sym)
85
85
  .transform_values { |value| GandiV5::Domain::Contact.from_gandi value }
86
86
 
87
- hash.define_singleton_method(:owner) { send :'[]', :owner }
88
- hash.define_singleton_method(:admin) { send :'[]', :admin }
89
- hash.define_singleton_method(:bill) { send :'[]', :bill }
90
- hash.define_singleton_method(:tech) { send :'[]', :tech }
87
+ hash.define_singleton_method(:owner) { send :[], :owner }
88
+ hash.define_singleton_method(:admin) { send :[], :admin }
89
+ hash.define_singleton_method(:bill) { send :[], :bill }
90
+ hash.define_singleton_method(:tech) { send :[], :tech }
91
91
 
92
92
  hash
93
93
  }
@@ -138,10 +138,8 @@ class GandiV5
138
138
 
139
139
  alias domain_uuid uuid
140
140
 
141
- # rubocop:disable Style/AsciiComments
142
141
  # Returns the string representation of the domain.
143
142
  # @return [String] e.g. "example.com", "😀.com (xn--e28h.uk.com)"
144
- # rubocop:enable Style/AsciiComments
145
143
  def to_s
146
144
  string = fqdn_unicode
147
145
  string += " (#{fqdn})" unless fqdn == fqdn_unicode
@@ -29,9 +29,9 @@ class GandiV5
29
29
 
30
30
  TYPES = %i[standard premium free].freeze
31
31
  QUOTAS = {
32
- free: 3 * 1024**3,
33
- standard: 3 * 1024**3,
34
- premium: 50 * 1024**3
32
+ free: 3 * (1024**3),
33
+ standard: 3 * (1024**3),
34
+ premium: 50 * (1024**3)
35
35
  }.freeze
36
36
 
37
37
  members :address, :login, :quota_used, :aliases, :fallback_email
@@ -29,7 +29,7 @@ class GandiV5
29
29
  member(
30
30
  :capacity,
31
31
  converter: GandiV5::Data::Converter.new(
32
- from_gandi: ->(value) { value * 1_024**2 }
32
+ from_gandi: ->(value) { value * (1_024**2) }
33
33
  )
34
34
  )
35
35
  member :created_at, converter: GandiV5::Data::Converter::Time
@@ -75,6 +75,7 @@ class GandiV5
75
75
  # @overload fetch_zone_lines()
76
76
  # Fetch all records for this domain.
77
77
  # @see https://api.gandi.net/docs/livedns/#get-v5-livedns-domains-fqdn-records
78
+ # @see https://rubygems.org/gems/dns-zonefile dns-zonefile gem may be helpful too
78
79
  # @overload fetch_zone_lines(name)
79
80
  # Fetch records for a name.
80
81
  # @see https://api.gandi.net/docs/livedns/#get-v5-livedns-domains-fqdn-records-rrset_name
@@ -48,7 +48,7 @@ class GandiV5
48
48
  member(
49
49
  :certificates,
50
50
  converter: GandiV5::Data::Converter.new(
51
- from_gandi: ->(array) { Hash[array.map { |h| [h['id'], h['pending']] }] }
51
+ from_gandi: ->(array) { array.map { |h| [h['id'], h['pending']] }.to_h }
52
52
  )
53
53
  )
54
54
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GandiV5
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'
5
5
  end
data/lib/gandi_v5.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
3
4
  require 'rest_client'
4
5
  require 'securerandom'
5
6
  require 'zeitwerk'
@@ -19,8 +19,8 @@ describe 'Examples', :vcr do
19
19
  mailboxes.each do |mailbox|
20
20
  mailbox.refresh
21
21
  emails["#{mailbox.login}@#{domain.fqdn}"] = "#{mailbox.type} mailbox " \
22
- "(#{mailbox.quota_usage.to_i}% " \
23
- "of #{(mailbox.quota / 1024**3).round}GB used)"
22
+ "(#{mailbox.quota_usage.to_i}% " \
23
+ "of #{(mailbox.quota / (1024**3)).round}GB used)"
24
24
  mailbox.aliases.each do |alias_name|
25
25
  emails["#{alias_name}@#{domain.fqdn}"] = "alias for #{mailbox.login}@#{domain.fqdn}"
26
26
  end
@@ -224,10 +224,10 @@ describe GandiV5::Template do
224
224
  create = {
225
225
  name: 'template name',
226
226
  description: 'description of template',
227
- 'dns_records': [{ name: 'host', ttl: 600, type: 'TXT', values: ['value'] }],
228
- 'mailboxes': %w[user1 user2],
229
- 'name_servers': ['1.1.1.1', '2.2.2.2'],
230
- 'web_forwardings': [
227
+ dns_records: [{ name: 'host', ttl: 600, type: 'TXT', values: ['value'] }],
228
+ mailboxes: %w[user1 user2],
229
+ name_servers: ['1.1.1.1', '2.2.2.2'],
230
+ web_forwardings: [
231
231
  { type: :http302, target: 'example.com', host: 'here', override: true, protocol: :https_only }
232
232
  ]
233
233
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gandi_v5
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gauld
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-09 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -477,6 +477,7 @@ metadata:
477
477
  documentation_uri: https://rubydoc.info/github/robertgauld/gandi_v5/main
478
478
  homepage_uri: https://github.com/robertgauld/gandi_v5
479
479
  source_code_uri: https://github.com/robertgauld/gandi_v5
480
+ rubygems_mfa_required: 'true'
480
481
  post_install_message:
481
482
  rdoc_options:
482
483
  - "--title"
@@ -499,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
499
500
  - !ruby/object:Gem::Version
500
501
  version: 2.6.14
501
502
  requirements: []
502
- rubygems_version: 3.2.3
503
+ rubygems_version: 3.2.22
503
504
  signing_key:
504
505
  specification_version: 4
505
506
  summary: Make use of Gandi's V5 API.