lib/freebox_api/resources/interface.rb in freebox_api-0.0.1 vs lib/freebox_api/resources/interface.rb in freebox_api-0.0.2

- old
+ new

@@ -2,41 +2,15 @@ module Resources class Interface - attr_reader :name, :host_count - - def initialize(name, host_count, freebox) - @name = name - @host_count = host_count - @freebox = freebox + def initialize(session) + @session = session 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) - } + def index + @session.http_call('get', '/lan/browser/interfaces') end end end