Sha256: 1ce8266711b6ebd5b04eff377b63870ddc3c8be2ede4550840877589ecf77ead

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module FreeboxApi

  module Resources

    class Interface

      attr_reader :name, :host_count

      def initialize(name, host_count, freebox)
        @name = name
	@host_count = host_count
	@freebox = freebox
      end

      def lan_hosts
        JSON.parse(
          RestClient.get(
            "#{@freebox.base_url}/api/v1/lan/browser/#{@name}",
            :'X_Fbx_App_Auth' => @freebox.session_token
          )
	)['result'].collect { |lan_host|
          FreeboxApi::Resources::LanHost.new(
            lan_host['id'],
            lan_host['primary_name'],
            lan_host['host_type'],
            lan_host['primary_name_manual'],
            lan_host['l2ident'],
            lan_host['vendor_name '],
            lan_host['persistent'],
            lan_host['reachable'],
            lan_host['last_time_reachable'],
            lan_host['active'],
            lan_host['last_activity'],
            lan_host['names'],
            lan_host['l3connectivities'],
            self,
            @freebox)
	}
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
freebox_api-0.0.1 lib/freebox_api/resources/interface.rb