freebox_api 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTRhOTA2NWI2NTZhM2E1NGEwMzA1MzE4OGRhMzhlZWNmNDE1MTljNg==
4
+ OTBiM2ZhNGVjYzZkMTEwZGVkOTc3NWMxNzQ0MmVkYWEzMmVhNmZmMQ==
5
5
  data.tar.gz: !binary |-
6
- YzAwZmY4YzI2MzFlODliOTE3NTljOGJiNTliYTQxMDE3NDRkNDY2Nw==
6
+ M2EyZDUzMGQ2MTVjOTlkZGRiNzczZWRjMTFiMmJjNTRmODJkNjUzOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDcyYjNhNTRhYWZhZTRmMjBjZDFkMWE5ZTI1MGM3YjVmOTIwOWM4ZmM0N2U3
10
- NDgyY2Q1MzRmMTRkZjAxOWZjYjhiNWFlNjBiMTFkZDA4ZGMxN2M3ZWE4ZGI2
11
- MTJhMGM0MTBlNjQ5MjcyYWU4YjgzMjQzOGNjMWJmYzg2MzE3ODE=
9
+ YjUwZTUyN2FmM2I4ZTJjNjI4M2IxOGU0YmFjNzNmZmY0NzIyM2U2YzA5NGJi
10
+ OWVmNTIzYmIwYTJhNGQ1ZjU0NmZhZTRiMTc1YjMyZWIwNjYwYzgwZDhlNzFl
11
+ MzkwMDA4NzcwZmZiZDQ2OGM2NTQ5MjFhMTBiZmE2MGVjZWU2Njc=
12
12
  data.tar.gz: !binary |-
13
- MWZiZGYxYjk1YTY0ZGRmZjNiMDMzZWQ2MmFkMTJiNzQ2NTdmNTNkODc0Nzg3
14
- M2Q0YThjYzliNjEzZDk3OTFmNWIwY2JhYmI0ZGY0YzM1NWVlOTAwZTdjYzM4
15
- NWY2MDFhNzI4MWJjNzNhMDA0ZTg5MjM2MGVjNTI5YTY2MjYwOGU=
13
+ MWU1Mzk1ODc1MzA4ODMwZWYwOWViYjlmODViZWIxNGIyZTdhNzUyNDEwMDBj
14
+ ZDk5NDgzZDA5OGVmZmU4Y2NhZjE3NmU0ZGZkNTI5MTk1ZGYyMTQyYmMyYTgz
15
+ YmQ5NjMyMTk0ZGE5MjhmM2ZjY2FiMDQxZjM4NTJiYzVhOTY1MTA=
data/README.md CHANGED
@@ -69,42 +69,113 @@ myApp = {
69
69
  mySession = FreeboxApi::Session.new(myApp, myFreebox)
70
70
  ```
71
71
 
72
- #### Getting the current challenge value
72
+ or
73
+
74
+ ```ruby
75
+ mysession = FreeboxApi::Session.new({
76
+ :app_id => 'fr.freebox.testapp',
77
+ :app_version => '0.0.7',
78
+ :app_token => 'dyNYgfK0Ya6FWGqq83sBHa7TwzWo+pg4fDFUJHShcjVYzTfaRrZzm93p7OTAfH/0',
79
+ }, FreeboxApi::Freebox.new)
80
+ ```
81
+
82
+ Reference
83
+ ---------
84
+
85
+ ### Connection API
73
86
 
74
87
  ```ruby
75
- myFreebox.challenge
88
+ connection = FreeboxApi::Services::Connection.new(mySession)
76
89
  ```
77
90
 
78
- #### Opening a session
91
+ #### Connection status
92
+
93
+ ##### Get the current Connection status
94
+ [X] GET /api/v1/connection/
79
95
 
80
96
  ```ruby
81
- mySession.session_token
97
+ connection.status
82
98
  ```
83
99
 
84
- LAN Browser
85
- -----------
100
+ #### Connection configuration
101
+
102
+ ##### Get the current Connection configuration
103
+ [X] GET /api/v1/connection/config/
104
+
105
+ ```ruby
106
+ connection.config
107
+ ```
108
+
109
+ ##### Update the Connection configuration
110
+ [X] PUT /api/v1/connection/config/
111
+
112
+ ```ruby
113
+ connection.config = {
114
+ :ping => true,
115
+ :wol => false,
116
+ }
117
+ ```
118
+
119
+ #### Connection IPv6 configuration
120
+
121
+ ##### Get the current IPv6 Connection configuration
122
+ [ ] GET /api/v1/connection/ipv6/config/
123
+
124
+ ##### Update the IPv6 Connection configuration
125
+ [ ] PUT /api/v1/connection/ipv6/config/
126
+
127
+ #### Connection DynDNS status
128
+
129
+ ##### Get the status of a DynDNS service
130
+ [ ] GET /api/v1/connection/ddns/{provider}/status/
131
+
132
+ #### Connection DynDNS configuration
133
+
134
+ ##### Get the config of a DynDNS service
135
+ [ ] GET /api/v1/connection/ddns/{provider}/
136
+
137
+ ##### Set the config of a DynDNS service
138
+ [ ] PUT /api/v1/connection/ddns/{provider}/
86
139
 
87
- ### Getting the list of browsable LAN interfaces
140
+ ### Lan
141
+
142
+ #### Lan Config API
143
+
144
+ ##### Get the current Lan configuration
145
+ [ ] GET /api/v1/lan/config/
146
+
147
+ ##### Update the current Lan configuration
148
+ [ ] PUT /api/v1/lan/config/
149
+
150
+ ### Lan Browser
151
+
152
+ #### Lan Browser API
153
+
154
+ ##### Getting the list of browsable LAN interfaces
155
+ [X] GET /api/v1/lan/browser/interfaces/
88
156
 
89
157
  ```ruby
90
158
  interfaces = FreeboxApi::Resources::Interface.new(mySession)
91
159
  interfaces.index
92
160
  ```
93
161
 
94
- ### Getting the list of hosts
162
+ ##### Getting the list of hosts on a given interface
163
+ [X] GET /api/v1/lan/browser/{interface}/
95
164
 
96
165
  ```ruby
97
166
  lan_hosts = FreeboxApi::Resources::LanHost.new(mySession)
98
167
  lan_hosts.index
99
168
  ```
100
169
 
101
- ### Getting an host information
170
+ ##### Getting an host information
171
+ [X] GET /api/v1/lan/browser/{interface}/{hostid}/
102
172
 
103
173
  ```ruby
104
174
  lan_hosts.show('ether-00:24:d4:7e:00:4c')
105
175
  ```
106
176
 
107
- ### Updating an host information
177
+ ##### Updating an host information
178
+ [X] PUT /api/v1/lan/browser/{interface}/{hostid}/
108
179
 
109
180
  ```ruby
110
181
  lan_hosts.update({
@@ -113,23 +184,67 @@ lan_hosts.update({
113
184
  })
114
185
  ```
115
186
 
116
- DHCP
117
- ----
187
+ #### Wake on LAN
188
+
189
+ ##### Send Wake ok Lan packet to an host
190
+ [ ] POST /api/v1/lan/wol/{interface}/
118
191
 
119
- ### Get the list of DHCP static leases
192
+ ### Freeplug
193
+
194
+ #### Freeplug API
195
+
196
+ ##### Get the current Freeplugs networks
197
+ [ ] GET /api/v1/freeplug/
198
+
199
+ ##### Get a particular Freeplug information
200
+ [ ] GET /api/v1/freeplug/{id}/
201
+
202
+ ##### Reset a Freeplug
203
+ [ ] POST /api/v1/freeplug/{id}/reset/
204
+
205
+ ### DHCP
206
+
207
+ #### DHCP Configuration API
208
+
209
+ ```ruby
210
+ dhcp = FreeboxApi::Services::DHCP.new(mySession)
211
+ ```
212
+
213
+ ##### Get the current DHCP configuration
214
+ [X] GET /api/v1/dhcp/config/
215
+
216
+ ```ruby
217
+ dhcp.config
218
+ ```
219
+
220
+ ##### Update the current DHCP configuration
221
+ [X] PUT /api/v1/dhcp/config/
222
+
223
+ ```ruby
224
+ dhcp.config = {
225
+ :enabled => false,
226
+ }
227
+ ```
228
+
229
+ #### DHCP Static Lease API
230
+
231
+ ##### Get the list of DHCP static leases
232
+ [X] GET /api/v1/dhcp/static\_lease/
120
233
 
121
234
  ```ruby
122
235
  static_leases = FreeboxApi::Resources::StaticLease.new(mySession)
123
236
  static_leases.index
124
237
  ```
125
238
 
126
- ### Get a given DHCP static lease
239
+ ##### Get a given DHCP static lease
240
+ [X] GET /api/v1/dhcp/static\_lease/{id}
127
241
 
128
242
  ```ruby
129
- static_leases.show('00:DE:AD:B0:0B:55)
243
+ static_leases.show('00:DE:AD:B0:0B:55')
130
244
  ```
131
245
 
132
- ### Update DHCP static lease
246
+ ##### Update DHCP static lease
247
+ [X] PUT /api/v1/dhcp/static\_lease/{id}
133
248
 
134
249
  ```ruby
135
250
  static_leases.update({
@@ -138,13 +253,16 @@ static_leases.update({
138
253
  })
139
254
  ```
140
255
 
141
- ### Delete a DHCP static lease
256
+ ##### Delete a DHCP static lease
257
+ [X] DELETE /api/v1/dhcp/static\_lease/{id}
142
258
 
143
259
  ```ruby
144
260
  static_lease.destroy('00:DE:AD:B0:0B:55')
145
261
  ```
146
262
 
147
- ### Add a DHCP static lease
263
+ ##### Add a DHCP static lease
264
+ [X] POST /api/v1/dhcp/static\_lease/
265
+
148
266
  ```ruby
149
267
  static_lease.create({
150
268
  :ip => '192.168.1.222',
@@ -152,23 +270,50 @@ static_lease.create({
152
270
  })
153
271
  ```
154
272
 
155
- Port Forwarding
156
- ---------------
273
+ ##### Get the list of DHCP dynamic leases
274
+ [ ] GET /api/v1/dhcp/dynamic\_lease/
275
+
276
+ ### Ftp
277
+
278
+ #### Ftp config API
279
+
280
+ ##### Get the current Ftp configuration
281
+ [ ] GET /api/v1/ftp/config/
282
+
283
+ ##### Update the FTP configuration
284
+ [ ] PUT /api/v1/ftp/config/
285
+
286
+ ### NAT
157
287
 
158
- ### Getting the list of port forwarding
288
+ #### Dmz Config API
289
+
290
+ ##### Get the current Dmz configuration
291
+ [ ] GET /api/v1/fw/dmz/
292
+
293
+ ##### Update the current Dmz configuration
294
+ [ ] PUT /api/v1/fw/dmz/
295
+
296
+ ### Port Forwarding
297
+
298
+ #### Port Forwarding API
299
+
300
+ ##### Getting the list of port forwarding
301
+ [X] GET /api/v1/fw/redir/
159
302
 
160
303
  ```ruby
161
304
  port_forwardings = FreeboxApi::Resources::PortForwarding.new(mySession)
162
305
  port_forwardings.index
163
306
  ```
164
307
 
165
- ### Getting a specific port forwarding
308
+ ##### Getting a specific port forwarding
309
+ [X] GET /api/v1/fw/redir/{redir\_id}
166
310
 
167
311
  ```ruby
168
312
  port_forwardings.show(1)
169
313
  ```
170
314
 
171
- ### Updating a port forwarding
315
+ ##### Updating a port forwarding
316
+ [X] PUT /api/v1/fw/redir/{redir\_id}
172
317
 
173
318
  ```ruby
174
319
  port_forwardings.update({
@@ -177,7 +322,8 @@ port_forwardings.update({
177
322
  })
178
323
  ```
179
324
 
180
- ### Add a port forwarding
325
+ ##### Add a port forwarding
326
+ [X] POST /api/v1/fw/redir/
181
327
 
182
328
  ```ruby
183
329
  port_forwardings.create({
@@ -191,24 +337,130 @@ port_forwardings.create({
191
337
  })
192
338
  ```
193
339
 
194
- ### Delete a port forwarding
340
+ ##### Delete a port forwarding
341
+ [X] DELETE /api/v1/fw/redir/{redir\_id}
195
342
 
196
343
  ```ruby
197
344
  port_forwardings.destroy(3)
198
345
  ```
199
346
 
200
- UPnP IGD
201
- --------
347
+ ### UPnP IGD
348
+
349
+ #### UPnP IGD config API
202
350
 
203
- ### Get the list of current redirection
351
+ ##### Get the current UPnP IGD configuration
352
+ [ ] GET /api/v1/upnpigd/config/
353
+
354
+ ##### Update the UPnP IGD configuration
355
+ [ ] PUT /api/v1/upnpigd/config/
356
+
357
+ #### UPnP IGD Redirection API
358
+
359
+ ##### Get the list of current redirection
360
+ [X] GET /api/v1/upnpigd/redir/
204
361
 
205
362
  ```ruby
206
363
  upnp_redir = FreeboxApi::Resources::UPnPRedir.new(mySession)
207
364
  upnp_redir.index
208
365
  ```
209
366
 
210
- ### Delete a redirection
367
+ ##### Delete a redirection
368
+ [X] DELETE /api/v1/upnpigd/redir/{id}
211
369
 
212
370
  ```ruby
213
371
  upnp_redir.destroy('0.0.0.0-53644-udp')
214
372
  ```
373
+
374
+ ### LCD
375
+
376
+ #### LCD config API
377
+
378
+ ##### Get the current LCD configuration
379
+ [ ] GET /api/v1/lcd/config/
380
+
381
+ ##### Update the lcd configuration
382
+ [ ] PUT /api/v1/lcd/config/
383
+
384
+ ### Network Share
385
+
386
+ #### Samba config API
387
+
388
+ ##### Get the current Samba configuration
389
+ [ ] GET /api/v1/netshare/samba/
390
+
391
+ ##### Update the Samba configuration
392
+ [ ] PUT /api/v1/netshare/samba/
393
+
394
+ #### Afp config API
395
+
396
+ ##### Get the current Afp configuration
397
+ [ ] GET /api/v1/netshare/afp/
398
+
399
+ ##### Update the Afp configuration
400
+ [ ] PUT /api/v1/netshare/afp/
401
+
402
+ ### UPnP AV
403
+
404
+ #### UPnP AV config API
405
+
406
+ ##### Get the current UPnP AV configuration
407
+ [ ] GET /api/v1/upnpav/config/
408
+
409
+ ##### Update the UPnP AV configuration
410
+ [ ] PUT /api/v1/upnpav/config/
411
+
412
+ ### Switch
413
+
414
+ #### Switch API
415
+
416
+ ##### Get the current switch status
417
+ [ ] GET /api/v1/switch/status/
418
+
419
+ ##### Get a port configuration
420
+ [ ] GET /api/v1/switch/port/{id}
421
+
422
+ ##### Update a port configuration
423
+ [ ] PUT /api/v1/switch/port/{id}
424
+
425
+ ##### Get a port stats
426
+ [ ] GET /api/v1/switch/port/{id}/stats
427
+
428
+ ### Wi-Fi
429
+
430
+ #### Wi-Fi Status API
431
+
432
+ ##### Get the current Wi-Fi status
433
+ [ ] GET /api/v1/wifi/
434
+
435
+ #### Wi-Fi config API
436
+
437
+ ##### Get the current Wi-Fi configuration
438
+ [ ] GET /api/v1/wifi/config/
439
+
440
+ ##### Update the Wi-Fi configuration
441
+ [ ] PUT /api/v1/wifi/config/
442
+
443
+ ##### Reset the Wi-Fi configuration
444
+ [ ] POST /api/v1/wifi/config/reset/
445
+
446
+ #### Wi-Fi Stations API
447
+
448
+ ##### Get Wi-Fi Stations List
449
+ [ ] GET /api/v1/wifi/stations/{bss\_name}/
450
+
451
+ #### Wi-Fi MAC Filter API
452
+
453
+ ##### Get the MAC filter list
454
+ [ ] GET /api/v1/wifi/mac\_filter/
455
+
456
+ ##### Getting a particular MAC filter
457
+ [ ] GET /api/v1/wifi/mac\_filter/{filter\_id}
458
+
459
+ ##### Updating a MAC filter
460
+ [ ] PUT /api/v1/wifi/mac\_filter/{filter\_id}
461
+
462
+ ##### Delete a MAC filter
463
+ [ ] DELETE /api/v1/wifi/mac\_filter/{filter\_id}
464
+
465
+ ##### Create a new MAC filter
466
+ [ ] POST /api/v1/wifi/mac\_filter/
@@ -0,0 +1,27 @@
1
+ module FreeboxApi
2
+
3
+ module Services
4
+
5
+ class Connection
6
+
7
+ def initialize(session)
8
+ @session = session
9
+ end
10
+
11
+ def status
12
+ @session.http_call('get', '/connection/')
13
+ end
14
+
15
+ def config
16
+ @session.http_call('get', '/connection/config/')
17
+ end
18
+
19
+ def config=(value)
20
+ @session.http_call('put', '/connection/config/', value)
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,23 @@
1
+ module FreeboxApi
2
+
3
+ module Services
4
+
5
+ class DHCP
6
+
7
+ def initialize(session)
8
+ @session = session
9
+ end
10
+
11
+ def config
12
+ @session.http_call('get', '/dhcp/config/')
13
+ end
14
+
15
+ def config=(value)
16
+ @session.http_call('put', '/dhcp/config/', value)
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -1,3 +1,3 @@
1
1
  module FreeboxApi
2
- VERSION = '0.0.2'
2
+ VERSION = '0.1.0'
3
3
  end
data/lib/freebox_api.rb CHANGED
@@ -6,3 +6,5 @@ require 'freebox_api/session'
6
6
  require 'freebox_api/version'
7
7
  resource_files = Dir[File.expand_path("#{File.dirname(__FILE__)}/freebox_api/resources/*.rb", __FILE__)]
8
8
  resource_files.each { |f| require f }
9
+ service_files = Dir[File.expand_path("#{File.dirname(__FILE__)}/freebox_api/services/*.rb", __FILE__)]
10
+ service_files.each { |f| require f }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freebox_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Canévet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-28 00:00:00.000000000 Z
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -56,6 +56,8 @@ files:
56
56
  - lib/freebox_api/resources/port_forwarding.rb
57
57
  - lib/freebox_api/resources/static_lease.rb
58
58
  - lib/freebox_api/resources/upnp_redir.rb
59
+ - lib/freebox_api/services/connection.rb
60
+ - lib/freebox_api/services/dhcp.rb
59
61
  - lib/freebox_api/session.rb
60
62
  - lib/freebox_api/version.rb
61
63
  homepage: http://github.com/mcanevet/freebox_api