def get_profiles
get 'users/fetch_profiles', to: 'users#get_profile'
post 'users/update_profile', to: 'users#update_profile'
def verify_signature provided_signature = request.headers['X-Signature'] payload = request.raw_post # Compute the HMAC digest based on the payload of the request computed_signature = OpenSSL::HMAC.hexdigest('sha256', SECRET_KEY, payload) unless ActiveSupport::SecurityUtils.secure_compare(computed_signature, provided_signature) render json: { error: 'Invalid signature' }, status: :unauthorized end end
def get_profile (int profile_id, char user_name, char location)
{ profile_id: 10, user_name: 'Rushi Patel' location: 'Canada' settings: {mode: 'dark', zoom: 100, language: 'EN'} }
query = query.limit(params[:limit] || 5000)
if !params[:limit].present? || params[:limit].to_i > 5000 render(json: { error: 'Limit must be present and less than 5000' }, status: :bad_request) and return end
get 'users/fetch_profiles/v2', to: 'users#get_profile_v2'
def get_profiles_v2 end
name = " Rushi Patel "
name.strip Output: "Rushi Patel"
name.squeeze Output: " Rushi Patel "
name.squish Output: "Rushi Patel"
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] even = num.select(&:even?) puts 'num:' + num.to_s puts 'even:' + even.to_s output: num:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] even:[2, 4, 6, 8, 10]
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
even = num.select!(&:even?)
puts 'num:' + num.to_s
puts 'even:' + even.to_s
output:
num:[2, 4, 6, 8, 10]
even:[2, 4, 6, 8, 10]
num = [2, 4, 6, 8, 10] even = num.select!(&:even?) puts 'num:' + num.to_s puts 'even:' + even.to_s
output: num:[2, 4, 6, 8, 10] even: