gandi_v5 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -9
  3. data/README.md +54 -10
  4. data/lib/gandi_v5.rb +112 -66
  5. data/lib/gandi_v5/billing/info/prepaid.rb +1 -0
  6. data/lib/gandi_v5/data.rb +1 -0
  7. data/lib/gandi_v5/data/converter.rb +3 -2
  8. data/lib/gandi_v5/data/converter/array_of.rb +3 -2
  9. data/lib/gandi_v5/data/converter/integer.rb +3 -2
  10. data/lib/gandi_v5/data/converter/symbol.rb +3 -2
  11. data/lib/gandi_v5/data/converter/time.rb +3 -2
  12. data/lib/gandi_v5/domain.rb +9 -6
  13. data/lib/gandi_v5/domain/availability/product/period.rb +1 -1
  14. data/lib/gandi_v5/domain/contact.rb +5 -5
  15. data/lib/gandi_v5/domain/tld.rb +2 -2
  16. data/lib/gandi_v5/domain/transfer_in.rb +170 -0
  17. data/lib/gandi_v5/domain/transfer_in/availability.rb +51 -0
  18. data/lib/gandi_v5/email.rb +1 -0
  19. data/lib/gandi_v5/email/mailbox.rb +1 -1
  20. data/lib/gandi_v5/error/gandi_error.rb +1 -0
  21. data/lib/gandi_v5/live_dns.rb +2 -0
  22. data/lib/gandi_v5/live_dns/domain.rb +28 -1
  23. data/lib/gandi_v5/live_dns/domain/dnssec_key.rb +16 -11
  24. data/lib/gandi_v5/live_dns/domain/snapshot.rb +4 -0
  25. data/lib/gandi_v5/live_dns/domain/tsig_key.rb +7 -4
  26. data/lib/gandi_v5/simple_hosting.rb +1 -0
  27. data/lib/gandi_v5/simple_hosting/instance.rb +3 -0
  28. data/lib/gandi_v5/simple_hosting/instance/application.rb +1 -0
  29. data/lib/gandi_v5/simple_hosting/instance/database.rb +1 -0
  30. data/lib/gandi_v5/simple_hosting/instance/language.rb +1 -1
  31. data/lib/gandi_v5/simple_hosting/instance/upgrade.rb +1 -0
  32. data/lib/gandi_v5/simple_hosting/instance/virtual_host.rb +2 -2
  33. data/lib/gandi_v5/simple_hosting/instance/virtual_host/linked_dns_zone.rb +1 -0
  34. data/lib/gandi_v5/version.rb +1 -1
  35. data/spec/features/list_domain_renewals_spec.rb +16 -0
  36. data/spec/features/list_email_addresses_spec.rb +39 -0
  37. data/spec/fixtures/bodies/GandiV5_Domain_TransferIn/fetch.yml +21 -0
  38. data/spec/fixtures/bodies/GandiV5_Domain_TransferIn_Availability/fetch.yml +10 -0
  39. data/spec/fixtures/vcr/Examples/List_domain_renewals.yml +54 -0
  40. data/spec/fixtures/vcr/Examples/List_email_addresses.yml +103 -0
  41. data/spec/units/gandi_v5/domain/transfer_in/availability_spec.rb +49 -0
  42. data/spec/units/gandi_v5/domain/transfer_in_spec.rb +143 -0
  43. metadata +127 -20
  44. data/.gitignore +0 -26
  45. data/.rspec +0 -3
  46. data/.rubocop.yml +0 -74
  47. data/.travis.yml +0 -38
  48. data/FUNDING.yml +0 -10
  49. data/Gemfile +0 -6
  50. data/Guardfile +0 -39
  51. data/Rakefile +0 -3
  52. data/bin/console +0 -13
  53. data/gandi_v5.gemspec +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bcedab1f98eded02f20893ca2f4b8c5a47abe1d72d3e055ef5688b2969104df
4
- data.tar.gz: 6db74218bd3914c662c2b6cac47c76a4d9497368f80b3ef4f31ad7e6537604a5
3
+ metadata.gz: '00492db9ea48e7cd3d616485712dc3f0c9736cb12faebc0159de840285375d6a'
4
+ data.tar.gz: 79bb285c08c2851de059d69a91aa253ccea6b1b92ea6a42ca7226cb7ec9bf553
5
5
  SHA512:
6
- metadata.gz: 29dad44ec126323a917bcc5c4ac8dd200e1acc7ac32cfdf7c4608a919dd872e9f2071031b371d7ad8bae8a2ed09e6bd2bf660d0095b59999859e91d180b53e70
7
- data.tar.gz: 1d2c599205a31b449c003cf4e2628b0326cf90d45ae3c75a68356879e463ee708c6d81f5fb64e1ee75ffe73fbc5402cc3e2fc290fddfe6777c0fb304ccb45a8f
6
+ metadata.gz: aa18bb67286e8eb23eedbb76cddc973868054eb1499ae37e7cce920600211c26d9bed1a6fb62296df670daaddb2d712a74933f323752ec7e8c183628b8699494
7
+ data.tar.gz: 98a55427b458e40adb22ab8c3da8da6224c0614b1251ade51082a2a55d6837490788c95a9584cc8a00233f1b9f40f01e7ad6e06e6e8efe78b00cdd5e7554b467
@@ -1,5 +1,19 @@
1
1
  # Gandi V5 API Gem Changelog
2
2
 
3
+ ## Version 0.9.0
4
+
5
+ * Add transferring a domain to Gandi (I don't have any domains outside Gandi to test this myself so it's possible I've misread the docs and a bug is waiting to be found, please add an issue if I have):
6
+ * GandiV5::Domain::TransferIn:
7
+ * .create(fqdn, \*\*options)
8
+ * .fetch(fqdn)
9
+ * .relaunch(fqdn)
10
+ * .resend_foa_emails(fqdn, email_address)
11
+ * \#relaunch
12
+ * \#resend_foa_emails(email_address)
13
+ * GandiV5::Domain::TransferIn::Availabillity:
14
+ * .fetch(fqdn, auth_code = nil)
15
+ * Documentation improvements
16
+
3
17
  ## Version 0.8.0
4
18
 
5
19
  * Domain:
@@ -21,15 +35,15 @@
21
35
  * .list now returns an array of strings
22
36
  * Can no longer change the zone used by a domain
23
37
  * Added automatic_snapshots attribute for whether snapshots are automatically created when a modification is made to this domain's records
24
- * #replace_records and #replace_records_for merged into #replace_records
38
+ * \#replace_records and \#replace_records_for merged into \#replace_records
25
39
  * If replacing with a zone file use the new #replace_zone_lines
26
40
  * Added:
27
41
  * .create
28
42
  * .record_types
29
43
  * .generic_name_servers(fqdn)
30
- * #name_servers and #fetch_name_servers
31
- * #tsig_keys, #fetch_tsig_keys, #add_tsig_key, #remove_tsig_key
32
- * #axfr_clients, #fetch_axfr_clients, #add_axfr_client, #remove_axfr_client
44
+ * \#name_servers and #fetch_name_servers
45
+ * \#tsig_keys, #fetch_tsig_keys, \#add_tsig_key, \#remove_tsig_key
46
+ * \#axfr_clients, #fetch_axfr_clients, #add_axfr_client, \#remove_axfr_client
33
47
  * ::DnssecKeys, #dnssec_keys, #fetch_dnssec_keys
34
48
  * Snapshots:
35
49
  * Moved to live under LiveDNS::Domain not LiveDNS::Zone
@@ -79,11 +93,11 @@
79
93
  ## Version 0.2.0
80
94
 
81
95
  * Enhancements to GandiV5::Domain
82
- * .availability(fqdn, **options) moved to GandiV5::Domain::Availability.fetch(fqdn, **options)
96
+ * .availability(fqdn, \*\*options) moved to GandiV5::Domain::Availability.fetch(fqdn, \*\*options)
83
97
  * .create now returns created domain (except in dry-run mode)
84
98
  * .tlds moved to GandiV5::Domain::TLD.list
85
99
  * .tld(name) moved to GandiV5::Domain::TLD.fetch(name)
86
- * #renewal_price(currency: 'GBP', period: 1) added
100
+ * \#renewal_price(currency: 'GBP', period: 1) added
87
101
  * Enhancements to GandiV5::Email::Mailbox
88
102
  * .create now returns created mailbox
89
103
  * .create now checks for available slots and a valid type has been passed
@@ -92,14 +106,14 @@
92
106
  * Add #disable to disable the auto responder in Gandi
93
107
  * Enhancements to GandiV5::Email::Slot
94
108
  * .create now returns created slot
95
- * #delete now checks for inactiveness and refundableness
109
+ * \#delete now checks for inactiveness and refundableness
96
110
  * Enhancements to GandiV5::LiveDNS::Domain
97
111
  * Add #zone and #fetch_zone
98
- * Remove #replace_*_records_for methods
112
+ * Remove #replace_\*_records_for methods
99
113
  * Changes to #replace_records_for to allow calling with name, type, ttl and values. When calling with name and fecords records MUST be passed as an array.
100
114
  * Enhancements to GandiV5::LiveDNS::Zone
101
115
  * .create now returns created zone
102
- * Remove #replace_*_records_for methods
116
+ * Remove #replace_\*_records_for methods
103
117
  * Changes to #replace_records_for to allow calling with name, type, ttl and values. When calling with name and fecords records MUST be passed as an array.
104
118
  * Enhancements to GandiV5::LiveDNS::Zone::Snapshot
105
119
  * Add .list
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/gandi_v5.png)](http://badge.fury.io/rb/gandi_v5)
2
- [![Build Status](https://secure.travis-ci.org/robertgauld/gandi_v5.png?branch=master)](http://travis-ci.org/robertgauld/gandi_v5)
3
- [![Coveralls Status](https://coveralls.io/repos/robertgauld/gandi_v5/badge.png?branch=master)](https://coveralls.io/r/robertgauld/gandi_v5)
4
- [![Code Climate](https://codeclimate.com/github/robertgauld/gandi_v5.png?branch=master)](https://codeclimate.com/github/robertgauld/gandi_v5)
5
- [![security](https://hakiri.io/github/robertgauld/gandi_v5/master.svg)](https://hakiri.io/github/robertgauld/gandi_v5/master)
2
+ [![Build Status](https://secure.travis-ci.org/robertgauld/gandi_v5.png?branch=main)](http://travis-ci.org/robertgauld/gandi_v5)
3
+ [![Coveralls Status](https://coveralls.io/repos/robertgauld/gandi_v5/badge.png?branch=main)](https://coveralls.io/r/robertgauld/gandi_v5)
4
+ [![Code Climate](https://codeclimate.com/github/robertgauld/gandi_v5.png?branch=main)](https://codeclimate.com/github/robertgauld/gandi_v5)
6
5
 
7
6
  ## Ruby Versions
8
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.
@@ -25,23 +24,24 @@ Gandi say: **_"Please note that this API is currently in BETA testing, so care s
25
24
 
26
25
  But then you were going to be careful anyway as this gem is currently in the version 0.something range weren't you!
27
26
 
28
- Details of the API can be found at:
27
+ Details of Gandi's API can be found at:
29
28
 
30
29
  * <https://api.gandi.net/docs/>
31
30
  * <https://doc.livedns.gandi.net/>
32
31
 
32
+ Details of the gem's API can be found at <https://rubydoc.info/github/robertgauld/gandi_v5/main>
33
33
 
34
34
  ## Installation
35
35
 
36
36
  If you're using bundler then add it to your Gemfile and run the bundle command.
37
37
 
38
38
  ```ruby
39
- gem 'gandi_v5', '~> 0.7'
39
+ gem 'gandi_v5', '~> 0.8'
40
40
  ```
41
41
 
42
42
  If you're not using bundler then install it from the command line.
43
43
  ```bash
44
- gem install gandi_v5 -v '~> 0.7'
44
+ gem install gandi_v5 -v '~> 0.8'
45
45
  ```
46
46
 
47
47
  ## Usage
@@ -58,6 +58,52 @@ GandiV5.api_key = '…' # Unless you've set it in the environment variable GANDI
58
58
 
59
59
  ### Examples
60
60
 
61
+ #### List renewal dates and costs for all domains
62
+ ```ruby
63
+ # For each domain (sorted by assending renewal date) print <date>\t<cost>\t<fqdn>
64
+ GandiV5::Domain.list.each do |domain|
65
+ puts [
66
+ domain.dates.registry_ends_at.to_date,
67
+ "£#{domain.renewal_price.price_after_taxes}",
68
+ domain.fqdn
69
+ ].join("\t")
70
+ end
71
+ ```
72
+
73
+ #### List email addresses for all domains
74
+
75
+ ```ruby
76
+ # For each domain:
77
+ # 1. Create an empty hash to store address => description
78
+ # 2. Get the mailboxes and add them to the hash
79
+ # 3. Get the forwards and add them to the hash
80
+ # 4. Sort the hash by email address
81
+ # 5. Print the list
82
+ GandiV5::Domain.list.each do |domain|
83
+ emails = {}
84
+
85
+ mailboxes = GandiV5::Email::Mailbox.list(domain.fqdn)
86
+ mailboxes.each do |mailbox|
87
+ mailbox.refresh
88
+ emails["#{mailbox.login}@#{domain.fqdn}"] = "#{mailbox.type} mailbox " \
89
+ "(#{mailbox.quota_usage.to_i}% " \
90
+ "of #{(mailbox.quota / 1024**3).round}GB used)"
91
+ mailbox.aliases.each do |alias_name|
92
+ emails["#{alias_name}@#{domain.fqdn}"] = "alias for #{mailbox.login}@#{domain.fqdn}"
93
+ end
94
+ end
95
+
96
+ forwards = GandiV5::Email::Forward.list(domain.fqdn)
97
+ forwards.each do |forward|
98
+ emails["#{forward.source}@#{domain.fqdn}"] = "forwards to #{forward.destinations.join(', ')}"
99
+ end
100
+
101
+ emails.sort.each do |address, text|
102
+ puts "#{address}\t#{text}"
103
+ end
104
+ end
105
+ ```
106
+
61
107
  #### Domains
62
108
 
63
109
  ```ruby
@@ -68,15 +114,13 @@ domains = GandiV5.domains
68
114
  domains.map!(&:refresh)
69
115
  ```
70
116
 
71
- TODO: More examples!
72
-
73
-
74
117
  ## Versioning
75
118
 
76
119
  We follow the [Semantic Versioning](http://semver.org/) concept.
77
120
 
78
121
  | Gem Version | Gandi API Release Date |
79
122
  | --------------- | ------------------------ |
123
+ | 0.9.0 | 2020-07-29 |
80
124
  | 0.8.0 | 2020-07-10 |
81
125
  | 0.7.0 | 2020-05-07 |
82
126
  | 0.6.0 | 2020-05-07 (not LiveDNS) |
@@ -5,11 +5,12 @@ require 'securerandom'
5
5
  require 'zeitwerk'
6
6
 
7
7
  # Custom inflector for Zeitwerk.
8
+ # @api private
8
9
  class MyInflector < Zeitwerk::Inflector
9
10
  # Convert file's base name to class name when
10
11
  # Zeitwerk's included inflector gets it wrong.
11
12
  # @param basename [String] the file's base name (no path or extension)
12
- # @param abspath [String] the file's absolute path
13
+ # @param _abspath [String] the file's absolute path
13
14
  # @return [String] the class name
14
15
  def camelize(basename, _abspath)
15
16
  case basename
@@ -31,32 +32,37 @@ loader.setup
31
32
 
32
33
  # Namespace for classes which access the Gandi V5 API.
33
34
  # Also provides useful methods and constants for them.
34
- # This is where you configure the gem:
35
- # * Setting your Gandi API key:
36
- # 1. Get your API key - Login to Gandi and visit User Settings ->
37
- # Change password & configure access restrictions.
35
+ # To get your API key login to Gandi and visit
36
+ # "User Settings" -> "Change password & configure access restrictions".
37
+ # Set your API key either in the GANDI_API_KEY environment variable or
38
+ # by setting the api_key class attribute.
38
39
  # @see https://api.gandi.net/docs/
39
40
  # @see https://doc.livedns.gandi.net/
40
41
  # @!attribute [w] api_key
41
42
  # @return [String]
42
43
  class GandiV5
44
+ # Base URL for all API requests.
43
45
  BASE = 'https://api.gandi.net/v5/'
44
46
 
47
+ # Get information on a domain.
45
48
  # @see GandiV5::Domain.fetch
46
49
  def self.domain(fqdn)
47
50
  GandiV5::Domain.fetch(fqdn)
48
51
  end
49
52
 
53
+ # Get information on all domains.
50
54
  # @see GandiV5::Domain.list
51
55
  def self.domains(**params)
52
56
  GandiV5::Domain.list(**params)
53
57
  end
54
58
 
59
+ # List mailboxes for a domain.
55
60
  # @see GandiV5::Email::Mailbox.list
56
61
  def self.mailboxes(fqdn, **params)
57
62
  GandiV5::Email::Mailbox.list(fqdn, **params)
58
63
  end
59
64
 
65
+ # List email slots for a domain.
60
66
  # @see GandiV5::Email::Slot.list
61
67
  def self.mailbox_slots(fqdn)
62
68
  GandiV5::Email::Slot.list(fqdn)
@@ -65,15 +71,21 @@ class GandiV5
65
71
  class << self
66
72
  attr_writer :api_key
67
73
 
68
- # Might raise:
69
- # * RestClient::NotFound
70
- # * RestClient::Unauthorized
71
- # Bad authentication attempt because of a wrong API Key.
72
- # * RestClient::Forbidden
73
- # Access to the resource is denied.
74
- # Mainly due to a lack of permissions to access it.
75
- # * GandiV5::Error
76
- # * JSON::ParserError
74
+ # Make a GET request to a Gandi end point.
75
+ # @param url [String, #to_s]
76
+ # the full URL (including GandiV5::BASE) to fetch.
77
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
78
+ # the headers to send in the request, the authorisation will be added.
79
+ # @return [Array<(RestClient::Response, Object)>]
80
+ # The response from the server and the result of parsing the responce's body.
81
+ # @raise [RestClient::NotFound]
82
+ # @raise [RestClient::Unauthorized]
83
+ # Bad authentication attempt because of a wrong API Key.
84
+ # @raise [RestClient::Forbidden]
85
+ # Access to the resource is denied.
86
+ # Mainly due to a lack of permissions to access it.
87
+ # @raise [GandiV5::Error]
88
+ # @raise [JSON::ParserError]
77
89
  def get(url, **headers)
78
90
  prepare_headers headers, url
79
91
  response = RestClient.get url, **headers
@@ -82,15 +94,23 @@ class GandiV5
82
94
  handle_bad_request(e)
83
95
  end
84
96
 
85
- # Might raise:
86
- # * RestClient::NotFound
87
- # * RestClient::Unauthorized
88
- # Bad authentication attempt because of a wrong API Key.
89
- # * RestClient::Forbidden
90
- # Access to the resource is denied.
91
- # Mainly due to a lack of permissions to access it.
92
- # * GandiV5::Error
93
- # * JSON::ParserError
97
+ # Make a GET request to a paginated end point at Gandi.
98
+ # @param url [String, #to_s]
99
+ # the full URL (including GandiV5::BASE) to fetch.
100
+ # @param page [#each, Integer] the page/pages of results to get.
101
+ # @param per_page [Integer, #to_s] the number of items to get per page of results.
102
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
103
+ # the headers to send in the request, the authorisation will be added.
104
+ # @return [Array<(RestClient::Response, Object)>]
105
+ # The response from the server and the result of parsing the responce's body.
106
+ # @raise [RestClient::NotFound]
107
+ # @raise [RestClient::Unauthorized]
108
+ # Bad authentication attempt because of a wrong API Key.
109
+ # @raise [RestClient::Forbidden]
110
+ # Access to the resource is denied.
111
+ # Mainly due to a lack of permissions to access it.
112
+ # @raise [GandiV5::Error]
113
+ # @raise [JSON::ParserError]
94
114
  def paginated_get(url, page = (1..), per_page = 100, **headers)
95
115
  unless page.respond_to?(:each)
96
116
  fail ArgumentError, 'page must be positive' unless page.positive?
@@ -112,16 +132,21 @@ class GandiV5
112
132
  end
113
133
  end
114
134
 
115
- # Might raise:
116
- # * RestClient::NotFound
117
- # * RestClient::Unauthorized
118
- # Bad authentication attempt because of a wrong API Key.
119
- # * RestClient::Forbidden
120
- # Access to the resource is denied.
121
- # Mainly due to a lack of permissions to access it.
122
- # * RestClient::Conflict
123
- # * GandiV5::Error
124
- # * JSON::ParserError
135
+ # Make a DELETE request to a Gandi end point.
136
+ # @param url [String, #to_s]
137
+ # the full URL (including GandiV5::BASE) to fetch.
138
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
139
+ # the headers to send in the request, the authorisation will be added.
140
+ # @return [Array<(RestClient::Response, Object)>]
141
+ # The response from the server and the result of parsing the responce's body.
142
+ # @raise [RestClient::NotFound]
143
+ # @raise [RestClient::Unauthorized]
144
+ # Bad authentication attempt because of a wrong API Key.
145
+ # @raise [RestClient::Forbidden]
146
+ # Access to the resource is denied.
147
+ # Mainly due to a lack of permissions to access it.
148
+ # @raise [GandiV5::Error]
149
+ # @raise [JSON::ParserError]
125
150
  def delete(url, **headers)
126
151
  prepare_headers headers, url
127
152
  response = RestClient.delete url, **headers
@@ -133,17 +158,24 @@ class GandiV5
133
158
  handle_bad_request(e)
134
159
  end
135
160
 
136
- # Might raise:
137
- # * RestClient::NotFound
138
- # * RestClient::Unauthorized
139
- # Bad authentication attempt because of a wrong API Key.
140
- # * RestClient::Forbidden
141
- # Access to the resource is denied.
142
- # Mainly due to a lack of permissions to access it.
143
- # * RestClient::BadRequest
144
- # * RestClient::Conflict
145
- # * GandiV5::Error
146
- # * JSON::ParserError
161
+ # Make a PATCH request to a Gandi end point.
162
+ # @param url [String, #to_s]
163
+ # the full URL (including GandiV5::BASE) to fetch.
164
+ # @param payload [String, #to_s] the body for the request.
165
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
166
+ # the headers to send in the request, the authorisation will be added.
167
+ # @return [Array<(RestClient::Response, Object)>]
168
+ # The response from the server and the result of parsing the responce's body.
169
+ # @raise [RestClient::NotFound]
170
+ # @raise [RestClient::Unauthorized]
171
+ # Bad authentication attempt because of a wrong API Key.
172
+ # @raise [RestClient::Forbidden]
173
+ # Access to the resource is denied.
174
+ # Mainly due to a lack of permissions to access it.
175
+ # @raise [RestClient::BadRequest]
176
+ # @raise [RestClient::Conflict]
177
+ # @raise [GandiV5::Error]
178
+ # @raise [JSON::ParserError]
147
179
  def patch(url, payload = '', **headers)
148
180
  prepare_headers headers, url
149
181
  headers[:'content-type'] ||= 'application/json'
@@ -153,17 +185,24 @@ class GandiV5
153
185
  handle_bad_request(e)
154
186
  end
155
187
 
156
- # Might raise:
157
- # * RestClient::NotFound
158
- # * RestClient::Unauthorized
159
- # Bad authentication attempt because of a wrong API Key.
160
- # * RestClient::Forbidden
161
- # Access to the resource is denied.
162
- # Mainly due to a lack of permissions to access it.
163
- # * RestClient::BadRequest
164
- # * RestClient::Conflict
165
- # * GandiV5::Error
166
- # * JSON::ParserError
188
+ # Make a POST request to a Gandi end point.
189
+ # @param url [String, #to_s]
190
+ # the full URL (including GandiV5::BASE) to fetch.
191
+ # @param payload [String, #to_s] the body for the request.
192
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
193
+ # the headers to send in the request, the authorisation will be added.
194
+ # @return [Array<(RestClient::Response, Object)>]
195
+ # The response from the server and the result of parsing the responce's body.
196
+ # @raise [RestClient::NotFound]
197
+ # @raise [RestClient::Unauthorized]
198
+ # Bad authentication attempt because of a wrong API Key.
199
+ # @raise [RestClient::Forbidden]
200
+ # Access to the resource is denied.
201
+ # Mainly due to a lack of permissions to access it.
202
+ # @raise [RestClient::BadRequest]
203
+ # @raise [RestClient::Conflict]
204
+ # @raise [GandiV5::Error]
205
+ # @raise [JSON::ParserError]
167
206
  def post(url, payload = '', **headers)
168
207
  prepare_headers headers, url
169
208
  headers[:'content-type'] ||= 'application/json'
@@ -173,17 +212,24 @@ class GandiV5
173
212
  handle_bad_request(e)
174
213
  end
175
214
 
176
- # Might raise:
177
- # * RestClient::NotFound
178
- # * RestClient::Unauthorized
179
- # Bad authentication attempt because of a wrong API Key.
180
- # * RestClient::Forbidden
181
- # Access to the resource is denied.
182
- # Mainly due to a lack of permissions to access it.
183
- # * RestClient::BadRequest
184
- # * RestClient::Conflict
185
- # * GandiV5::Error
186
- # * JSON::ParserError
215
+ # Make a PUT request to a Gandi end point.
216
+ # @param url [String, #to_s]
217
+ # the full URL (including GandiV5::BASE) to fetch.
218
+ # @param payload [String, #to_s] the body for the request.
219
+ # @param headers [Hash{String, Symbol, #to_s => String, Symbol, #to_s}]
220
+ # the headers to send in the request, the authorisation will be added
221
+ # @return [Array<(RestClient::Response, Object)>]
222
+ # The response from the server and the result of parsing the responce's body.
223
+ # @raise [RestClient::NotFound]
224
+ # @raise [RestClient::Unauthorized]
225
+ # Bad authentication attempt because of a wrong API Key.
226
+ # @raise [RestClient::Forbidden]
227
+ # Access to the resource is denied.
228
+ # Mainly due to a lack of permissions to access it.
229
+ # @raise [RestClient::BadRequest]
230
+ # @raise [RestClient::Conflict]
231
+ # @raise [GandiV5::Error]
232
+ # @raise [JSON::ParserError]
187
233
  def put(url, payload = '', **headers)
188
234
  prepare_headers headers, url
189
235
  headers[:'content-type'] ||= 'application/json'
@@ -22,6 +22,7 @@ class GandiV5
22
22
  member :updated_at, converter: GandiV5::Data::Converter::Time
23
23
 
24
24
  # Check if current balance is below the warning threshold.
25
+ # @return [Boolean]
25
26
  def warning?
26
27
  return nil if warning_threshold.nil?
27
28