Authenticating with Pagekite API using Ruby

If you’re using pagekite, you probably have read this

It tells you how to connect to pagekite’s XMLRPC service
to perform actions such as creating a new kite, checking your accounts etc.

Their example is in python and if you’re like me, trying to figure out how to
get it to work in Ruby, here’s my snippet:

   # lets do this - test.rb
  require 'xmlrpc/client'
  server = XMLRPC::Client.new_from_uri('') 
  # note that you really need that trailing slash after /xmlrpc.

  # next you need to ensure that you add the http_header_extra header configuration
  # else you'll end up with a 'Wrong size. Was X, should be Y' error when making calls.

  server.http_header_extra = {'accept-encoding' => 'identity'}

  # now just login!
  ok, (a, c)='login', '<your pagekite identifier>', 'password', '')

  # follow the API as you would!
  ok, data ='get_account_info', a, c, 0)

  # enjoy!