class Harvest::Expense

Public Class Methods

new(args = {}, _ = nil) click to toggle source
Calls superclass method
# File lib/harvest/expense.rb, line 9
def initialize(args = {}, _ = nil)
  args          = args.to_hash.stringify_keys
  self.spent_at = args.delete("spent_at") if args["spent_at"]
  super
end

Public Instance Methods

as_json(args = {}) click to toggle source
Calls superclass method
# File lib/harvest/expense.rb, line 19
def as_json(args = {})
  super(args).to_hash.stringify_keys.tap do |hash|
    hash[json_root].update("spent_at" => (spent_at.nil? ? nil : spent_at.xmlschema))
    hash[json_root].delete("has_receipt")
    hash[json_root].delete("receipt_url")
  end
end
spent_at=(date) click to toggle source
# File lib/harvest/expense.rb, line 15
def spent_at=(date)
  self["spent_at"] = Date.parse(date.to_s)
end