class Logux::Add
Attributes
client[R]
password[R]
version[R]
Public Class Methods
new(client: Logux::Client.new, version: Logux::PROTOCOL_VERSION, password: Logux.configuration.password)
click to toggle source
# File lib/logux/add.rb, line 7 def initialize(client: Logux::Client.new, version: Logux::PROTOCOL_VERSION, password: Logux.configuration.password) @client = client @version = version @password = password end
Public Instance Methods
call(commands)
click to toggle source
# File lib/logux/add.rb, line 15 def call(commands) return if commands.empty? prepared_data = prepare_data(commands) Logux.logger.debug("Logux add: #{prepared_data}") client.post(prepared_data) end
Private Instance Methods
prepare_data(commands)
click to toggle source
# File lib/logux/add.rb, line 25 def prepare_data(commands) { version: PROTOCOL_VERSION, password: password, commands: commands.map do |command| action = command.first meta = command[1] ['action', action, meta || Meta.new] end } end