Skip to content

Commit 4189e50

Browse files
committed
Better clean V1 API
1 parent dd3d08e commit 4189e50

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

lib/do_snapshot/cli.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def initialize(*args)
2727
set_mailer
2828

2929
# Check for keys via options
30-
%w( digital_ocean_client_id digital_ocean_api_key digital_ocean_access_token ).each do |key|
30+
%w( digital_ocean_access_token ).each do |key|
3131
ENV[key.upcase] = options[key] if options.include? key
3232
end
3333
end
@@ -40,9 +40,9 @@ def initialize(*args)
4040
4141
### Examples
4242
43-
Select api version (1, 2):
43+
Select api version (2):
4444
45-
$ do_snapshot -p 1
45+
$ do_snapshot -p 2
4646
4747
Set DigitalOcean keys:
4848
@@ -151,14 +151,6 @@ def initialize(*args)
151151
type: :string,
152152
banner: 'YOURLONGAPITOKEN',
153153
desc: 'DIGITAL_OCEAN_ACCESS_TOKEN. if you can\'t use environment.'
154-
method_option :digital_ocean_client_id,
155-
type: :string,
156-
banner: 'YOURLONGAPICLIENTID',
157-
desc: 'DIGITAL_OCEAN_CLIENT_ID. if you can\'t use environment.'
158-
method_option :digital_ocean_api_key,
159-
type: :string,
160-
banner: 'YOURLONGAPIKEY',
161-
desc: 'DIGITAL_OCEAN_API_KEY. if you can\'t use environment.'
162154

163155
def snap
164156
command.snap
@@ -197,7 +189,7 @@ def update_command
197189
end
198190

199191
def command_filter
200-
%w( log smtp mail trace digital_ocean_client_id digital_ocean_api_key digital_ocean_access_token )
192+
%w( log smtp mail trace digital_ocean_access_token )
201193
end
202194

203195
def setup_config # rubocop:disable Metrics/AbcSize

spec/do_snapshot/cli_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
expect(cli_obj.args)
1616
.to include('help')
1717
expect(cli_obj.options)
18-
.to include('digital_ocean_client_id')
18+
.to include('digital_ocean_access_token')
1919
end
2020
end
2121
end

spec/shared/environment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def do_not_send_email
1616
let(:image_id) { '5019770' }
1717
let(:image_id2) { '5019903' }
1818
let(:cli_env_nil) { Hash['DIGITAL_OCEAN_CLIENT_ID' => nil, 'DIGITAL_OCEAN_API_KEY' => nil, 'DIGITAL_OCEAN_ACCESS_TOKEN' => nil] }
19-
let(:cli_keys) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_client_id: client_key, digital_ocean_api_key: api_key, digital_ocean_access_token: access_token) }
20-
let(:cli_keys_other) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_client_id: 'NOTFOO', digital_ocean_api_key: 'NOTBAR', digital_ocean_access_token: 'NOTTOK') }
19+
let(:cli_keys) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_access_token: access_token) }
20+
let(:cli_keys_other) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_access_token: 'NOTTOK') }
2121
let(:snapshot_name) { "example.com_#{DateTime.now.strftime('%Y_%m_%d')}" }
2222
let(:default_options) { Hash[protocol: 2, only: %w( 100823 ), exclude: %w(), keep: 3, stop: false, trace: true, clean: true, delay: 0, timeout: 600] }
2323
let(:default_options_cli) { default_options.reject { |key, _| %w( droplets threads ).include?(key.to_s) } }

0 commit comments

Comments
 (0)