class Fluffy::Session
Attributes
@return [Fluffy::Session::Addressbook] The session addressbook
@return [Fluffy::Session::Chains] The session chains
@return [Fluffy::Session::Checks] The session rollback checks
@return [String] The session endpoint
@return [Fluffy::Session::Interfaces] The session interfaces
@return [Fluffy::Session::Rules] The session rules
@return [Fluffy::Session::Services] The session services
Public Class Methods
Create a new session
@param name [String] Session
name @param owner [String] Session
owner @param ttl [Integer] Session
time-to-live
# File lib/fluffy/session.rb, line 33 def initialize(name:, owner:, ttl:) @endpoint = ["sessions", name] # create session @@api.post(endpoint: @endpoint, params: {'owner' => owner, 'ttl' => ttl}) @addressbook = Addressbook.new(endpoint: @endpoint) @services = Services.new(endpoint: @endpoint) @rules = Rules.new(endpoint: @endpoint) @interfaces = Interfaces.new(endpoint: @endpoint) @chains = Chains.new(endpoint: @endpoint) @checks = Checks.new(endpoint: @endpoint) end
Public Instance Methods
Commit the session configuration
@param rollback [Boolean] Enable rollback `defaults to false` @param rollback_interval [Integer] Rollback configuration at the given interval (seconds) `defaults to 60`
# File lib/fluffy/session.rb, line 58 def commit!(rollback: true, rollback_interval: 60) @@api.post(endpoint: self.endpoint + ['commit'], params: {'rollback' => rollback, 'rollback_interval' => rollback_interval}) end
Confirm the session configuration
# File lib/fluffy/session.rb, line 64 def confirm! @@api.post(endpoint: self.endpoint + ['confirm']) end
Destroy the session
# File lib/fluffy/session.rb, line 70 def destroy! @@api.delete(endpoint: self.endpoint) end
Test the session configuration
# File lib/fluffy/session.rb, line 49 def test! @@api.post(endpoint: self.endpoint + ['test']) end