Class: Logux::Add

Inherits:
Object
  • Object
show all
Defined in:
lib/logux/add.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: Logux::Client.new, version: Logux::PROTOCOL_VERSION, password: Logux.configuration.password) ⇒ Add

Returns a new instance of Add.



7
8
9
10
11
12
13
# 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

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/logux/add.rb', line 5

def client
  @client
end

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'lib/logux/add.rb', line 5

def password
  @password
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/logux/add.rb', line 5

def version
  @version
end

Instance Method Details

#call(commands) ⇒ Object



15
16
17
18
19
20
21
# 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