This commit is contained in:
mgabdev
2020-04-03 19:18:26 -04:00
parent c6fdcb91c8
commit e485e2f955
21 changed files with 367 additions and 203 deletions

View File

@@ -6,10 +6,20 @@ class Api::V1::GabTrendsController < Api::BaseController
skip_before_action :set_cache_headers
def index
uri = URI('https://trends.gab.com/trend-feed/json')
uri.query = URI.encode_www_form()
body = Redis.current.get("gabtrends")
if body.nil?
uri = URI("https://trends.gab.com/trend-feed/json")
uri.query = URI.encode_www_form({})
res = Net::HTTP.get_response(uri)
render json: res.body if res.is_a?(Net::HTTPSuccess)
res = Net::HTTP.get_response(uri)
if res.is_a?(Net::HTTPSuccess)
body = res.body
Redis.current.set("gabtrends", res.body)
Redis.current.expire("gabtrends", 1.hour.seconds)
end
end
render json: body
end
end

View File

@@ -1,10 +1,10 @@
class Settings::ExpensesController < Admin::BaseController
def index
@ammount = Redis.current.get("monthly_funding_ammount") || 0
@amount = Redis.current.get("monthly_funding_amount") || 0
end
def create
Redis.current.set("monthly_funding_ammount", params[:ammount])
Redis.current.set("monthly_funding_amount", params[:amount])
redirect_to settings_expenses_path
end