class Fluffy::Session

Attributes

addressbook[R]

@return [Fluffy::Session::Addressbook] The session addressbook

chains[R]

@return [Fluffy::Session::Chains] The session chains

checks[R]

@return [Fluffy::Session::Checks] The session rollback checks

endpoint[R]

@return [String] The session endpoint

interfaces[R]

@return [Fluffy::Session::Interfaces] The session interfaces

rules[R]

@return [Fluffy::Session::Rules] The session rules

services[R]

@return [Fluffy::Session::Services] The session services

Public Class Methods

new(name:, owner:, ttl:) click to toggle source

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!(rollback: true, rollback_interval: 60) click to toggle source

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!() click to toggle source

Confirm the session configuration

# File lib/fluffy/session.rb, line 64
def confirm!
  @@api.post(endpoint: self.endpoint + ['confirm'])
end
destroy!() click to toggle source

Destroy the session

# File lib/fluffy/session.rb, line 70
def destroy!
  @@api.delete(endpoint: self.endpoint)
end
test!() click to toggle source

Test the session configuration

# File lib/fluffy/session.rb, line 49
def test!
  @@api.post(endpoint: self.endpoint + ['test'])
end