Sha256: dc6e41b20ac3148dbf2cf895b86307dcabbcb258e69f7981bd5cb47a303b1670

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 KB

Contents

module FreeboxApi

  module Configuration

    module Lan

      def self.getConfig(session)
        session.http_call('get', '/lan/config/')
      end

      def self.updateConfig(session, value)
        session.http_call('put', '/lan/config/', value)
      end

      module Browser

        def self.interfaces(session)
          session.http_call('get', '/lan/browser/interfaces/')
        end

        class Interface

          def initialize(session, name)
            @session = session
            @name = name
          end

          def self.getLanHosts(session, name)
            session.http_call('get', "/lan/browser/#{name}/")
          end

          def lan_hosts
            self.class.getLanHosts(@session, @name)
          end

          def self.wol(session, name, params = {})
            session.http_call('post', "/lan/wol/#{name}/", params)
          end

          def wol(params = {})
            self.class.wol(@session, @name, params)
          end

        end

        class LanHost

          def initialize(session, interface, hostid)
            @session = session
            @interface = interface
            @hostid = hostid
          end

          def self.show(session, interface, hostid)
            session.http_call('get', "/lan/browser/#{interface}/#{hostid}/")
          end

          def show
            self.class.show(@session, @interface, @hostid)
          end

          def self.update(session, interface, hostid, value)
            session.http_call('put', "/lan/browser/#{interface}/#{hostid}/", value)
          end

          def update(value)
            self.class.update(@session, @interface, @hostid, value)
          end

          def wol(password = '')
            Interface.wol(@session, interface, {
              :mac      => show['l2ident']['id'],
              :password => password,
	    })
          end

        end

      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
freebox_api-0.2.4 lib/freebox_api/configuration/lan.rb
freebox_api-0.2.3 lib/freebox_api/configuration/lan.rb
freebox_api-0.2.2 lib/freebox_api/configuration/lan.rb
freebox_api-0.2.1 lib/freebox_api/configuration/lan.rb
freebox_api-0.2.0 lib/freebox_api/configuration/lan.rb