lib/fastly/invoice.rb in fastly-0.9 vs lib/fastly/invoice.rb in fastly-0.95

- old
+ new

@@ -36,10 +36,21 @@ ## # :attr: regions # # A hash reference with all the different regions and their subtotals + + # Get the start time of this invoice as a DateTime object in UTC + def start + DateTime.parse(start_time).new_offset(0) + end + + # Get the end time of this invoice as a DateTime object in UTC + def end + DateTime.parse(end_time).new_offset(0) + end + private def self.get_path(*args) opts = args.size>0 ? args[0] : {} url = "/billing" @@ -87,9 +98,11 @@ opts = {} unless year.nil? || month.nil? opts[:year] = year opts[:month] = month end - list(Fastly::Invoice, opts) + list = client.get(Fastly::Invoice.list_path(opts)) + return [] if list.nil? + list.map { |hash| Fastly::Invoice.new(hash, self) } end end \ No newline at end of file