Skip to content

Instantly share code, notes, and snippets.

@solisoft
Created January 20, 2012 09:25
Show Gist options
  • Select an option

  • Save solisoft/1646370 to your computer and use it in GitHub Desktop.

Select an option

Save solisoft/1646370 to your computer and use it in GitHub Desktop.
OVH Invoices
#!/usr/bin/ruby
# Require:
# - linux or Mac
# - ruby 1.8.7
# - Gem soap4r
# - curl
#
# Usage :
# ruby ovhfact.rb 2011
#
# Configuration :
# Update your credentials
require 'soap/wsdlDriver'
year ||= Time.now.year
year = ARGV[0] if ARGV[0]
wsdl = 'https://www.ovh.com/soapi/soapi-re-1.29.wsdl'
soapi = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
#login
session = soapi.login('xxxxxxxx-ovh', 'xxxxxxxx', 'fr', true)
puts "login successfull"
#billingInvoiceList
invoices = soapi.billingInvoiceList(session)
invoices.each do |invoice|
billnum = invoice.billnum
if invoice.date >= "#{year}-01-01 00:00:00" and invoice.date <= "#{year}-12-31 23:59:59"
invoice = soapi.billingInvoiceInfo(session, invoice.billnum, '', invoice.billingCountry)
system("mkdir -p invoices/#{year}")
system("curl 'https://www.ovh.com/cgi-bin/order/facture.pdf?reference=#{billnum}&passwd=#{invoice.password}' > invoices/#{year}/#{billnum}.pdf")
end
end
#logout
soapi.logout(session);
puts "Done"
@jgrossiord
Copy link
Copy Markdown

Superbe, merci c'est exactement ce que je cherchais

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment