Class: Cradlepoint::NetFlow

Inherits:
CradlepointObject show all
Defined in:
lib/cradlepoint/net_flow.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/cradlepoint/net_flow.rb', line 4

def data
  @data
end

#macObject

Returns the value of attribute mac.



4
5
6
# File 'lib/cradlepoint/net_flow.rb', line 4

def mac
  @mac
end

#routerObject

Returns the value of attribute router.



4
5
6
# File 'lib/cradlepoint/net_flow.rb', line 4

def router
  @router
end

#status_dataObject

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_urlObject



11
12
13
# File 'lib/cradlepoint/net_flow.rb', line 11

def self.rel_url
  '/remote'
end

Instance Method Details

#getObject



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_statusObject



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_devicesObject



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

#paramsObject



36
37
38
# File 'lib/cradlepoint/net_flow.rb', line 36

def params
  { params: { format: :json, mac: self.mac, limit: 1 } }
end

#rel_urlObject



15
16
17
# File 'lib/cradlepoint/net_flow.rb', line 15

def rel_url
  Cradlepoint::NetFlow.rel_url
end