Class: FentonShell::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fenton_shell/config_file.rb

Overview

Provides a local configuration file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messageString

Returns success or failure message and why.

Returns:

  • (String)

    success or failure message and why



6
7
8
# File 'lib/fenton_shell/config_file.rb', line 6

def message
  @message
end

Class Method Details

.default_organization(global_options) ⇒ String

Responds with the default organization

Parameters:

  • global_options (Hash)

    global command line options

Returns:

  • (String)

    default organization key for client



31
32
33
# File 'lib/fenton_shell/config_file.rb', line 31

def default_organization(global_options)
  config_file(global_options)[:default_organization]
end

.public_key(global_options) ⇒ String

Responds with the default public key

Parameters:

  • global_options (Hash)

    global command line options

Returns:

  • (String)

    default public key for client



47
48
49
# File 'lib/fenton_shell/config_file.rb', line 47

def public_key(global_options)
  config_file(global_options)[:public_key]
end

.username(global_options) ⇒ String

Responds with the default username

Parameters:

  • global_options (Hash)

    global command line options

Returns:

  • (String)

    default username for client



39
40
41
# File 'lib/fenton_shell/config_file.rb', line 39

def username(global_options)
  config_file(global_options)[:username]
end

Instance Method Details

#create(global_options, options) ⇒ String

Creates a configuration file on the local file system

Parameters:

  • global_options (Hash)

    global command line options

  • options (Hash)

    fields to send to create the configuration file

Returns:

  • (String)

    success or failure message



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fenton_shell/config_file.rb', line 14

def create(global_options, options)
  status, body = config_file_create(global_options, options)

  if status
    save_message('ConfigFile': ['created!'])
    true
  else
    save_message(body)
    false
  end
end