Class: IspUsage::Fetchers::Fetcher
- Inherits:
-
Object
- Object
- IspUsage::Fetchers::Fetcher
- Defined in:
- lib/ispusage/fetchers/fetcher.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#password ⇒ Object
Returns the value of attribute password.
-
#usage_periods ⇒ Object
Returns the value of attribute usage_periods.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(options) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(options) ⇒ Fetcher
Returns a new instance of Fetcher.
9 10 11 12 13 14 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 9 def initialize() @username = [:username] @password = [:password] self. = self.usage_periods = [] end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 7 def @options end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 7 def password @password end |
#usage_periods ⇒ Object
Returns the value of attribute usage_periods.
7 8 9 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 7 def usage_periods @usage_periods end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 7 def username @username end |
Instance Method Details
#to_hash ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 16 def to_hash { :isp => self.class.to_s.split('::').last, :username => @username, :usage_periods => self.usage_periods.map(&:to_hash) } end |
#to_json ⇒ Object
24 25 26 |
# File 'lib/ispusage/fetchers/fetcher.rb', line 24 def to_json to_hash.to_json end |