Class: Runcible::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/runcible/instance.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Instance

Initialize a Runcible instance

Parameters:

  • config (Hash) (defaults to: {})
  • http_auth (Hash)

    a customizable set of options

Options Hash (config):

  • :user (String)

    Pulp username

  • :oauth (String)

    Oauth credentials

  • :headers (Hash)

    Additional headers e.g. content-type => “application/json”

  • :url (String)

    Scheme and hostname for the pulp server e.g. localhost/

  • :api_path (String)

    URL path for the api e.g. pulp/api/v2/

  • :timeout (String)

    Timeout in seconds for the connection (defaults to rest client’s default)

  • :open_timeout (String)

    timeout in seconds for the connection to open(defaults to rest client’s default)

  • :http_auth (Hash)

    Needed when using simple http auth



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/runcible/instance.rb', line 52

def initialize(config={})
  @config = {
          :api_path   => '/pulp/api/v2/',
          :url        => 'https://localhost',
          :user       => '',
          :http_auth  => {:password => {} },
          :headers    => {:content_type => 'application/json',
                          :accept       => 'application/json'},
          :logging    => {}
        }.merge(config).with_indifferent_access


  initialize_wrappers(config)
end

Instance Attribute Details

#extensionsObject

Returns the value of attribute extensions.



38
39
40
# File 'lib/runcible/instance.rb', line 38

def extensions
  @extensions
end

#resourcesObject

Returns the value of attribute resources.



37
38
39
# File 'lib/runcible/instance.rb', line 37

def resources
  @resources
end

Class Method Details

.extension_classesObject



32
33
34
35
# File 'lib/runcible/instance.rb', line 32

def self.extension_classes
  @@extension_classes ||= gather_classes("extensions")
  @@extension_classes
end

.resource_classesObject



27
28
29
30
# File 'lib/runcible/instance.rb', line 27

def self.resource_classes
  @@resource_classes ||= gather_classes("resources")
  @@resource_classes
end

Instance Method Details

#configObject



74
75
76
# File 'lib/runcible/instance.rb', line 74

def config
  @config
end

#update_config(key, value) ⇒ Object

Update an existing config value

Parameters:

  • key (String, Symbol)

    The key of the config to update

  • value (Object)

    The value of the config to update



70
71
72
# File 'lib/runcible/instance.rb', line 70

def update_config(key, value)
  @config[key] = value
end