Giter Club home page Giter Club logo

planets's Introduction

README for Planets: Individual Project

Ruby 2.5.1 Rails 5.2.1 A live version is deployed on Heroku, and can be accessed using the following link:

https://mysterious-coast-84654.herokuapp.com/

Running the application locally

Run bundle install if the sqlite3 database isn't already present, then seed the database using:

rake fpm:put_tables

Access the application using:http://localhost:3000

These are the parts that are not working correctly

  1. I tried to implement testing for http request to NASA's APOD and returned JSON:
  RSpec.describe "NASA APOD", type: :request do
  describe "GET /nasa_api" do
    it "should return title" do
      @nasa_info.should_receive("title")
    end
    it "should give body of text" do 
      @nasa_info.should_receive("explaination")
    end
    it "should give date" do
      @nasa_info.should_receive("date")
    end
    it "returns information from API" do
      get('/nasa_api')
      json = JSON.parse(response.body)
      expect(response.body).not_to be_nil
    end
  end 
 end
  1. I tried to make a transaction page for a purchasable element to the website, which was ultimately unsuccessful:
class LineItem < ApplicationRecord
  belongs_to :sponsor
  belongs_to :cart
  belongs_to :order
  has_many :sponsors
  enum donation: {
  	"1 Month" => "1Month",
  	"3 Months" => "3Months",
  	"6 Months" => "6Months"
  }
end

Above is the model for lineitem, and below for cart/basket.

class Cart < ApplicationRecord
	has_many :line_items, dependent: :destroy

	def add_product(sponsor)
    	current_item = line_items.find_by(sponsor_id: sponsor.id)
    	if current_item
            current_item.quantity += 1
        else
          current_item = line_items.build(sponsor_id: sponsor.id)
        end
        current_item
    end

    def total_price
        line_items.to_a.sum { |total| total.total_price }
    end
end
  1. I implemented session keys for additional security, but this would not work in deployment:
 config.action_controller.session = { 
      :session_key => "_user_session",  
      :secret      => "6h54gjh254g747171g7l4h1g74l4g1" 
  }
  1. I tried to implement the Devise gem into my user model, but as I already had a user and session model, there were unknown conflicts which prevented the app from deploying to heroku. The users model does however work with 'devise' in development.

  2. I attempted to issue a spec to test the dependencies of the Sponsor model, however this was unsuccessful.

it 'dependants are there' do
			User = User.find(params[:user_id])
			Planet = Planet.find(params[:planet_id])
		end

planets's People

Contributors

alex-whyatt avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.