Class: Hyperb::Client

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/hyperb/client.rb

Overview

client class

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Compose

#compose_create, #compose_down, #compose_rm, #compose_up

Methods included from Utils

#check_arguments, #downcase_symbolize

Methods included from Services

#create_service, #remove_service

Methods included from Snapshots

#create_snapshot

Methods included from Network

#fip_allocate, #fip_attach, #fip_detach, #fip_release, #fips_ls

Methods included from HyperVersion

#version

Methods included from Volumes

#inspect_volume, #remove_volume, #volumes

Methods included from Containers

#container_logs, #container_stats, #containers, #create_container, #inspect_container, #kill_container, #remove_container, #rename_container, #start_container, #stop_container

Methods included from Images

#create_image, #images, #inspect_image, #remove_image

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:


10
11
12
13
14
15
# File 'lib/hyperb/client.rb', line 10

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key


8
9
10
# File 'lib/hyperb/client.rb', line 8

def access_key
  @access_key
end

#secret_keyObject

Returns the value of attribute secret_key


8
9
10
# File 'lib/hyperb/client.rb', line 8

def secret_key
  @secret_key
end

Instance Method Details

#blank?(val) ⇒ Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/hyperb/client.rb', line 28

def blank?(val)
  val.respond_to?(:empty?) ? val.empty? : !val
end

#credentialsObject


17
18
19
20
21
22
# File 'lib/hyperb/client.rb', line 17

def credentials
  {
    secret_key: secret_key,
    access_key: access_key
  }
end

#credentials?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/hyperb/client.rb', line 24

def credentials?
  credentials.values.none? { |cred| blank?(cred) }
end