Module: Brightbox::Config::ToFog

Included in:
BBConfig
Defined in:
lib/brightbox-cli/config/to_fog.rb

Instance Method Summary collapse

Instance Method Details

#to_fogObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/brightbox-cli/config/to_fog.rb', line 4

def to_fog
  unless configured?
    raise Brightbox::BBConfigError, "No api client configured"
  end

  default_fog_options =
    if using_api_client?
      Brightbox::Config::ApiClient.new(selected_config, client_name).to_fog
    else
      Brightbox::Config::UserApplication.new(selected_config, client_name).to_fog
    end
  if access_token
    default_fog_options.update(:brightbox_access_token => access_token)
  end
  if refresh_token
    default_fog_options.update(:brightbox_refresh_token => refresh_token)
  end
  default_fog_options
end