class Fastly::Invoice

An invoice for a time period

Attributes

end_time[RW]

The latest date and time this invoice covers

invoice_id[RW]
regions[RW]

A hash reference with all the different regions and their subtotals

start_time[RW]

The earliest date and time this invoice covers

total[RW]

The total for this invoice in US dollars

Private Class Methods

delete_path() click to toggle source
# File lib/fastly/invoice.rb, line 74
def self.delete_path
  fail "You can't DELETE to an invoice"
end
get_path(*args) click to toggle source
# File lib/fastly/invoice.rb, line 44
def self.get_path(*args)
  opts = args.size > 0 ? args[0] : {}

  url  = '/billing/v2'

  url += if opts.key?(:year) && opts.key?(:month)
           "/year/#{opts[:year]}/month/#{opts[:month]}"
         elsif opts.key?(:id)
           "/account_customers/#{opts[:customer_id]}/invoices/#{opts[:id]}"
         elsif opts.key?(:mtd)
           "/account_customers/#{opts[:customer_id]}/mtd_invoice"
         else
           "/account_customers/#{opts[:customer_id]}/invoices"
         end

  url
end
list_path(*args) click to toggle source
# File lib/fastly/invoice.rb, line 62
def self.list_path(*args)
  get_path(*args)
end
post_path() click to toggle source
# File lib/fastly/invoice.rb, line 66
def self.post_path
  fail "You can't POST to an invoice"
end
put_path() click to toggle source
# File lib/fastly/invoice.rb, line 70
def self.put_path
  fail "You can't PUT to an invoice"
end

Public Instance Methods

end() click to toggle source

Get the end time of this invoice as a DateTime object in UTC

# File lib/fastly/invoice.rb, line 38
def end
  DateTime.parse(end_time).new_offset(0)
end
start() click to toggle source

Get the start time of this invoice as a DateTime object in UTC

# File lib/fastly/invoice.rb, line 33
def start
  DateTime.parse(start_time).new_offset(0)
end

Private Instance Methods

delete!() click to toggle source
# File lib/fastly/invoice.rb, line 82
def delete!
  fail "You can't delete an invoice"
end
save!() click to toggle source
# File lib/fastly/invoice.rb, line 78
def save!
  fail "You can't save an invoice"
end