Class: Cradlepoint::NetFlow
- Inherits:
-
CradlepointObject
- Object
- CradlepointObject
- Cradlepoint::NetFlow
- Defined in:
- lib/cradlepoint/net_flow.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#router ⇒ Object
Returns the value of attribute router.
-
#status_data ⇒ Object
Returns the value of attribute status_data.
Class Method Summary collapse
Instance Method Summary collapse
- #get ⇒ Object
- #get_status ⇒ Object
- #get_wan_devices ⇒ Object
-
#initialize(mac = nil, router = nil) ⇒ NetFlow
constructor
A new instance of NetFlow.
- #params ⇒ Object
- #rel_url ⇒ Object
Methods inherited from CradlepointObject
build_new_url, #build_new_url, #build_url, build_url, #ecm_object_blob?, ecm_object_blob?, successful_response?, #successful_response?
Constructor Details
#initialize(mac = nil, router = nil) ⇒ NetFlow
Returns a new instance of NetFlow.
6 7 8 9 |
# File 'lib/cradlepoint/net_flow.rb', line 6 def initialize(mac = nil, router = nil) self.mac = mac self.router = router end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/cradlepoint/net_flow.rb', line 4 def data @data end |
#mac ⇒ Object
Returns the value of attribute mac.
4 5 6 |
# File 'lib/cradlepoint/net_flow.rb', line 4 def mac @mac end |
#router ⇒ Object
Returns the value of attribute router.
4 5 6 |
# File 'lib/cradlepoint/net_flow.rb', line 4 def router @router end |
#status_data ⇒ Object
Returns the value of attribute status_data.
4 5 6 |
# File 'lib/cradlepoint/net_flow.rb', line 4 def status_data @status_data end |
Class Method Details
.rel_url ⇒ Object
11 12 13 |
# File 'lib/cradlepoint/net_flow.rb', line 11 def self.rel_url '/remote' end |
Instance Method Details
#get ⇒ Object
19 20 21 22 23 |
# File 'lib/cradlepoint/net_flow.rb', line 19 def get raise 'You must provide a mac' unless self.mac return self.data if self.data self.data = Cradlepoint.make_request(:get, build_new_url(rel_url), params) end |
#get_status ⇒ Object
25 26 27 28 29 |
# File 'lib/cradlepoint/net_flow.rb', line 25 def get_status raise 'You must provide a mac' unless self.mac return self.status_data if self.status_data self.status_data = Cradlepoint.make_request(:get, build_new_url("#{ rel_url }/status"), params) end |
#get_wan_devices ⇒ Object
31 32 33 34 |
# File 'lib/cradlepoint/net_flow.rb', line 31 def get_wan_devices raise 'You must provide a mac' unless self.mac Cradlepoint.make_request(:get, build_new_url("#{ rel_url }/status/wan/devices"), params) end |
#params ⇒ Object
36 37 38 |
# File 'lib/cradlepoint/net_flow.rb', line 36 def params { params: { format: :json, mac: self.mac, limit: 1 } } end |
#rel_url ⇒ Object
15 16 17 |
# File 'lib/cradlepoint/net_flow.rb', line 15 def rel_url Cradlepoint::NetFlow.rel_url end |