freebox_api 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -269
- data/lib/freebox_api/configuration/ftp.rb +19 -0
- data/lib/freebox_api/version.rb +1 -1
- metadata +2 -10
- data/lib/freebox_api/application.rb +0 -15
- data/lib/freebox_api/config.rb +0 -34
- data/lib/freebox_api/resources/freeplug.rb +0 -29
- data/lib/freebox_api/resources/freeplug_network.rb +0 -20
- data/lib/freebox_api/resources/interface.rb +0 -19
- data/lib/freebox_api/resources/lan_host.rb +0 -29
- data/lib/freebox_api/resources/port_forwarding.rb +0 -35
- data/lib/freebox_api/resources/static_lease.rb +0 -35
- data/lib/freebox_api/resources/upnp_redir.rb +0 -23
data/README.md
CHANGED
@@ -402,282 +402,18 @@ static_lease.create({
|
|
402
402
|
FreeboxApi::Configuration::Dhcp.dynamic_leases(mySession)
|
403
403
|
```
|
404
404
|
|
405
|
+
#### FTP
|
405
406
|
|
406
|
-
|
407
|
-
=======
|
408
|
-
|
409
|
-
|
410
|
-
### Ftp
|
411
|
-
|
412
|
-
#### Ftp config API
|
413
|
-
|
414
|
-
##### Get the current Ftp configuration
|
415
|
-
[X] GET /api/v1/ftp/config/
|
407
|
+
##### Get the current FTP configuration
|
416
408
|
|
417
409
|
```ruby
|
418
|
-
|
410
|
+
FreeboxApi::Configuration::Ftp.getConfig(mySession)
|
419
411
|
```
|
420
412
|
|
421
|
-
##### Update the FTP configuration
|
422
|
-
[X] PUT /api/v1/ftp/config/
|
413
|
+
##### Update the current FTP configuration
|
423
414
|
|
424
415
|
```ruby
|
425
|
-
|
426
|
-
:enabled => true
|
427
|
-
})
|
428
|
-
```
|
429
|
-
|
430
|
-
### NAT
|
431
|
-
|
432
|
-
#### Dmz Config API
|
433
|
-
|
434
|
-
##### Get the current Dmz configuration
|
435
|
-
[X] GET /api/v1/fw/dmz/
|
436
|
-
|
437
|
-
```ruby
|
438
|
-
config.show('dmz')
|
439
|
-
```
|
440
|
-
|
441
|
-
##### Update the current Dmz configuration
|
442
|
-
[X] PUT /api/v1/fw/dmz/
|
443
|
-
|
444
|
-
```ruby
|
445
|
-
config.update('dmz', {
|
416
|
+
FreeboxApi::Configuration::Ftp.updateConfig(mySession, {
|
446
417
|
:enabled => true,
|
447
|
-
:ip => '192.168.1.42',
|
448
|
-
})
|
449
|
-
```
|
450
|
-
|
451
|
-
### Port Forwarding
|
452
|
-
|
453
|
-
#### Port Forwarding API
|
454
|
-
|
455
|
-
##### Getting the list of port forwarding
|
456
|
-
[X] GET /api/v1/fw/redir/
|
457
|
-
|
458
|
-
```ruby
|
459
|
-
port_forwardings = FreeboxApi::Resources::PortForwarding.new(mySession)
|
460
|
-
port_forwardings.index
|
461
|
-
```
|
462
|
-
|
463
|
-
##### Getting a specific port forwarding
|
464
|
-
[X] GET /api/v1/fw/redir/{redir\_id}
|
465
|
-
|
466
|
-
```ruby
|
467
|
-
port_forwardings.show(1)
|
468
|
-
```
|
469
|
-
|
470
|
-
##### Updating a port forwarding
|
471
|
-
[X] PUT /api/v1/fw/redir/{redir\_id}
|
472
|
-
|
473
|
-
```ruby
|
474
|
-
port_forwardings.update({
|
475
|
-
:id => 1,
|
476
|
-
:enabled => false,
|
477
418
|
})
|
478
419
|
```
|
479
|
-
|
480
|
-
##### Add a port forwarding
|
481
|
-
[X] POST /api/v1/fw/redir/
|
482
|
-
|
483
|
-
```ruby
|
484
|
-
port_forwardings.create({
|
485
|
-
:enabled => true,
|
486
|
-
:comment => 'test',
|
487
|
-
:lan_port => 4242,
|
488
|
-
:wan_port_end => 4242,
|
489
|
-
:wan_port_start => 4242,
|
490
|
-
:lan_ip => '192.168.1.42',
|
491
|
-
:ip_proto => 'tcp',
|
492
|
-
})
|
493
|
-
```
|
494
|
-
|
495
|
-
##### Delete a port forwarding
|
496
|
-
[X] DELETE /api/v1/fw/redir/{redir\_id}
|
497
|
-
|
498
|
-
```ruby
|
499
|
-
port_forwardings.destroy(3)
|
500
|
-
```
|
501
|
-
|
502
|
-
### UPnP IGD
|
503
|
-
|
504
|
-
#### UPnP IGD config API
|
505
|
-
|
506
|
-
##### Get the current UPnP IGD configuration
|
507
|
-
[X] GET /api/v1/upnpigd/config/
|
508
|
-
|
509
|
-
```ruby
|
510
|
-
config.show('upnpigd')
|
511
|
-
```
|
512
|
-
|
513
|
-
##### Update the UPnP IGD configuration
|
514
|
-
[X] PUT /api/v1/upnpigd/config/
|
515
|
-
|
516
|
-
```ruby
|
517
|
-
config.update('upnpigd', {
|
518
|
-
:enabled => true,
|
519
|
-
})
|
520
|
-
```
|
521
|
-
|
522
|
-
#### UPnP IGD Redirection API
|
523
|
-
|
524
|
-
##### Get the list of current redirection
|
525
|
-
[X] GET /api/v1/upnpigd/redir/
|
526
|
-
|
527
|
-
```ruby
|
528
|
-
upnp_redir = FreeboxApi::Resources::UPnPRedir.new(mySession)
|
529
|
-
upnp_redir.index
|
530
|
-
```
|
531
|
-
|
532
|
-
##### Delete a redirection
|
533
|
-
[X] DELETE /api/v1/upnpigd/redir/{id}
|
534
|
-
|
535
|
-
```ruby
|
536
|
-
upnp_redir.destroy('0.0.0.0-53644-udp')
|
537
|
-
```
|
538
|
-
|
539
|
-
### LCD
|
540
|
-
|
541
|
-
#### LCD config API
|
542
|
-
|
543
|
-
##### Get the current LCD configuration
|
544
|
-
[X] GET /api/v1/lcd/config/
|
545
|
-
|
546
|
-
```ruby
|
547
|
-
config.show('lcd')
|
548
|
-
```
|
549
|
-
|
550
|
-
##### Update the lcd configuration
|
551
|
-
[X] PUT /api/v1/lcd/config/
|
552
|
-
|
553
|
-
```ruby
|
554
|
-
config.update('lcd', {
|
555
|
-
:brightness => 50,
|
556
|
-
})
|
557
|
-
```
|
558
|
-
|
559
|
-
### Network Share
|
560
|
-
|
561
|
-
#### Samba config API
|
562
|
-
|
563
|
-
##### Get the current Samba configuration
|
564
|
-
[X] GET /api/v1/netshare/samba/
|
565
|
-
|
566
|
-
```ruby
|
567
|
-
config.show('samba')
|
568
|
-
```
|
569
|
-
|
570
|
-
##### Update the Samba configuration
|
571
|
-
[X] PUT /api/v1/netshare/samba/
|
572
|
-
|
573
|
-
```ruby
|
574
|
-
config.update('samba', {
|
575
|
-
:print_share_enabled => false,
|
576
|
-
})
|
577
|
-
```
|
578
|
-
|
579
|
-
#### Afp config API
|
580
|
-
|
581
|
-
##### Get the current Afp configuration
|
582
|
-
[X] GET /api/v1/netshare/afp/
|
583
|
-
|
584
|
-
```ruby
|
585
|
-
config.show('afp')
|
586
|
-
```
|
587
|
-
|
588
|
-
##### Update the Afp configuration
|
589
|
-
[X] PUT /api/v1/netshare/afp/
|
590
|
-
|
591
|
-
```ruby
|
592
|
-
config.update('afp', {
|
593
|
-
:guest_allow => false,
|
594
|
-
})
|
595
|
-
```
|
596
|
-
|
597
|
-
### UPnP AV
|
598
|
-
|
599
|
-
#### UPnP AV config API
|
600
|
-
|
601
|
-
##### Get the current UPnP AV configuration
|
602
|
-
[X] GET /api/v1/upnpav/config/
|
603
|
-
|
604
|
-
```ruby
|
605
|
-
config.show('upnpav')
|
606
|
-
```
|
607
|
-
|
608
|
-
##### Update the UPnP AV configuration
|
609
|
-
[X] PUT /api/v1/upnpav/config/
|
610
|
-
|
611
|
-
```ruby
|
612
|
-
config.update('upnpav', {
|
613
|
-
:enabled => false,
|
614
|
-
})
|
615
|
-
```
|
616
|
-
|
617
|
-
### Switch
|
618
|
-
|
619
|
-
#### Switch API
|
620
|
-
|
621
|
-
##### Get the current switch status
|
622
|
-
[ ] GET /api/v1/switch/status/
|
623
|
-
|
624
|
-
##### Get a port configuration
|
625
|
-
[ ] GET /api/v1/switch/port/{id}
|
626
|
-
|
627
|
-
##### Update a port configuration
|
628
|
-
[ ] PUT /api/v1/switch/port/{id}
|
629
|
-
|
630
|
-
##### Get a port stats
|
631
|
-
[ ] GET /api/v1/switch/port/{id}/stats
|
632
|
-
|
633
|
-
### Wi-Fi
|
634
|
-
|
635
|
-
#### Wi-Fi Status API
|
636
|
-
|
637
|
-
##### Get the current Wi-Fi status
|
638
|
-
[ ] GET /api/v1/wifi/
|
639
|
-
|
640
|
-
#### Wi-Fi config API
|
641
|
-
|
642
|
-
##### Get the current Wi-Fi configuration
|
643
|
-
[X] GET /api/v1/wifi/config/
|
644
|
-
|
645
|
-
```ruby
|
646
|
-
config.show('wifi')
|
647
|
-
```
|
648
|
-
|
649
|
-
##### Update the Wi-Fi configuration
|
650
|
-
[X] PUT /api/v1/wifi/config/
|
651
|
-
|
652
|
-
```ruby
|
653
|
-
config.update('wifi', {
|
654
|
-
:ap_params => {
|
655
|
-
:ht_mode => 'disabled',
|
656
|
-
}
|
657
|
-
})
|
658
|
-
```
|
659
|
-
|
660
|
-
##### Reset the Wi-Fi configuration
|
661
|
-
[ ] POST /api/v1/wifi/config/reset/
|
662
|
-
|
663
|
-
#### Wi-Fi Stations API
|
664
|
-
|
665
|
-
##### Get Wi-Fi Stations List
|
666
|
-
[ ] GET /api/v1/wifi/stations/{bss\_name}/
|
667
|
-
|
668
|
-
#### Wi-Fi MAC Filter API
|
669
|
-
|
670
|
-
##### Get the MAC filter list
|
671
|
-
[ ] GET /api/v1/wifi/mac\_filter/
|
672
|
-
|
673
|
-
##### Getting a particular MAC filter
|
674
|
-
[ ] GET /api/v1/wifi/mac\_filter/{filter\_id}
|
675
|
-
|
676
|
-
##### Updating a MAC filter
|
677
|
-
[ ] PUT /api/v1/wifi/mac\_filter/{filter\_id}
|
678
|
-
|
679
|
-
##### Delete a MAC filter
|
680
|
-
[ ] DELETE /api/v1/wifi/mac\_filter/{filter\_id}
|
681
|
-
|
682
|
-
##### Create a new MAC filter
|
683
|
-
[ ] POST /api/v1/wifi/mac\_filter/
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module FreeboxApi
|
2
|
+
|
3
|
+
module Configuration
|
4
|
+
|
5
|
+
module Ftp
|
6
|
+
|
7
|
+
def self.getConfig(session)
|
8
|
+
session.http_call('get', '/ftp/config/')
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.updateConfig(session, value)
|
12
|
+
session.http_call('put', '/ftp/config/', value)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/freebox_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freebox_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -54,21 +54,13 @@ files:
|
|
54
54
|
- README.md
|
55
55
|
- freebox_api.gemspec
|
56
56
|
- lib/freebox_api.rb
|
57
|
-
- lib/freebox_api/application.rb
|
58
|
-
- lib/freebox_api/config.rb
|
59
57
|
- lib/freebox_api/configuration.rb
|
60
58
|
- lib/freebox_api/configuration/connection.rb
|
61
59
|
- lib/freebox_api/configuration/dhcp.rb
|
62
60
|
- lib/freebox_api/configuration/freeplug.rb
|
61
|
+
- lib/freebox_api/configuration/ftp.rb
|
63
62
|
- lib/freebox_api/configuration/lan.rb
|
64
63
|
- lib/freebox_api/freebox.rb
|
65
|
-
- lib/freebox_api/resources/freeplug.rb
|
66
|
-
- lib/freebox_api/resources/freeplug_network.rb
|
67
|
-
- lib/freebox_api/resources/interface.rb
|
68
|
-
- lib/freebox_api/resources/lan_host.rb
|
69
|
-
- lib/freebox_api/resources/port_forwarding.rb
|
70
|
-
- lib/freebox_api/resources/static_lease.rb
|
71
|
-
- lib/freebox_api/resources/upnp_redir.rb
|
72
64
|
- lib/freebox_api/session.rb
|
73
65
|
- lib/freebox_api/version.rb
|
74
66
|
homepage: http://github.com/mcanevet/freebox_api
|
data/lib/freebox_api/config.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
class Config
|
4
|
-
|
5
|
-
def initialize(session)
|
6
|
-
@session = session
|
7
|
-
end
|
8
|
-
|
9
|
-
def url(service)
|
10
|
-
case service
|
11
|
-
when 'ipv6'
|
12
|
-
'/connection/ipv6/config/'
|
13
|
-
when /^ddns\//
|
14
|
-
"/connection/#{service}/"
|
15
|
-
when 'dmz'
|
16
|
-
'/fw/dmz/'
|
17
|
-
when 'samba', 'afp'
|
18
|
-
'/netshare/samba/'
|
19
|
-
else
|
20
|
-
"/#{service}/config/"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def show(service)
|
25
|
-
@session.http_call('get', url(service))
|
26
|
-
end
|
27
|
-
|
28
|
-
def update(service, params = {})
|
29
|
-
@session.http_call('put', url(service), params)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
module Resources
|
4
|
-
|
5
|
-
class Freeplug
|
6
|
-
|
7
|
-
def initialize(session)
|
8
|
-
@session = session
|
9
|
-
end
|
10
|
-
|
11
|
-
def index
|
12
|
-
FreeplugNetwork.new(session).collect { |freeplug_network|
|
13
|
-
freeplug_network['members']
|
14
|
-
}.flatten
|
15
|
-
end
|
16
|
-
|
17
|
-
def show(id)
|
18
|
-
@session.http_call('get', "/freeplug/#{id}/")
|
19
|
-
end
|
20
|
-
|
21
|
-
def reset(id)
|
22
|
-
@session.http_call('post', "/freeplug/#{id}/reset/")
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
module Resources
|
4
|
-
|
5
|
-
class LanHost
|
6
|
-
|
7
|
-
def initialize(session)
|
8
|
-
@session = session
|
9
|
-
end
|
10
|
-
|
11
|
-
def index
|
12
|
-
Interface.new(@session).index.collect { |interface|
|
13
|
-
@session.http_call('get', "/lan/browser/#{interface['name']}")
|
14
|
-
}.flatten
|
15
|
-
end
|
16
|
-
|
17
|
-
def show(id, interface = 'pub')
|
18
|
-
@session.http_call('get', "/lan/browser/#{interface}/#{id}/")
|
19
|
-
end
|
20
|
-
|
21
|
-
def update(params = {}, interface = 'pub')
|
22
|
-
@session.http_call('put', "/lan/browser/#{interface}/#{params['id']}", params)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
module Resources
|
4
|
-
|
5
|
-
class PortForwarding
|
6
|
-
|
7
|
-
def initialize(session)
|
8
|
-
@session = session
|
9
|
-
end
|
10
|
-
|
11
|
-
def index
|
12
|
-
@session.http_call('get', '/fw/redir/')
|
13
|
-
end
|
14
|
-
|
15
|
-
def show(id)
|
16
|
-
@session.http_call('get', "/fw/redir/#{id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
def update(params = {})
|
20
|
-
@session.http_call('put', "/fw/redir/#{params['id']}", params)
|
21
|
-
end
|
22
|
-
|
23
|
-
def destroy(id)
|
24
|
-
@session.http_call('delete', "/fw/redir/#{id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
def create(params = {})
|
28
|
-
@session.http_call('post', '/fw/redir/', params)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
module Resources
|
4
|
-
|
5
|
-
class StaticLease
|
6
|
-
|
7
|
-
def initialize(session)
|
8
|
-
@session = session
|
9
|
-
end
|
10
|
-
|
11
|
-
def index
|
12
|
-
@session.http_call('get', '/dhcp/static_lease/') || []
|
13
|
-
end
|
14
|
-
|
15
|
-
def show(id)
|
16
|
-
@session.http_call('get', "/dhcp/static_lease/#{id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
def update(params = {})
|
20
|
-
@session.http_call('put', "/dhcp/static_lease/#{params['id']}", params)
|
21
|
-
end
|
22
|
-
|
23
|
-
def destroy(id)
|
24
|
-
@session.http_call('delete', "/dhcp/static_lease/#{id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
def create(params = {})
|
28
|
-
@session.http_call('post', '/dhcp/static_lease/', params)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module FreeboxApi
|
2
|
-
|
3
|
-
module Resources
|
4
|
-
|
5
|
-
class UPnPRedir
|
6
|
-
|
7
|
-
def initialize(session)
|
8
|
-
@session = session
|
9
|
-
end
|
10
|
-
|
11
|
-
def index
|
12
|
-
@session.http_call('get', '/upnpigd/redir/')
|
13
|
-
end
|
14
|
-
|
15
|
-
def destroy(id)
|
16
|
-
@session.http_call('delete', "/upnpigd/redir/#{id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|