README.md in freebox_api-0.1.0 vs README.md in freebox_api-0.1.1

- old
+ new

@@ -3,13 +3,16 @@ WARNING: Work In Progress. Overview -------- + This gem contains Freebox OS API bindings for the Ruby language. -I started working on that to use it with https://github.com/mcanevet/puppet-freebox +I started working on that to use it with https://github.com/mcanevet/puppet-freebox. +The official documentation is located here: http://dev.freebox.fr/sdk/os/ + Building the Freebox object --------------------------- ```ruby require 'freebox_api' @@ -50,19 +53,13 @@ auth_request = myFreebox.authorize(token_request) app_token = auth_request['app_token'] ``` -#### Track authorization progress +### Creating the session object ```ruby -puts myFreebox.track_auth(auth_request['track_id']) -``` - -### Obtaining a session\_token - -```ruby myApp = { :app_id => 'fr.freebox.testapp', :app_version => '0.0.7', :app_token => 'dyNYgfK0Ya6FWGqq83sBHa7TwzWo+pg4fDFUJHShcjVYzTfaRrZzm93p7OTAfH/0', } @@ -80,75 +77,114 @@ ``` Reference --------- -### Connection API - ```ruby -connection = FreeboxApi::Services::Connection.new(mySession) +config = FreeboxApi::Config.new(mySession) ``` +### Connection API + #### Connection status ##### Get the current Connection status -[X] GET /api/v1/connection/ +[ ] GET /api/v1/connection/ -```ruby -connection.status -``` - #### Connection configuration ##### Get the current Connection configuration [X] GET /api/v1/connection/config/ ```ruby -connection.config +config.show('connection') ``` ##### Update the Connection configuration [X] PUT /api/v1/connection/config/ ```ruby -connection.config = { +config.update('connection', { :ping => true, :wol => false, -} +}) ``` #### Connection IPv6 configuration ##### Get the current IPv6 Connection configuration -[ ] GET /api/v1/connection/ipv6/config/ +[X] GET /api/v1/connection/ipv6/config/ +```ruby +config.show('ipv6') +``` + ##### Update the IPv6 Connection configuration -[ ] PUT /api/v1/connection/ipv6/config/ +[X] PUT /api/v1/connection/ipv6/config/ +```ruby +config.update('ipv6', { + :delegations => [ + { + :prefix => '2a01:e30:d252:a2a2::/64', + :next_hop => 'fe80::be30:5bff:feb5:fcc7', + } + ] +}) +``` + #### Connection DynDNS status ##### Get the status of a DynDNS service [ ] GET /api/v1/connection/ddns/{provider}/status/ #### Connection DynDNS configuration ##### Get the config of a DynDNS service -[ ] GET /api/v1/connection/ddns/{provider}/ +[X] GET /api/v1/connection/ddns/{provider}/ +```ruby +config.show('ddns/dyndns') +``` + ##### Set the config of a DynDNS service -[ ] PUT /api/v1/connection/ddns/{provider}/ +[X] PUT /api/v1/connection/ddns/{provider}/ +```ruby +config.update('ddns/dyndns', { + :enabled => false, + :user => 'test', + :password => 'ssss', + :hostname => 'ttt', +}) +``` + ### Lan #### Lan Config API ##### Get the current Lan configuration -[ ] GET /api/v1/lan/config/ +[X] GET /api/v1/lan/config/ +```ruby +config.show('lan') +``` + ##### Update the current Lan configuration -[ ] PUT /api/v1/lan/config/ +[X] PUT /api/v1/lan/config/ +```ruby +config.update('lan', { + :mode => 'router', + :ip => '192.168.69.254', + :name => 'Freebox de r0ro', + :name_dns => 'freebox-de-r0ro', + :name_mdns => 'Freebox-de-r0ro', + :name_netbios => 'Freebox_de_r0ro', +}) +``` + ### Lan Browser #### Lan Browser API ##### Getting the list of browsable LAN interfaces @@ -191,41 +227,54 @@ ### Freeplug #### Freeplug API +```ruby +freeplug_networks = FreeboxApi::Resources::FreeplugNetwork.new(session) +freeplugs = FreeboxApi::Resources::Freeplug.new(session) +``` + ##### Get the current Freeplugs networks -[ ] GET /api/v1/freeplug/ +[X] GET /api/v1/freeplug/ +```ruby +freeplug_networks.index +``` + ##### Get a particular Freeplug information -[ ] GET /api/v1/freeplug/{id}/ +[X] GET /api/v1/freeplug/{id}/ +```ruby +freeplugs.show('F4:CA:E5:1D:46:AE') +``` + ##### Reset a Freeplug -[ ] POST /api/v1/freeplug/{id}/reset/ +[X] POST /api/v1/freeplug/{id}/reset/ +```ruby +freeplugs.reset('F4:CA:E5:1D:46:AE') +``` + ### DHCP #### DHCP Configuration API -```ruby -dhcp = FreeboxApi::Services::DHCP.new(mySession) -``` - ##### Get the current DHCP configuration [X] GET /api/v1/dhcp/config/ ```ruby -dhcp.config +config.show('dhcp') ``` ##### Update the current DHCP configuration [X] PUT /api/v1/dhcp/config/ ```ruby -dhcp.config = { +config.update('dhcp', { :enabled => false, -} +}) ``` #### DHCP Static Lease API ##### Get the list of DHCP static leases @@ -276,25 +325,46 @@ ### Ftp #### Ftp config API ##### Get the current Ftp configuration -[ ] GET /api/v1/ftp/config/ +[X] GET /api/v1/ftp/config/ +```ruby +config.show('ftp') +``` + ##### Update the FTP configuration -[ ] PUT /api/v1/ftp/config/ +[X] PUT /api/v1/ftp/config/ +```ruby +config.update('ftp', { + :enabled => true +}) +``` + ### NAT #### Dmz Config API ##### Get the current Dmz configuration -[ ] GET /api/v1/fw/dmz/ +[X] GET /api/v1/fw/dmz/ +```ruby +config.show('dmz') +``` + ##### Update the current Dmz configuration -[ ] PUT /api/v1/fw/dmz/ +[X] PUT /api/v1/fw/dmz/ +```ruby +config.update('dmz', { + :enabled => true, + :ip => '192.168.1.42', +}) +``` + ### Port Forwarding #### Port Forwarding API ##### Getting the list of port forwarding @@ -347,15 +417,25 @@ ### UPnP IGD #### UPnP IGD config API ##### Get the current UPnP IGD configuration -[ ] GET /api/v1/upnpigd/config/ +[X] GET /api/v1/upnpigd/config/ +```ruby +config.show('upnpigd') +``` + ##### Update the UPnP IGD configuration -[ ] PUT /api/v1/upnpigd/config/ +[X] PUT /api/v1/upnpigd/config/ +```ruby +config.update('upnpigd', { + :enabled => true, +}) +``` + #### UPnP IGD Redirection API ##### Get the list of current redirection [X] GET /api/v1/upnpigd/redir/ @@ -374,43 +454,83 @@ ### LCD #### LCD config API ##### Get the current LCD configuration -[ ] GET /api/v1/lcd/config/ +[X] GET /api/v1/lcd/config/ +```ruby +config.show('lcd') +``` + ##### Update the lcd configuration -[ ] PUT /api/v1/lcd/config/ +[X] PUT /api/v1/lcd/config/ +```ruby +config.update('lcd', { + :brightness => 50, +}) +``` + ### Network Share #### Samba config API ##### Get the current Samba configuration -[ ] GET /api/v1/netshare/samba/ +[X] GET /api/v1/netshare/samba/ +```ruby +config.show('samba') +``` + ##### Update the Samba configuration -[ ] PUT /api/v1/netshare/samba/ +[X] PUT /api/v1/netshare/samba/ +```ruby +config.update('samba', { + :print_share_enabled => false, +}) +``` + #### Afp config API ##### Get the current Afp configuration -[ ] GET /api/v1/netshare/afp/ +[X] GET /api/v1/netshare/afp/ +```ruby +config.show('afp') +``` + ##### Update the Afp configuration -[ ] PUT /api/v1/netshare/afp/ +[X] PUT /api/v1/netshare/afp/ +```ruby +config.update('afp', { + :guest_allow => false, +}) +``` + ### UPnP AV #### UPnP AV config API ##### Get the current UPnP AV configuration -[ ] GET /api/v1/upnpav/config/ +[X] GET /api/v1/upnpav/config/ +```ruby +config.show('upnpav') +``` + ##### Update the UPnP AV configuration -[ ] PUT /api/v1/upnpav/config/ +[X] PUT /api/v1/upnpav/config/ +```ruby +config.update('upnpav', { + :enabled => false, +}) +``` + ### Switch #### Switch API ##### Get the current switch status @@ -433,13 +553,25 @@ [ ] GET /api/v1/wifi/ #### Wi-Fi config API ##### Get the current Wi-Fi configuration -[ ] GET /api/v1/wifi/config/ +[X] GET /api/v1/wifi/config/ +```ruby +config.show('wifi') +``` + ##### Update the Wi-Fi configuration -[ ] PUT /api/v1/wifi/config/ +[X] PUT /api/v1/wifi/config/ + +```ruby +config.update('wifi', { + :ap_params => { + :ht_mode => 'disabled', + } +}) +``` ##### Reset the Wi-Fi configuration [ ] POST /api/v1/wifi/config/reset/ #### Wi-Fi Stations API