Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
export COMPOSE_IGNORE_ORPHANS ?= true
export RUBY_VERSION ?= 2.3.1
RUBY_VERSION_MAJOR = $(word 1,$(subst ., ,$(RUBY_VERSION)))
RUBY_VERSION_MINOR = $(word 2,$(subst ., ,$(RUBY_VERSION)))
export BUNDLER_VERSION ?=
ifeq ($(BUNDLER_VERSION),)
ifeq ($(RUBY_VERSION_MAJOR),2)
# Use old bundler for Ruby 2.3-2.6; Ruby 2.7 needs bundler 2.x to avoid resolver bugs
ifeq ($(RUBY_VERSION_MINOR),7)
export BUNDLER_VERSION = 2.4.22
else
export BUNDLER_VERSION = 1.17.3
endif
endif
endif
PROJECT_NAME = $(shell ls *.gemspec | sed 's/\.gemspec//')
export COMPOSE_PROJECT_NAME ?= $(PROJECT_NAME)-$(subst .,_,$(RUBY_VERSION))

Expand Down
17 changes: 17 additions & 0 deletions lib/aptible/api/external_aws_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def organization
auth = Aptible::Auth::Organization.new(token: token, headers: headers)
@organization = auth.find_by_url(organization_url)
end

def check!
response = HyperResource::Link.new(
self,
'href' => "#{href}/check"
).get
ExternalAwsAccountCheckResponse.new(
state: response.attributes['state'],
checks: (response.attributes['checks'] || []).map do |c|
ExternalAwsAccountCheck.new(
check_name: c['check_name'],
state: c['state'],
details: c['details']
)
end
)
end
end
end
end
22 changes: 22 additions & 0 deletions lib/aptible/api/external_aws_account_check_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Aptible
module Api
class ExternalAwsAccountCheckResponse
attr_reader :state, :checks

def initialize(state:, checks:)
@state = state
@checks = checks
end
end

class ExternalAwsAccountCheck
attr_reader :check_name, :state, :details

def initialize(check_name:, state:, details:)
@check_name = check_name
@state = state
@details = details
end
end
end
end
1 change: 1 addition & 0 deletions lib/aptible/api/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def root_url
require 'aptible/api/disk_attachment'
require 'aptible/api/maintenance'
require 'aptible/api/vpn_tunnel'
require 'aptible/api/external_aws_account_check_response'
require 'aptible/api/external_aws_account'
require 'aptible/api/external_aws_resource'
require 'aptible/api/external_aws_database_credential'
Expand Down
2 changes: 1 addition & 1 deletion lib/aptible/api/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Aptible
module Api
VERSION = '1.11.2'.freeze
VERSION = '1.12.0'.freeze
end
end
9 changes: 7 additions & 2 deletions spec/aptible/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
it 'should have a configurable root_url' do
config = described_class.configuration
expect(config).to be_a GemConfig::Configuration
expect(config.root_url).to eq 'https://api.aptible.com'
with_env 'APTIBLE_API_ROOT_URL', nil do
load 'aptible/api.rb'
config.reset
expect(config.root_url).to eq 'https://api.aptible.com'
end
end

pending 'uses ENV["APTIBLE_API_ROOT_URL"] if defined' do
it 'uses ENV["APTIBLE_API_ROOT_URL"] if defined' do
config = described_class.configuration
with_env 'APTIBLE_API_ROOT_URL', 'http://foobar.com' do
load 'aptible/api.rb'
config.reset
expect(config.root_url).to eq 'http://foobar.com'
end
Expand Down