gandi_v5 0.2.0 → 0.7.0
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/.gitignore +2 -0
- data/.rubocop.yml +13 -3
- data/.travis.yml +15 -1
- data/CHANGELOG.md +63 -0
- data/FUNDING.yml +10 -0
- data/LICENSE.md +2 -6
- data/README.md +16 -21
- data/gandi_v5.gemspec +3 -2
- data/lib/gandi_v5.rb +64 -24
- data/lib/gandi_v5/billing.rb +0 -2
- data/lib/gandi_v5/billing/info.rb +0 -2
- data/lib/gandi_v5/data.rb +1 -4
- data/lib/gandi_v5/data/converter.rb +0 -4
- data/lib/gandi_v5/data/converter/integer.rb +26 -0
- data/lib/gandi_v5/domain.rb +167 -28
- data/lib/gandi_v5/domain/availability.rb +0 -3
- data/lib/gandi_v5/domain/availability/product.rb +0 -3
- data/lib/gandi_v5/domain/live_dns.rb +42 -0
- data/lib/gandi_v5/domain/renewal_information.rb +0 -3
- data/lib/gandi_v5/domain/sharing_space.rb +10 -2
- data/lib/gandi_v5/email.rb +0 -4
- data/lib/gandi_v5/email/forward.rb +102 -0
- data/lib/gandi_v5/email/mailbox.rb +57 -13
- data/lib/gandi_v5/email/slot.rb +11 -3
- data/lib/gandi_v5/error.rb +0 -2
- data/lib/gandi_v5/live_dns.rb +0 -16
- data/lib/gandi_v5/live_dns/domain.rb +221 -80
- data/lib/gandi_v5/live_dns/domain/dnssec_key.rb +115 -0
- data/lib/gandi_v5/live_dns/domain/record.rb +81 -0
- data/lib/gandi_v5/live_dns/domain/snapshot.rb +107 -0
- data/lib/gandi_v5/live_dns/domain/tsig_key.rb +71 -0
- data/lib/gandi_v5/organization.rb +38 -5
- data/lib/gandi_v5/organization/customer.rb +90 -0
- data/lib/gandi_v5/version.rb +1 -1
- data/spec/.rubocop.yml +9 -2
- data/spec/fixtures/bodies/GandiV5_Billing/{info.yaml → info.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Domain/{get.yaml → fetch.yml} +8 -0
- data/spec/fixtures/bodies/GandiV5_Domain/{fetch_contacts.yaml → fetch_contacts.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Domain/fetch_glue_records.yml +7 -0
- data/spec/fixtures/bodies/GandiV5_Domain/fetch_livedns.yml +6 -0
- data/spec/fixtures/bodies/GandiV5_Domain/fetch_name_servers.yml +2 -0
- data/spec/fixtures/bodies/GandiV5_Domain/{renewal_info.yaml → fetch_renewal_info.yml} +0 -3
- data/spec/fixtures/bodies/GandiV5_Domain/{restore_info.yaml → fetch_restore_info.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Domain/{list.yaml → list.yml} +1 -0
- data/spec/fixtures/bodies/GandiV5_Domain_Availability/{fetch.yaml → fetch.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Domain_TLD/{fetch.yaml → fetch.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Domain_TLD/{list.yaml → list.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Email_Forward/list.yml +6 -0
- data/spec/fixtures/bodies/GandiV5_Email_Mailbox/{get.yaml → fetch.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Email_Mailbox/{list.yaml → list.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Email_Slot/{get.yaml → fetch.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Email_Slot/{list.yaml → list.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/fetch.yml +3 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/{list.yaml → list.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/list_tsig.yml +3 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/nameservers.yml +3 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_DnssecKey/fetch.yml +12 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_DnssecKey/list.yml +9 -0
- data/spec/fixtures/bodies/{GandiV5_LiveDNS_Zone_Snapshot/fetch.yaml → GandiV5_LiveDNS_Domain_Snapshot/fetch.yml} +4 -3
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_Snapshot/list.yml +5 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_TsigKey/fetch.yml +9 -0
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_TsigKey/list.yml +4 -0
- data/spec/fixtures/bodies/GandiV5_Organization/{get.yaml → fetch.yml} +0 -0
- data/spec/fixtures/bodies/GandiV5_Organization/list.yml +7 -0
- data/spec/fixtures/bodies/GandiV5_Organization_Customer/list.yml +8 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/units/gandi_v5/billing_spec.rb +2 -2
- data/spec/units/gandi_v5/data/converter/integer_spec.rb +16 -0
- data/spec/units/gandi_v5/domain/availability_spec.rb +1 -1
- data/spec/units/gandi_v5/domain/live_dns_spec.rb +45 -0
- data/spec/units/gandi_v5/domain/tld_spec.rb +2 -2
- data/spec/units/gandi_v5/domain_spec.rb +294 -65
- data/spec/units/gandi_v5/email/forward_spec.rb +92 -0
- data/spec/units/gandi_v5/email/mailbox_spec.rb +122 -40
- data/spec/units/gandi_v5/email/slot_spec.rb +13 -5
- data/spec/units/gandi_v5/live_dns/domain/dnssec_key_spec.rb +128 -0
- data/spec/units/gandi_v5/live_dns/{record_set_spec.rb → domain/record_spec.rb} +1 -1
- data/spec/units/gandi_v5/live_dns/domain/snapshot_spec.rb +101 -0
- data/spec/units/gandi_v5/live_dns/domain/tsig_key_spec.rb +78 -0
- data/spec/units/gandi_v5/live_dns/domain_spec.rb +299 -120
- data/spec/units/gandi_v5/live_dns_spec.rb +0 -12
- data/spec/units/gandi_v5/organization/customer_spec.rb +81 -0
- data/spec/units/gandi_v5/organization_spec.rb +52 -1
- data/spec/units/gandi_v5_spec.rb +139 -30
- metadata +68 -95
- data/doc/GandiV5.html +0 -1183
- data/doc/GandiV5/Billing.html +0 -293
- data/doc/GandiV5/Billing/Info.html +0 -641
- data/doc/GandiV5/Billing/Info/Prepaid.html +0 -817
- data/doc/GandiV5/Data.html +0 -785
- data/doc/GandiV5/Data/ClassMethods.html +0 -223
- data/doc/GandiV5/Data/Converter.html +0 -433
- data/doc/GandiV5/Data/Converter/ArrayOf.html +0 -413
- data/doc/GandiV5/Data/Converter/Symbol.html +0 -322
- data/doc/GandiV5/Data/Converter/Time.html +0 -330
- data/doc/GandiV5/Domain.html +0 -16847
- data/doc/GandiV5/Domain/AutoRenew.html +0 -1237
- data/doc/GandiV5/Domain/Availability.html +0 -1020
- data/doc/GandiV5/Domain/Availability/Product.html +0 -988
- data/doc/GandiV5/Domain/Availability/Product/Period.html +0 -220
- data/doc/GandiV5/Domain/Availability/Product/Price.html +0 -1031
- data/doc/GandiV5/Domain/Availability/Tax.html +0 -440
- data/doc/GandiV5/Domain/Contact.html +0 -4459
- data/doc/GandiV5/Domain/Contract.html +0 -520
- data/doc/GandiV5/Domain/Dates.html +0 -1313
- data/doc/GandiV5/Domain/RenewalInformation.html +0 -1147
- data/doc/GandiV5/Domain/RestoreInformation.html +0 -339
- data/doc/GandiV5/Domain/SharingSpace.html +0 -437
- data/doc/GandiV5/Domain/TLD.html +0 -1565
- data/doc/GandiV5/Email.html +0 -144
- data/doc/GandiV5/Email/Mailbox.html +0 -6307
- data/doc/GandiV5/Email/Mailbox/Responder.html +0 -1560
- data/doc/GandiV5/Email/Offer.html +0 -514
- data/doc/GandiV5/Email/Slot.html +0 -4244
- data/doc/GandiV5/Error.html +0 -151
- data/doc/GandiV5/Error/GandiError.html +0 -270
- data/doc/GandiV5/LiveDNS.html +0 -300
- data/doc/GandiV5/LiveDNS/Domain.html +0 -2984
- data/doc/GandiV5/LiveDNS/RecordSet.html +0 -1593
- data/doc/GandiV5/LiveDNS/Zone.html +0 -8891
- data/doc/GandiV5/LiveDNS/Zone/Snapshot.html +0 -1556
- data/doc/GandiV5/Organization.html +0 -2341
- data/doc/_index.html +0 -474
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -496
- data/doc/file.README.html +0 -175
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -175
- data/doc/js/app.js +0 -303
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -2427
- data/doc/top-level-namespace.html +0 -110
- data/lib/gandi_v5/live_dns/record_set.rb +0 -79
- data/lib/gandi_v5/live_dns/zone.rb +0 -305
- data/lib/gandi_v5/live_dns/zone/snapshot.rb +0 -81
- data/spec/features/domain_spec.rb +0 -45
- data/spec/features/livedns_domain_spec.rb +0 -8
- data/spec/features/livedns_zone_spec.rb +0 -45
- data/spec/features/mailbox_spec.rb +0 -18
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/get.yaml +0 -4
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/get.yaml +0 -11
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/list.yaml +0 -11
- data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/list.yaml +0 -3
- data/spec/fixtures/vcr/Domain_features/List_domains.yml +0 -54
- data/spec/fixtures/vcr/Domain_features/Renew_domain.yml +0 -133
- data/spec/fixtures/vcr/LiveDNS_Domain_features/List_domains.yml +0 -32
- data/spec/fixtures/vcr/LiveDNS_Zone_features/List_zones.yml +0 -42
- data/spec/fixtures/vcr/LiveDNS_Zone_features/Make_and_save_snapshot.yml +0 -72
- data/spec/fixtures/vcr/LiveDNS_Zone_features/Save_zone_to_file.yml +0 -28
- data/spec/fixtures/vcr/Mailbox_features/List_mailboxes.yml +0 -39
- data/spec/units/gandi_v5/live_dns/zone/snapshot_spec.rb +0 -66
- data/spec/units/gandi_v5/live_dns/zone_spec.rb +0 -347
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6873be5c700e1ef88075c90b71361bb9568b11661661dd0bc4f7d77cfdefd6f0
|
|
4
|
+
data.tar.gz: 13aac04c42357193607cff0f55c0502253fb6b527475e40ad5cb5d53011268ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46afb560fe574db5bf9d47e3e5bbce0843acef12edd132e26cba685608e4b1fa2dc1579dc30e287128ef6462924d56c14856168bcc2d277dededbf9360c45d0b
|
|
7
|
+
data.tar.gz: 9e35714cdb2ad68d57d11f4bdd689a6fc0103d155827682bb6a2f66340e8054af328761827f13e7af857c5c41263568daed84805e20b90e5b580917dea502eab
|
data/.gitignore
CHANGED
|
@@ -5,6 +5,7 @@ Gemfile.lock
|
|
|
5
5
|
# And because this is Ruby, ignore the following
|
|
6
6
|
# (source: https://github.com/github/gitignore/blob/master/Ruby.gitignore):
|
|
7
7
|
|
|
8
|
+
.ruby-version
|
|
8
9
|
notes.txt
|
|
9
10
|
todo.txt
|
|
10
11
|
*.gem
|
|
@@ -16,6 +17,7 @@ InstalledFiles
|
|
|
16
17
|
lib/bundler/man
|
|
17
18
|
pkg
|
|
18
19
|
rdoc
|
|
20
|
+
doc
|
|
19
21
|
spec/reports
|
|
20
22
|
test/tmp
|
|
21
23
|
test/version_tmp
|
data/.rubocop.yml
CHANGED
|
@@ -7,14 +7,24 @@ Gemspec/RequiredRubyVersion:
|
|
|
7
7
|
Metrics/AbcSize:
|
|
8
8
|
Max: 20
|
|
9
9
|
Metrics/ClassLength:
|
|
10
|
-
Max:
|
|
11
|
-
Metrics/
|
|
12
|
-
Max:
|
|
10
|
+
Max: 250
|
|
11
|
+
Metrics/CyclomaticComplexity:
|
|
12
|
+
Max: 8
|
|
13
13
|
Metrics/MethodLength:
|
|
14
14
|
Max: 15
|
|
15
15
|
Metrics/ModuleLength:
|
|
16
16
|
Max: 200
|
|
17
|
+
Metrics/ParameterLists:
|
|
18
|
+
Max: 6
|
|
17
19
|
Style/DocumentationMethod:
|
|
18
20
|
Enabled: true
|
|
21
|
+
Style/HashEachMethods:
|
|
22
|
+
Enabled: true
|
|
23
|
+
Style/HashTransformKeys:
|
|
24
|
+
Enabled: true
|
|
25
|
+
Style/HashTransformValues:
|
|
26
|
+
Enabled: true
|
|
19
27
|
Style/SignalException:
|
|
20
28
|
Enabled: false
|
|
29
|
+
Layout/LineLength:
|
|
30
|
+
Max: 100
|
data/.travis.yml
CHANGED
|
@@ -4,6 +4,12 @@ rvm:
|
|
|
4
4
|
- 2.6.1
|
|
5
5
|
- 2.6.2
|
|
6
6
|
- 2.6.3
|
|
7
|
+
- 2.6.4
|
|
8
|
+
- 2.6.5
|
|
9
|
+
- 2.6.6
|
|
10
|
+
- 2.7.0
|
|
11
|
+
- 2.7.1
|
|
12
|
+
- truffleruby-20.1.0
|
|
7
13
|
gemfile:
|
|
8
14
|
- Gemfile
|
|
9
15
|
branches:
|
|
@@ -12,10 +18,18 @@ branches:
|
|
|
12
18
|
- staging
|
|
13
19
|
- /gh(?:\d)+(?:-.+)?/
|
|
14
20
|
- /dev_ver_\d+\.\d+/
|
|
21
|
+
env:
|
|
22
|
+
global:
|
|
23
|
+
# CC_TEST_REPORTER_ID for reporting test coverage to code climate
|
|
24
|
+
- secure: "C3AcK+/2A4h2+ZayJXc89EQp76o8/2RL03PdtVjWPI6cfBSwN174ImWSdIcs6+Bjv8GH+bADsM4epkTjI7H24wh80If/4jAZJMB6LsAxVC3rZVx2UfDghp1Lwcy6BkNx4VVXMQJUR4rA8fXNd1l6n2a72RbPhTaGYxggw+yiKYNjj5m/u3HWPzTQ9wIx/rLzb2shQU1P9tDX4eRqJixYsd8LvStvXewUKlTQSaxNczzfcSOmeJrrytJGuPQxgBx67hlN40cs84oEbhndjlekZRwYepsRcan9umJEDHnE+k0wLlz/vb2cshYp5tdcfkqspaEhUSV7Vr7ZQNIppI3XyY1hs/pTYc2Vytp3OiY0EXBjKRmiHcnmA8EIkrV9i4OSt6Af3EQJaYU56a0BCaEqzRoQJWOZDS8bVowuO4rY8/xINQBwTojIYAplI/vqX/7xvlRbzIgeWdpvQipPC01d2JtmI/5D1FdGWtzYcDCTRTbHyWmjhr7Jt8qEDMFkbpkcAQiS61baEQ0p4CxaLYm/lpPco1U3e/gMOb/EXDhOrF1I8lSBmVJE/Uz2/3kfOa1DQSxDSRmV1nU3pSd7PUi25Pdx0rezJjRl1UC2gnsNZrCLbplk+VkImXTt3iirV/RuHDo+YVT0efaws7TVH7Uf87jqWf4VZEw/KI3tzfF43CE="
|
|
15
25
|
before_install: gem update bundler
|
|
26
|
+
before_script:
|
|
27
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && chmod +x ./cc-test-reporter && ./cc-test-reporter before-build
|
|
16
28
|
script:
|
|
17
|
-
- bundle exec rubocop
|
|
29
|
+
- if [[ $(echo $TRAVIS_JOB_NUMBER | awk -F . '{ print $2 }') == '1' ]]; then bundle exec rubocop; fi
|
|
18
30
|
- bundle exec rspec
|
|
31
|
+
after_script:
|
|
32
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
|
19
33
|
notifications:
|
|
20
34
|
slack:
|
|
21
35
|
on_success: always
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# Gandi V5 API Gem Changelog
|
|
2
2
|
|
|
3
|
+
## Version 0.7.0
|
|
4
|
+
|
|
5
|
+
* LiveDNS:
|
|
6
|
+
* Rename LiveDNS::RecordSet to LiveDNS::Domain::Record
|
|
7
|
+
* Domains:
|
|
8
|
+
* .list now returns an array of strings
|
|
9
|
+
* Can no longer change the zone used by a domain
|
|
10
|
+
* Added automatic_snapshots attribute for whether snapshots are automatically created when a modification is made to this domain's records
|
|
11
|
+
* #replace_records and #replace_records_for merged into #replace_records
|
|
12
|
+
* If replacing with a zone file use the new #replace_zone_lines
|
|
13
|
+
* Added:
|
|
14
|
+
* .create
|
|
15
|
+
* .record_types
|
|
16
|
+
* .generic_name_servers(fqdn)
|
|
17
|
+
* #name_servers and #fetch_name_servers
|
|
18
|
+
* #tsig_keys, #fetch_tsig_keys, #add_tsig_key, #remove_tsig_key
|
|
19
|
+
* #axfr_clients, #fetch_axfr_clients, #add_axfr_client, #remove_axfr_client
|
|
20
|
+
* ::DnssecKeys, #dnssec_keys, #fetch_dnssec_keys
|
|
21
|
+
* Snapshots:
|
|
22
|
+
* Moved to live under LiveDNS::Domain not LiveDNS::Zone
|
|
23
|
+
* Are now accessed via the fully qualified domain name NOT the zone's UUID
|
|
24
|
+
* Ability to access the zone from a snapshot is removed
|
|
25
|
+
* Taking a snapshot now allows for named snapshots
|
|
26
|
+
* Added automatic attribute for when a snapshot was taken due to a zone change
|
|
27
|
+
* .list now returns an array of snapshots (records are fetched in a seperate request when first needed)
|
|
28
|
+
* Zone removed.
|
|
29
|
+
|
|
30
|
+
## Version 0.6.0
|
|
31
|
+
|
|
32
|
+
* GandiV5::Email::Slot.create now supports sharing_id
|
|
33
|
+
* GandiV5::Email::Slot.create's type argument is now named not positional
|
|
34
|
+
* Add reseller information to GandiV5::Domain
|
|
35
|
+
|
|
36
|
+
## Version 0.5.0
|
|
37
|
+
|
|
38
|
+
* Add support for truffleruby 20.1.0
|
|
39
|
+
* Fix issue with rails in production
|
|
40
|
+
|
|
41
|
+
## Version 0.4.0
|
|
42
|
+
|
|
43
|
+
* Fix exception when delete returns no content-type
|
|
44
|
+
* Add support for ruby 2.7.0
|
|
45
|
+
* Add up/downgrading mailbox offer
|
|
46
|
+
* Add dry run option to creating a mailbox
|
|
47
|
+
* Add sharing_id & dry run option for renewing domain
|
|
48
|
+
* Add listing customers under a reseller organization (GandiV5::Organization::Customer.list and GandiV5::Organization#customers)
|
|
49
|
+
* Add creating customer under a reseller organization (GandiV5::Organization::Customer.create and GandiV5::Organization#create_customer)
|
|
50
|
+
|
|
51
|
+
## Version 0.3.0
|
|
52
|
+
|
|
53
|
+
* Additions to GandiV5::Domain
|
|
54
|
+
* Glue record management
|
|
55
|
+
* LiveDNS management
|
|
56
|
+
* Name server management
|
|
57
|
+
* Update GandiV5::Domain.create to allow purchasing as a reseller and billing to a different organization
|
|
58
|
+
* Add forwarding address management to GandiV5::Email::Forwarding
|
|
59
|
+
* Add GandiV5::Organization.list
|
|
60
|
+
* Uses Zeitwerk for auto loading
|
|
61
|
+
* Add aliasing methods:
|
|
62
|
+
* GandiV5::Domain.mailboxes -> GandiV5::Email::Mailbox.list
|
|
63
|
+
* GandiV5::Domain.mailbox_slots -> GandiV5::Email::Slot.list
|
|
64
|
+
* GandiV5::Domain.email_forwards -> GandiV5::Email::Forward.list
|
|
65
|
+
|
|
3
66
|
## Version 0.2.0
|
|
4
67
|
|
|
5
68
|
* Enhancements to GandiV5::Domain
|
data/FUNDING.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
2
|
+
patreon: robertgauld
|
|
3
|
+
open_collective: # Replace with a single Open Collective username
|
|
4
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
5
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
6
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
7
|
+
liberapay: # Replace with a single Liberapay username
|
|
8
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
9
|
+
otechie: # Replace with a single Otechie username
|
|
10
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/LICENSE.md
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
##
|
|
2
|
-
Copyright (c) 2018, Robert Gauld. All rights reserved.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##License
|
|
1
|
+
## License
|
|
6
2
|
This code can be used under the BSD License (reproduced below).
|
|
7
3
|
Commiters to the project give Robert Gauld the right to redistribute their commits
|
|
8
4
|
under the BSD license.
|
|
9
5
|
|
|
10
6
|
|
|
11
|
-
###BSD License
|
|
7
|
+
### BSD License
|
|
12
8
|
Redistribution and use in source and binary forms, with or without modification,
|
|
13
9
|
are permitted provided that the following conditions are met:
|
|
14
10
|
|
data/README.md
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
[](http://badge.fury.io/rb/gandi_v5)
|
|
2
|
-
|
|
3
|
-
Master branch:
|
|
4
2
|
[](http://travis-ci.org/robertgauld/gandi_v5)
|
|
5
3
|
[](https://coveralls.io/r/robertgauld/gandi_v5)
|
|
6
4
|
[](https://codeclimate.com/github/robertgauld/gandi_v5)
|
|
7
|
-
|
|
8
|
-
Staging branch:
|
|
9
|
-
[](http://travis-ci.org/robertgauld/gandi_v5)
|
|
10
|
-
[](https://coveralls.io/r/robertgauld/gandi_v5)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Build State
|
|
14
|
-
This project uses continuous integration to help ensure that a quality product is delivered.
|
|
15
|
-
Travis CI monitors two branches (versions) of the code:
|
|
16
|
-
|
|
17
|
-
* Master (which is what gets released)
|
|
18
|
-
* Staging (which is what is currently being developed ready for moving to master).
|
|
19
|
-
|
|
5
|
+
[](https://hakiri.io/github/robertgauld/gandi_v5/master)
|
|
20
6
|
|
|
21
7
|
## Ruby Versions
|
|
22
8
|
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.
|
|
23
9
|
|
|
24
10
|
* ruby:
|
|
25
|
-
* 2.6.0 - 2.6.
|
|
11
|
+
* 2.6.0 - 2.6.6
|
|
12
|
+
* 2.7.0 - 2.7.1
|
|
13
|
+
* truffleruby 20.1.0
|
|
26
14
|
* jruby, once it's reached parity with ruby 2.6.x
|
|
15
|
+
* rubinius, once it's reached parity with ruby 2.6.x
|
|
27
16
|
|
|
28
17
|
|
|
29
18
|
## Gandi V5
|
|
@@ -47,12 +36,12 @@ Details of the API can be found at:
|
|
|
47
36
|
If you're using bundler then add it to your Gemfile and run the bundle command.
|
|
48
37
|
|
|
49
38
|
```ruby
|
|
50
|
-
gem 'gandi_v5', '~> 0.
|
|
39
|
+
gem 'gandi_v5', '~> 0.7'
|
|
51
40
|
```
|
|
52
41
|
|
|
53
42
|
If you're not using bundler then install it from the command line.
|
|
54
43
|
```bash
|
|
55
|
-
gem install gandi_v5 -v '~> 0.
|
|
44
|
+
gem install gandi_v5 -v '~> 0.7'
|
|
56
45
|
```
|
|
57
46
|
|
|
58
47
|
## Usage
|
|
@@ -86,9 +75,15 @@ TODO: More examples!
|
|
|
86
75
|
|
|
87
76
|
We follow the [Semantic Versioning](http://semver.org/) concept.
|
|
88
77
|
|
|
89
|
-
| Gem Version | Gandi API Release Date
|
|
90
|
-
| --------------- |
|
|
91
|
-
| 0.
|
|
78
|
+
| Gem Version | Gandi API Release Date |
|
|
79
|
+
| --------------- | ------------------------ |
|
|
80
|
+
| 0.7.0 | 2020-05-07 |
|
|
81
|
+
| 0.6.0 | 2020-05-07 (not LiveDNS) |
|
|
82
|
+
| 0.5.0 | 2019-10-01 |
|
|
83
|
+
| 0.4.0 | 2019-10-01 |
|
|
84
|
+
| 0.3.0 | 2019-08-22 |
|
|
85
|
+
| 0.2.0 | 2019-05-16 |
|
|
86
|
+
| 0.1.0 | 2019-05-16 |
|
|
92
87
|
|
|
93
88
|
See <https://api.gandi.net/docs/reference#API-Changelog> to find out what
|
|
94
89
|
Gandi changed on each date.
|
data/gandi_v5.gemspec
CHANGED
|
@@ -22,8 +22,9 @@ Gem::Specification.new do |gem|
|
|
|
22
22
|
|
|
23
23
|
gem.add_dependency 'dotenv', '~> 2.5'
|
|
24
24
|
gem.add_dependency 'rest-client', '>= 2', '< 3'
|
|
25
|
+
gem.add_dependency 'zeitwerk', '~> 2.1'
|
|
25
26
|
|
|
26
|
-
gem.add_development_dependency 'coveralls', '~> 0.
|
|
27
|
+
gem.add_development_dependency 'coveralls', '~> 0.8'
|
|
27
28
|
gem.add_development_dependency 'guard', '~> 2.15'
|
|
28
29
|
gem.add_development_dependency 'guard-bundler', '~> 2.2'
|
|
29
30
|
gem.add_development_dependency 'guard-rspec', '~> 4.2', '>= 4.2.5'
|
|
@@ -37,5 +38,5 @@ Gem::Specification.new do |gem|
|
|
|
37
38
|
gem.add_development_dependency 'simplecov', '~> 0.7'
|
|
38
39
|
gem.add_development_dependency 'timecop', '~> 0.5'
|
|
39
40
|
gem.add_development_dependency 'vcr', '~> 4.0'
|
|
40
|
-
gem.add_development_dependency 'webmock', '~> 3.
|
|
41
|
+
gem.add_development_dependency 'webmock', '~> 3.6'
|
|
41
42
|
end
|
data/lib/gandi_v5.rb
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'gandi_v5/version'
|
|
4
|
-
require_relative 'gandi_v5/data'
|
|
5
|
-
require_relative 'gandi_v5/error'
|
|
6
|
-
|
|
7
|
-
require_relative 'gandi_v5/billing'
|
|
8
|
-
require_relative 'gandi_v5/domain'
|
|
9
|
-
require_relative 'gandi_v5/email'
|
|
10
|
-
require_relative 'gandi_v5/live_dns'
|
|
11
|
-
require_relative 'gandi_v5/organization'
|
|
12
|
-
|
|
13
3
|
require 'rest_client'
|
|
14
4
|
require 'securerandom'
|
|
5
|
+
require 'zeitwerk'
|
|
6
|
+
|
|
7
|
+
# Custom inflector for Zeitwerk.
|
|
8
|
+
class MyInflector < Zeitwerk::Inflector
|
|
9
|
+
# Convert file's base name to class name when
|
|
10
|
+
# Zeitwerk's included inflector gets it wrong.
|
|
11
|
+
# @param basename [String] the file's base name (no path or extension)
|
|
12
|
+
# @param abspath [String] the file's absolute path
|
|
13
|
+
# @return [String] the class name
|
|
14
|
+
def camelize(basename, _abspath)
|
|
15
|
+
case basename
|
|
16
|
+
when 'live_dns'
|
|
17
|
+
'LiveDNS'
|
|
18
|
+
when 'tld'
|
|
19
|
+
'TLD'
|
|
20
|
+
when 'version'
|
|
21
|
+
'VERSION'
|
|
22
|
+
else
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
loader = Zeitwerk::Loader.for_gem
|
|
29
|
+
loader.inflector = MyInflector.new
|
|
30
|
+
loader.setup
|
|
15
31
|
|
|
16
32
|
# Namespace for classes which access the Gandi V5 API.
|
|
17
33
|
# Also provides useful methods and constants for them.
|
|
@@ -66,6 +82,36 @@ class GandiV5
|
|
|
66
82
|
handle_bad_request(e)
|
|
67
83
|
end
|
|
68
84
|
|
|
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
|
|
94
|
+
def paginated_get(url, page = (1..), per_page = 100, **headers)
|
|
95
|
+
unless page.respond_to?(:each)
|
|
96
|
+
fail ArgumentError, 'page must be positive' unless page.positive?
|
|
97
|
+
|
|
98
|
+
page = [page]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
headers[:params] ||= {}
|
|
102
|
+
headers[:params].transform_keys!(&:to_s)
|
|
103
|
+
headers[:params]['per_page'] = per_page
|
|
104
|
+
|
|
105
|
+
page.each do |page_number|
|
|
106
|
+
headers[:params]['page'] = page_number
|
|
107
|
+
_resp, this_data = get(url, **headers)
|
|
108
|
+
break if this_data.empty?
|
|
109
|
+
|
|
110
|
+
yield this_data
|
|
111
|
+
break if this_data.count < per_page
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
69
115
|
# Might raise:
|
|
70
116
|
# * RestClient::NotFound
|
|
71
117
|
# * RestClient::Unauthorized
|
|
@@ -79,7 +125,10 @@ class GandiV5
|
|
|
79
125
|
def delete(url, **headers)
|
|
80
126
|
prepare_headers headers, url
|
|
81
127
|
response = RestClient.delete url, **headers
|
|
82
|
-
[
|
|
128
|
+
[
|
|
129
|
+
response,
|
|
130
|
+
response.headers.key?(:content_type) ? parse_response(response) : nil
|
|
131
|
+
]
|
|
83
132
|
rescue RestClient::BadRequest => e
|
|
84
133
|
handle_bad_request(e)
|
|
85
134
|
end
|
|
@@ -150,16 +199,6 @@ class GandiV5
|
|
|
150
199
|
@api_key ||= ENV.fetch('GANDI_API_KEY')
|
|
151
200
|
end
|
|
152
201
|
|
|
153
|
-
def authorisation_header(url)
|
|
154
|
-
if url.start_with?(BASE)
|
|
155
|
-
{ Authorization: "Apikey #{api_key}" }
|
|
156
|
-
elsif url.start_with?(GandiV5::LiveDNS::BASE)
|
|
157
|
-
{ 'X-Api-Key': api_key }
|
|
158
|
-
else
|
|
159
|
-
fail ArgumentError, "Don't know how to authorise for url: #{url}"
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
202
|
def parse_response(response)
|
|
164
203
|
type = response.headers.fetch(:content_type).split(';').first.chomp
|
|
165
204
|
case type
|
|
@@ -177,10 +216,11 @@ class GandiV5
|
|
|
177
216
|
end
|
|
178
217
|
end
|
|
179
218
|
|
|
180
|
-
def prepare_headers(headers,
|
|
181
|
-
headers.transform_keys!
|
|
219
|
+
def prepare_headers(headers, _url)
|
|
220
|
+
headers.transform_keys! { |key| key.to_s.downcase.to_sym }
|
|
182
221
|
headers[:accept] ||= 'application/json'
|
|
183
|
-
headers
|
|
222
|
+
headers[:authorization] = "Apikey #{api_key}"
|
|
223
|
+
headers
|
|
184
224
|
end
|
|
185
225
|
|
|
186
226
|
def handle_bad_request(exception)
|
data/lib/gandi_v5/billing.rb
CHANGED
data/lib/gandi_v5/data.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'data/converter'
|
|
4
|
-
|
|
5
3
|
class GandiV5
|
|
6
4
|
# Addin providing a DSL to manage declaring attributes and how to map
|
|
7
5
|
# and convert to/from Gandi's fields.
|
|
@@ -181,9 +179,8 @@ class GandiV5
|
|
|
181
179
|
define_method "#{name}=" do |value|
|
|
182
180
|
instance_variable_set("@#{name}", value)
|
|
183
181
|
end
|
|
184
|
-
|
|
182
|
+
|
|
185
183
|
private "#{name}="
|
|
186
|
-
# rubocop:enable Style/AccessModifierDeclarations
|
|
187
184
|
end
|
|
188
185
|
|
|
189
186
|
# @api private
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class GandiV5
|
|
4
|
+
module Data
|
|
5
|
+
class Converter
|
|
6
|
+
# Methods for converting strings to/from integerss.
|
|
7
|
+
class Integer
|
|
8
|
+
# @param value [Integer]
|
|
9
|
+
# @return [String]
|
|
10
|
+
def self.to_gandi(value)
|
|
11
|
+
return nil if value.nil?
|
|
12
|
+
|
|
13
|
+
value.to_s
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @param [String]
|
|
17
|
+
# @return value [Integer]
|
|
18
|
+
def self.from_gandi(value)
|
|
19
|
+
return nil if value.nil?
|
|
20
|
+
|
|
21
|
+
value.to_i
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|