This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt_repository 'ppa:longsleep/golang-backports' do | |
| action :add | |
| end | |
| package "golang-1.16-go" do | |
| action :install | |
| end | |
| remote_file "/usr/local/" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this is somehting to share |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |