gandi_v5 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/LICENSE.md +2 -6
- data/README.md +8 -6
- data/lib/gandi_v5/domain/sharing_space.rb +10 -2
- data/lib/gandi_v5/email/slot.rb +11 -3
- data/lib/gandi_v5/version.rb +1 -1
- data/spec/fixtures/bodies/GandiV5_Domain/fetch.yml +8 -0
- data/spec/units/gandi_v5/domain_spec.rb +7 -2
- data/spec/units/gandi_v5/email/slot_spec.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023623b5d81a2f3acc4a5fee812f0e8ca24dd8735f59a0f12b53ad35ddb7a397
|
4
|
+
data.tar.gz: 3cf89099c45295da9b06a53ad64b601b3a77525a13ddade403d600c382be02d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e816b9de44330c832f6591ca6724b44f5b05c6fab53d8fda6d13a9820211292f29ee608953d8a562da97f4bcfee38f24f799b4a68184bba2b0ec751d21b3f61
|
7
|
+
data.tar.gz: 622bded49d8bae3129ad74fae6fcaf1e8d7c3639b40348b7537e0ba46a3d5c668d2a134754dcf1ff31bcffe3cf0797f5c4368cbc849c386b4648f850d9e24117
|
data/.travis.yml
CHANGED
@@ -26,7 +26,7 @@ before_install: gem update bundler
|
|
26
26
|
before_script:
|
27
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
|
28
28
|
script:
|
29
|
-
- bundle exec rubocop
|
29
|
+
- if [[ $(echo $TRAVIS_JOB_NUMBER | awk -F . '{ print $2 }') == '1' ]]; then bundle exec rubocop; fi
|
30
30
|
- bundle exec rspec
|
31
31
|
after_script:
|
32
32
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Gandi V5 API Gem Changelog
|
2
2
|
|
3
|
+
## Version 0.6.0
|
4
|
+
|
5
|
+
* GandiV5::Email::Slot.create now supports sharing_id
|
6
|
+
* GandiV5::Email::Slot.create's type argument is now named not positional
|
7
|
+
* Add reseller information to GandiV5::Domain
|
8
|
+
|
3
9
|
## Version 0.5.0
|
4
10
|
|
5
11
|
* Add support for truffleruby 20.1.0
|
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
@@ -75,12 +75,14 @@ TODO: More examples!
|
|
75
75
|
|
76
76
|
We follow the [Semantic Versioning](http://semver.org/) concept.
|
77
77
|
|
78
|
-
| Gem Version | Gandi API Release Date
|
79
|
-
| --------------- |
|
80
|
-
| 0.
|
81
|
-
| 0.
|
82
|
-
| 0.
|
83
|
-
| 0.
|
78
|
+
| Gem Version | Gandi API Release Date |
|
79
|
+
| --------------- | ------------------------ |
|
80
|
+
| 0.6.0 | 2020-05-07 (not LiveDNS) |
|
81
|
+
| 0.5.0 | 2019-10-01 |
|
82
|
+
| 0.4.0 | 2019-10-01 |
|
83
|
+
| 0.3.0 | 2019-08-22 |
|
84
|
+
| 0.2.0 | 2019-05-16 |
|
85
|
+
| 0.1.0 | 2019-05-16 |
|
84
86
|
|
85
87
|
See <https://api.gandi.net/docs/reference#API-Changelog> to find out what
|
86
88
|
Gandi changed on each date.
|
@@ -7,14 +7,22 @@ class GandiV5
|
|
7
7
|
# @return [String]
|
8
8
|
# @!attribute [r] name
|
9
9
|
# @return [String]
|
10
|
+
# @!attribute [r] type
|
11
|
+
# @return [String]
|
10
12
|
# @!attribute [r] reseller
|
11
13
|
# @return [nil, Boolean]
|
14
|
+
# @!attribute [r] reseller_details
|
15
|
+
# @return [nil, GandiV5::Domain::SharingSpace]
|
12
16
|
class SharingSpace
|
13
17
|
include GandiV5::Data
|
14
18
|
|
15
|
-
members :name, :reseller
|
19
|
+
members :name, :type, :reseller
|
16
20
|
member :uuid, gandi_key: 'id'
|
17
|
-
|
21
|
+
member(
|
22
|
+
:reseller_details,
|
23
|
+
gandi_key: 'sharing_space',
|
24
|
+
converter: GandiV5::Domain::SharingSpace
|
25
|
+
)
|
18
26
|
alias sharing_space_uuid uuid
|
19
27
|
end
|
20
28
|
end
|
data/lib/gandi_v5/email/slot.rb
CHANGED
@@ -78,15 +78,23 @@ class GandiV5
|
|
78
78
|
# but require more mailboxes on that domain, you must first purchase additional slots.
|
79
79
|
# @see https://api.gandi.net/docs/email#post-v5-email-slots-domain
|
80
80
|
# @param fqdn [String, #to_s] the fully qualified domain name to add the slot to.
|
81
|
-
# @param type [:standard, :premium]
|
81
|
+
# @param type [:standard, :premium] The type of slot to add.
|
82
|
+
# @param sharing_id [nil, String, #to_s] either:
|
83
|
+
# * nil (default) - nothing special happens
|
84
|
+
# * an organization ID - pay using another organization
|
85
|
+
# (you need to have billing permissions on the organization
|
86
|
+
# and use the same organization name for the domain name's owner).
|
87
|
+
# The invoice will be edited using this organization's information.
|
82
88
|
# @return [String] The confirmation message from Gandi.
|
83
89
|
# @raise [GandiV5::Error::GandiError] if Gandi returns an error.
|
84
|
-
def self.create(fqdn, type
|
90
|
+
def self.create(fqdn, type: :standard, sharing_id: nil)
|
85
91
|
body = {
|
86
92
|
mailbox_type: type
|
87
93
|
}.to_json
|
88
94
|
|
89
|
-
|
95
|
+
url_ = url(fqdn)
|
96
|
+
url_ += "?sharing_id=#{sharing_id}" if sharing_id
|
97
|
+
response, _data = GandiV5.post url_, body
|
90
98
|
fetch fqdn, response.headers[:location].split('/').last
|
91
99
|
end
|
92
100
|
|
data/lib/gandi_v5/version.rb
CHANGED
@@ -108,7 +108,12 @@ describe GandiV5::Domain do
|
|
108
108
|
its('domain_owner') { should be_nil }
|
109
109
|
its('name_servers') { should match_array %w[192.168.0.1 192.168.0.2] }
|
110
110
|
its('services') { should match_array %i[gandilivedns dnssec] }
|
111
|
-
its('sharing_space') { should
|
111
|
+
its('sharing_space.uuid') { should eq 'SHARING-UUID' }
|
112
|
+
its('sharing_space.name') { should eq 'User' }
|
113
|
+
its('sharing_space.type') { should eq 'user' }
|
114
|
+
its('sharing_space.reseller') { should be true }
|
115
|
+
its('sharing_space.reseller_details.uuid') { should eq 'RESELLER-UUID' }
|
116
|
+
its('sharing_space.reseller_details.name') { should eq 'Reseller' }
|
112
117
|
its('dates.created_at') { should eq Time.new(2011, 2, 21, 10, 39, 0) }
|
113
118
|
its('dates.registry_created_at') { should eq Time.new(2003, 3, 12, 12, 2, 11) }
|
114
119
|
its('dates.registry_ends_at') { should eq Time.new(2020, 3, 12, 12, 2, 11) }
|
@@ -268,7 +273,7 @@ describe GandiV5::Domain do
|
|
268
273
|
its('domain_owner') { should be_nil }
|
269
274
|
its('name_servers') { should match_array %w[192.168.0.1 192.168.0.2] }
|
270
275
|
its('services') { should match_array %i[gandilivedns dnssec] }
|
271
|
-
its('sharing_space') {
|
276
|
+
its('sharing_space') { should_not be_nil }
|
272
277
|
its('dates.created_at') { should eq Time.new(2011, 2, 21, 10, 39, 0) }
|
273
278
|
its('dates.registry_created_at') { should eq Time.new(2003, 3, 12, 12, 2, 11) }
|
274
279
|
its('dates.registry_ends_at') { should eq Time.new(2020, 3, 12, 12, 2, 11) }
|
@@ -130,7 +130,7 @@ describe GandiV5::Email::Slot do
|
|
130
130
|
end
|
131
131
|
let(:created_slot) { double GandiV5::Email::Slot }
|
132
132
|
|
133
|
-
it 'With default type' do
|
133
|
+
it 'With default type and no sharingID' do
|
134
134
|
expect(GandiV5).to receive(:post).with(url, '{"mailbox_type":"standard"}')
|
135
135
|
.and_return([created_response, { 'message' => 'Confirmation message.' }])
|
136
136
|
expect(described_class).to receive(:fetch).with('example.com', 'created-slot-uuid').and_return(created_slot)
|
@@ -143,7 +143,15 @@ describe GandiV5::Email::Slot do
|
|
143
143
|
.and_return([created_response, { 'message' => 'Confirmation message.' }])
|
144
144
|
expect(described_class).to receive(:fetch).with('example.com', 'created-slot-uuid').and_return(created_slot)
|
145
145
|
|
146
|
-
expect(described_class.create('example.com', :premium)).to be created_slot
|
146
|
+
expect(described_class.create('example.com', type: :premium)).to be created_slot
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'With sharingID' do
|
150
|
+
expect(GandiV5).to receive(:post).with("#{url}?sharing_id=SHARING-ID", '{"mailbox_type":"standard"}')
|
151
|
+
.and_return([created_response, { 'message' => 'Confirmation message.' }])
|
152
|
+
expect(described_class).to receive(:fetch).with('example.com', 'created-slot-uuid').and_return(created_slot)
|
153
|
+
|
154
|
+
expect(described_class.create('example.com', sharing_id: 'SHARING-ID')).to be created_slot
|
147
155
|
end
|
148
156
|
end
|
149
157
|
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gauld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|