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
<?xml version="1.0" encoding="UTF-8"?> | |
<event> | |
<type>application</type> | |
<action>updated</action> | |
<object> | |
THE APPLICATION OBJECT AS WOULD BE RETURNED BY A GET ON THE ACCOUNT MANAGEMENT | |
API | |
</object> | |
</event> |
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
{% for feature in current_user.account.bought_account_plan.system_name %} | |
... | |
{% endfor %} |
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_applications_list(domain, provider_key) | |
done = false | |
res = Array.new | |
page = 1 | |
while !done | |
url = "https://#{domain}/admin/api/applications.xml?provider_key=#{provider_key}&page=#{page}&per_page=100" | |
page += 1 | |
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 filter_applications(domain, provider_key, plan_name, num_of_days) | |
res = api_call_applications_list(domain, provider_key) | |
res.each do |item| | |
res.delete(item) if item["plan_name"] != plan_name | |
res.delete(item) if item["created_at"] > (DateTime.now - num_of_days) | |
end | |
return res | |
end |
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_application_usage(domain, provider_key, application_id, metric, from, to, granularity) | |
url = "https://#{domain}/stats/applications/#{application_id}/usage.xml?provider_key=#{provider_key}&metric_name=#{metric}&since=#{from}&until=#{to}&granularity=#{granularity}" | |
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) | |
return document.xpath("//usage/data/values").text.split(",") |
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 |
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
curl -v -X GET "http://su1.3scale.net/transactions/authrep.xml?provider_key=PROVIDER_KEY&app_id=APP_ID&app_key=APP_KEY&usage[words-write]=1" |
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
<status> | |
<authorized>false</authorized> | |
... |
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
curl -v -X GET "http://su1.3scale.net/transactions/authrep.xml?provider_key=PROVIDER_KEY&app_id=APP_ID&app_key=APP_KEY&usage[words]=1" |
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
<authorized>true</authorized> | |
<plan>Sandbox</plan> | |
... |
OlderNewer