Skip to content

Instantly share code, notes, and snippets.

View hassanakram's full-sized avatar
🏠
Working from home

Hassan Akram hassanakram

🏠
Working from home
View GitHub Profile
apt_repository 'ppa:longsleep/golang-backports' do
action :add
end
package "golang-1.16-go" do
action :install
end
remote_file "/usr/local/" do
class Api::V1::FriendsController < Api::V1::ApiController
doorkeeper_for :all
def index
render json: current_resource_owner.all_friends.to_json(only: [:username,:id])
end
def create
if (friend_code = FriendRequest.create_for(current_resource_owner, permitted_params))
this is somehting to share
class Api::V1::PointsController < Api::V1::ApiController
doorkeeper_for :all
# increase the points of a given user by the amount specified
def increase
@user = current_resource_owner
@points_increase = @user.points_increases.build(permitted_params)
if @points_increase.save
@user.reload # to refresh the points totals from db
require 'spec_helper'
describe Api::V1::PointsController do
context 'when no user is signed in' do
it 'responds with a 401 error' do
post :increase, points: { habitat_points: 10, lightbulbs: 5, soccer_fields: 4, water_buckets: 3 }
response.status.should == 401
end
it 'responds with a 401 error' do