Class: Fastly::Invoice
Overview
An invoice for a time period
Instance Attribute Summary collapse
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
-
#regions ⇒ Object
Returns the value of attribute regions.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#total ⇒ Object
Returns the value of attribute total.
Attributes inherited from Base
Class Method Summary collapse
- .delete_path ⇒ Object
- .get_path(*args) ⇒ Object
- .list_path(*args) ⇒ Object
- .post_path ⇒ Object
- .put_path ⇒ Object
Instance Method Summary collapse
-
#end ⇒ Object
Get the end time of this invoice as a DateTime object in UTC.
-
#start ⇒ Object
Get the start time of this invoice as a DateTime object in UTC.
Methods inherited from Base
#as_hash, #initialize, path, #require_api_key!
Constructor Details
This class inherits a constructor from Fastly::Base
Instance Attribute Details
#end_time ⇒ Object
Returns the value of attribute end_time.
7 8 9 |
# File 'lib/fastly/invoice.rb', line 7 def end_time @end_time end |
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
7 8 9 |
# File 'lib/fastly/invoice.rb', line 7 def invoice_id @invoice_id end |
#regions ⇒ Object
Returns the value of attribute regions.
7 8 9 |
# File 'lib/fastly/invoice.rb', line 7 def regions @regions end |
#start_time ⇒ Object
Returns the value of attribute start_time.
7 8 9 |
# File 'lib/fastly/invoice.rb', line 7 def start_time @start_time end |
#total ⇒ Object
Returns the value of attribute total.
7 8 9 |
# File 'lib/fastly/invoice.rb', line 7 def total @total end |
Class Method Details
.delete_path ⇒ Object
74 75 76 |
# File 'lib/fastly/invoice.rb', line 74 def self.delete_path fail "You can't DELETE to an invoice" end |
.get_path(*args) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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) ⇒ Object
62 63 64 |
# File 'lib/fastly/invoice.rb', line 62 def self.list_path(*args) get_path(*args) end |
.post_path ⇒ Object
66 67 68 |
# File 'lib/fastly/invoice.rb', line 66 def self.post_path fail "You can't POST to an invoice" end |
.put_path ⇒ Object
70 71 72 |
# File 'lib/fastly/invoice.rb', line 70 def self.put_path fail "You can't PUT to an invoice" end |
Instance Method Details
#end ⇒ Object
Get the end time of this invoice as a DateTime object in UTC
38 39 40 |
# File 'lib/fastly/invoice.rb', line 38 def end DateTime.parse(end_time).new_offset(0) end |
#start ⇒ Object
Get the start time of this invoice as a DateTime object in UTC
33 34 35 |
# File 'lib/fastly/invoice.rb', line 33 def start DateTime.parse(start_time).new_offset(0) end |