Class: BigPanda::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bigpanda/bp-api.rb

Overview

Main BigPanda API Class

The client needs to be initialized with the access_token of the organization. Possible options:

  1. Pass the access_token as a :access_token parameter

  2. Place a bigpanda.yaml file in /etc/ and add to the file - ‘access_token’: YOUR_TOKEN

  3. Pass a location of a yaml file using the :file parameter

Defined Under Namespace

Classes: Error, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bigpanda/bp-api.rb', line 30

def initialize(options = {})

  unless options.fetch(:access_token, nil)
    file = options.delete(:file)
    file_config, config_files = read_config_from_file(file)
    options.merge!(file_config) if file_config
  end

  @config = DEFAULT_CONFIGURATION.merge(options)
  @ssl = options.delete(:ssl) || {}

  unless @config.fetch(:access_token, nil)
    raise "No BigPanda config token received, and no configuration file found. Searched: #{config_files.join ','}."
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



28
29
30
# File 'lib/bigpanda/bp-api.rb', line 28

def config
  @config
end

#sslObject (readonly)

Returns the value of attribute ssl.



28
29
30
# File 'lib/bigpanda/bp-api.rb', line 28

def ssl
  @ssl
end

Instance Method Details

#deployment_end(options = {}) ⇒ Object



50
51
52
# File 'lib/bigpanda/bp-api.rb', line 50

def deployment_end(options = {})
  return deployment_notification config[:deployment_end_path], options
end

#deployment_start(options = {}) ⇒ Object



46
47
48
# File 'lib/bigpanda/bp-api.rb', line 46

def deployment_start(options = {})
  return deployment_notification config[:deployment_start_path], options
end