class Octobat::Invoice

Public Class Methods

csv_export(params = {}, opts={}) click to toggle source
# File lib/octobat/invoice.rb, line 19
def self.csv_export(params = {}, opts={})
  api_key, headers = Util.parse_opts(opts)
  api_key ||= @api_key
  opts[:api_key] = api_key

  instance = self.new(nil, opts)

  response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
  return true
end
pdf_export(params = {}, opts={}) click to toggle source
# File lib/octobat/invoice.rb, line 8
def self.pdf_export(params = {}, opts={})
  api_key, headers = Util.parse_opts(opts)
  api_key ||= @api_key
  opts[:api_key] = api_key

  instance = self.new(nil, opts)

  response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, opts)
  return true
end

Public Instance Methods

cancel(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 52
def cancel(params = {}, opts = {})
  response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
cancel_and_replace(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 57
def cancel_and_replace(params = {}, opts = {})
  response, api_key = Octobat.request(:patch, cancel_and_replace_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
confirm(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 36
def confirm(params = {}, opts = {})
  response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
delete(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 62
def delete(params = {}, opts = {})
  response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
  refresh_from(response, api_key)
end
items(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 67
def items(params = {}, opts = {})
  Item.list(params.merge({ :invoice => id }), {api_key: @api_key}.merge(opts))
end
mark_uncollectible(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 46
def mark_uncollectible(params = {}, opts = {})
  response, api_key = Octobat.request(:patch, mark_uncollectible_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
send_by_email(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 31
def send_by_email(params = {}, opts = {})
  response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
set_payment_terms(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 41
def set_payment_terms(params = {}, opts = {})
  response, api_key = Octobat.request(:patch, set_payment_terms_url, @api_key, params, opts)
  refresh_from(response, api_key)
end
transactions(params = {}, opts = {}) click to toggle source
# File lib/octobat/invoice.rb, line 71
def transactions(params = {}, opts = {})
  Transaction.list(params.merge(invoice: id), {api_key: @api_key}.merge(opts))
end

Private Instance Methods

cancel_and_replace_url() click to toggle source
# File lib/octobat/invoice.rb, line 98
def cancel_and_replace_url
  url + '/cancel_and_replace'
end
cancel_url() click to toggle source
# File lib/octobat/invoice.rb, line 94
def cancel_url
  url + '/cancel'
end
confirm_url() click to toggle source
# File lib/octobat/invoice.rb, line 82
def confirm_url
  url + '/confirm'
end
mark_uncollectible_url() click to toggle source
# File lib/octobat/invoice.rb, line 86
def mark_uncollectible_url
  url + '/mark_uncollectible'
end
send_url() click to toggle source
# File lib/octobat/invoice.rb, line 78
def send_url
  url + '/send'
end
set_payment_terms_url() click to toggle source
# File lib/octobat/invoice.rb, line 90
def set_payment_terms_url
  url + '/set_payment_terms'
end