Module: Rancher::Api

Defined in:
lib/rancher/api.rb,
lib/rancher/api/version.rb,
lib/rancher/api/models/host.rb,
lib/rancher/api/configuration.rb,
lib/rancher/api/models/machine.rb,
lib/rancher/api/models/project.rb,
lib/rancher/api/models/instance.rb,
lib/rancher/api/models/environment.rb,
lib/rancher/api/models/instance/action.rb,
lib/rancher/api/models/machine/driver_config.rb,
lib/rancher/api/middlewares/json_parser_middleware.rb

Defined Under Namespace

Classes: Configuration, Environment, Host, Instance, JsonParserMiddleware, Machine, Project

Constant Summary collapse

VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



14
15
16
# File 'lib/rancher/api.rb', line 14

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rancher/api.rb', line 22

def self.configure
  yield(configuration)

  Her::API.setup url: configuration.url do |c|
    # Request
    c.request :json

    c.use Her::Middleware::AcceptJSON
    c.use Faraday::Request::BasicAuthentication, configuration.access_key, configuration.secret_key

    # Response
    c.use Rancher::Api::JsonParserMiddleware
    c.use Her::Middleware::DefaultParseJSON

    # Adapter
    c.use Faraday::Adapter::NetHttp
  end

  require 'rancher/api/models'
end

.resetObject



18
19
20
# File 'lib/rancher/api.rb', line 18

def self.reset
  @configuration = Configuration.new
end