Class: AelTracker::Bill

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/ael_tracker/bill.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bill_id) ⇒ Bill

Returns a new instance of Bill.



13
14
15
# File 'lib/ael_tracker/bill.rb', line 13

def initialize(bill_id)
  self.id = bill_id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/ael_tracker/bill.rb', line 21

def method_missing(name, *args, &block)
  if profile.has_key?(name.to_s)
    profile[name.to_s]
  else
    super
    # "Hey there, #{name} is not an attribute of bill in our records."
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/ael_tracker/bill.rb', line 7

def id
  @id
end

Instance Method Details

#profileObject



17
18
19
# File 'lib/ael_tracker/bill.rb', line 17

def profile
  @profile ||= get_profile
end