Class: Kanaui::DashboardHelper::DashboardApi
- Inherits:
-
KillBillClient::Model::Resource
- Object
- KillBillClient::Model::Resource
- Kanaui::DashboardHelper::DashboardApi
- Defined in:
- app/helpers/kanaui/dashboard_helper.rb
Constant Summary collapse
- KILLBILL_ANALYTICS_PREFIX =
'/plugins/killbill-analytics'
Class Method Summary collapse
- .available_reports(options = {}) ⇒ Object
- .create_report(report, options = {}) ⇒ Object
- .delete_report(name, options = {}) ⇒ Object
- .refresh(account_id, options = {}) ⇒ Object
- .refresh_report(name, options = {}) ⇒ Object
- .report_configuration(name, options = {}) ⇒ Object
- .reports(start_date, end_date, name, smooth, sql_only, format, options = {}) ⇒ Object
- .update_report(name, report, options = {}) ⇒ Object
Class Method Details
.available_reports(options = {}) ⇒ Object
14 15 16 17 18 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 14 def available_reports( = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports" response = KillBillClient::API.get path, {}, response.body end |
.create_report(report, options = {}) ⇒ Object
34 35 36 37 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 34 def create_report(report, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports" KillBillClient::API.post path, report, {}, end |
.delete_report(name, options = {}) ⇒ Object
49 50 51 52 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 49 def delete_report(name, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports/#{name}" KillBillClient::API.delete path, {}, {}, end |
.refresh(account_id, options = {}) ⇒ Object
9 10 11 12 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 9 def refresh(account_id, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/#{account_id}" KillBillClient::API.put path, {}, {}, end |
.refresh_report(name, options = {}) ⇒ Object
39 40 41 42 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 39 def refresh_report(name, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports/#{name}?shouldRefresh=true" KillBillClient::API.put path, {}, {}, end |
.report_configuration(name, options = {}) ⇒ Object
28 29 30 31 32 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 28 def report_configuration(name, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports/#{name}" response = KillBillClient::API.get path, {}, JSON.parse(response.body).symbolize_keys end |
.reports(start_date, end_date, name, smooth, sql_only, format, options = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 20 def reports(start_date, end_date, name, smooth, sql_only, format, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports?format=#{format}&startDate=#{start_date}&endDate=#{end_date}&name=#{name}" path = "#{path}&smooth=#{smooth}" if smooth path = "#{path}&sqlOnly=true" unless sql_only.blank? response = KillBillClient::API.get path, {}, response.body end |
.update_report(name, report, options = {}) ⇒ Object
44 45 46 47 |
# File 'app/helpers/kanaui/dashboard_helper.rb', line 44 def update_report(name, report, = {}) path = "#{KILLBILL_ANALYTICS_PREFIX}/reports/#{name}" KillBillClient::API.put path, report, {}, end |