Class: SetWifiAction

Inherits:
ConnectivityAction show all
Defined in:
lib/ruby-macrodroid.rb

Overview

Category: Connectivity

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ SetWifiAction

Returns a new instance of SetWifiAction.



3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
# File 'lib/ruby-macrodroid.rb', line 3105

def initialize(h={})

  options = {
    ssid: '[Select Wifi]',
    network_id: 0,
    state: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



3117
3118
3119
3120
# File 'lib/ruby-macrodroid.rb', line 3117

def to_s(colour: false)
  action = @h[:state] == 0 ? 'Enable' : 'Disable'
  action + ' Wifi'
end