Class: Wesabe::Target
Instance Attribute Summary collapse
-
#amount_remaining ⇒ Object
This target’s amount remaining ($).
-
#monthly_limit ⇒ Object
This target’s monthly limit ($).
-
#tag ⇒ Object
The tag name.
Attributes inherited from BaseModel
Class Method Summary collapse
-
.from_xml(xml) ⇒ Wesabe::Target
Returns a
Wesabe::Targetgenerated from Wesabe’s API XML.
Instance Method Summary collapse
-
#initialize {|Target| ... } ⇒ Target
constructor
Initializes a
Wesabe::Targetand yields itself. - #inspect ⇒ Object
Methods inherited from BaseModel
Methods included from Util
Constructor Details
#initialize {|Target| ... } ⇒ Target
Initializes a Wesabe::Target and yields itself.
13 14 15 |
# File 'lib/wesabe/target.rb', line 13 def initialize yield self if block_given? end |
Instance Attribute Details
#amount_remaining ⇒ Object
This target’s amount remaining ($)
7 8 9 |
# File 'lib/wesabe/target.rb', line 7 def amount_remaining @amount_remaining end |
#monthly_limit ⇒ Object
This target’s monthly limit ($)
5 6 7 |
# File 'lib/wesabe/target.rb', line 5 def monthly_limit @monthly_limit end |
#tag ⇒ Object
The tag name
3 4 5 |
# File 'lib/wesabe/target.rb', line 3 def tag @tag end |
Class Method Details
.from_xml(xml) ⇒ Wesabe::Target
Returns a Wesabe::Target generated from Wesabe’s API XML.
24 25 26 27 28 29 30 |
# File 'lib/wesabe/target.rb', line 24 def self.from_xml(xml) new do |target| target.tag = xml.at("tag").at("name").inner_text target.monthly_limit = xml.at("monthly-limit").inner_text.to_f target.amount_remaining = xml.at("amount-remaining").inner_text.to_f end end |
Instance Method Details
#inspect ⇒ Object
32 33 34 |
# File 'lib/wesabe/target.rb', line 32 def inspect inspect_these :tag, :monthly_limit, :amount_remaining end |