Created
March 21, 2014 11:16
-
-
Save jerzyn/9684056 to your computer and use it in GitHub Desktop.
Example Account Info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def api_call_account_read(domain, provider_key, account_id) | |
url = "https://#{domain}/admin/api/accounts/#{account_id}.xml?provider_key=#{provider_key}" | |
response = RestClient.get url | |
raise Exception.new("Wrong response code (#{response.code}) in request #{url}") if response.code!=200 | |
document = Nokogiri::XML(response.to_str) | |
account = Hash.new | |
account["email"] = document.xpath("//users/user/email").text | |
account["name"] = document.xpath("//users/user/first_name").text + " " + document.xpath("//users/user/last_name").text | |
return account | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment