Class: SilverSpurs::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/silver_spurs/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(host_url, options = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
# File 'lib/silver_spurs/client.rb', line 10

def initialize(host_url, options={})
  @host_url = host_url
  @timeout = options[:timeout] || 2 * 60
end

Instance Method Details

#start_bootstrap(ip, node_name, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/silver_spurs/client.rb', line 15

def start_bootstrap(ip, node_name, options = {})
  params = extract_extra_params(options).merge({:node_name => node_name})
  payload = parameterize_hash params
  headers = {:accept => :json, :content_type=> 'application/x-www-form-urlencoded'}

  response = spur_host["bootstrap/#{ip}"].put(payload, headers, &method(:dont_redirect_for_303))
  
  throw ClientException.new("unexpected response", response) unless response.code == 303

  BootstrapRun.new(response.headers[:location], :timeout => @timeout)
end