Class: HarvestToInfakt::Resource
- Inherits:
-
Object
- Object
- HarvestToInfakt::Resource
- Includes:
- HTTParty
- Defined in:
- lib/harvest_to_infakt/resource.rb
Direct Known Subclasses
Harvest::Client, Harvest::Invoice, Infakt::Client, Infakt::Invoice
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(data) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(m, *args) ⇒ Object
Constructor Details
#initialize(data) ⇒ Resource
Returns a new instance of Resource.
5 6 7 |
# File 'lib/harvest_to_infakt/resource.rb', line 5 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/harvest_to_infakt/resource.rb', line 13 def method_missing(m, *args) if m.to_s =~ /(.+)=$/ @data[$1] = args.first elsif @data.has_key?(m.to_s) @data[m.to_s] else super end end |
Instance Method Details
#id ⇒ Object
9 10 11 |
# File 'lib/harvest_to_infakt/resource.rb', line 9 def id @data['id'] end |