Class: Internode::Usage

Inherits:
Resource show all
Defined in:
lib/internode/usage.rb

Instance Attribute Summary

Attributes inherited from Resource

#client, #path

Instance Method Summary collapse

Methods inherited from Resource

#content, content_attr, #initialize

Constructor Details

This class inherits a constructor from Internode::Resource

Instance Method Details

#idObject



3
4
5
# File 'lib/internode/usage.rb', line 3

def id
  service.text
end

#percentageObject



43
44
45
# File 'lib/internode/usage.rb', line 43

def percentage
  total.to_f / quota.to_f * 100.0
end

#plan_intervalObject



27
28
29
# File 'lib/internode/usage.rb', line 27

def plan_interval
  traffic.attr("plan-interval").text
end

#quotaObject



31
32
33
# File 'lib/internode/usage.rb', line 31

def quota
  traffic.attr("quota").text.to_i
end

#quota_gbObject



39
40
41
# File 'lib/internode/usage.rb', line 39

def quota_gb
  quota_mb / 1000
end

#quota_mbObject



35
36
37
# File 'lib/internode/usage.rb', line 35

def quota_mb
  quota / 1000 / 1000
end

#rolloverObject



23
24
25
# File 'lib/internode/usage.rb', line 23

def rollover
  traffic.attr("rollover").text
end

#totalObject



11
12
13
# File 'lib/internode/usage.rb', line 11

def total
  traffic.text.to_i
end

#total_gbObject



19
20
21
# File 'lib/internode/usage.rb', line 19

def total_gb
  total_mb / 1000
end

#total_mbObject



15
16
17
# File 'lib/internode/usage.rb', line 15

def total_mb
  total / 1000 / 1000
end

#typeObject



7
8
9
# File 'lib/internode/usage.rb', line 7

def type
  service.attr("type").text
end