class Diplomat::Session
Public Class Methods
create(*args)
click to toggle source
@note This is sugar, see (create
)
# File lib/diplomat/session.rb, line 29 def self.create *args Diplomat::Session.new.create *args end
destroy(*args)
click to toggle source
@note This is sugar, see (destroy
)
# File lib/diplomat/session.rb, line 34 def self.destroy *args Diplomat::Session.new.destroy *args end
Public Instance Methods
create(value)
click to toggle source
Create a new session @param value [String] json representation of the local node @return [String] The sesssion id
# File lib/diplomat/session.rb, line 9 def create value raw = @conn.put do |req| req.url "/v1/session/create" req.body = value end body = JSON.parse(raw.body) return body["ID"] end
destroy(id)
click to toggle source
Destroy a session @param id [String] session id @return [nil]
# File lib/diplomat/session.rb, line 21 def destroy id raw = @conn.put do |req| req.url "/v1/session/destroy/#{id}" end return raw.body end