Module: Adminpanel::AnalyticsHelper
- Defined in:
- app/helpers/adminpanel/analytics_helper.rb
Instance Method Summary collapse
- #days_to_substract ⇒ Object
- #exist_instagram_account? ⇒ Boolean
- #fb_insights(fb_auth) ⇒ Object
- #insight ⇒ Object
- #metric(metric) ⇒ Object
Instance Method Details
#days_to_substract ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/adminpanel/analytics_helper.rb', line 4 def days_to_substract if params[:insight] == 'day' 1 elsif params[:insight] == 'week' 7 elsif params[:insight] == 'days_28' 28 else 0 end end |
#exist_instagram_account? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'app/helpers/adminpanel/analytics_helper.rb', line 35 def exist_instagram_account? if @instagram_token.nil? false else true end end |
#fb_insights(fb_auth) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/helpers/adminpanel/analytics_helper.rb', line 27 def fb_insights(fb_auth) if fb_auth "#{Koala::Facebook::API.new(fb_auth.value).get_object('me')['link']}insights" else '#' end end |
#insight ⇒ Object
16 17 18 19 20 21 |
# File 'app/helpers/adminpanel/analytics_helper.rb', line 16 def insight return 'day' if !params[:insight].present? return 'day' if params[:insight] == 'day' return 'week' if params[:insight] == 'week' return 'month' if params[:insight] == 'days_28' end |
#metric(metric) ⇒ Object
23 24 25 |
# File 'app/helpers/adminpanel/analytics_helper.rb', line 23 def metric(metric) metric.first['name'] end |