Progress
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user