Git Product home page Git Product logo

pokemon-scraper-staff's Introduction

Objectives:

  1. Set up a SQLite database
  2. Scrape and save data into your database
  3. Use data to make ruby objects

Overview

In this lab you will set up your schema, scrape data, insert it into your db and then build out methods to manipulate your data.

For our purposes the Pokemon class is responsible for saving, adding, removing, or changing anything about each Pokémon. Your scraper is not responsible for knowing anything about them.

Note

We have set up your scraper class for you, which you can see in lib/scraper.rb. We have also created a schema_migration.sql file that will run the SQL statement to set up your database in db/pokemon.db. Your only job is to build out the methods to save and find pokemon in the database.

Create Our Pokemon Class

Our Pokemon class can be found in lib/pokemon.rb. This is where you will build your methods. Notice that #initialize requires keyword arguments.

A Note On Inserting Into the Database

When you use sql to insert into a database you write out the values by hand and insert them into the database. However, when you insert your Pokémon into the database you don't want to insert them into the query via string interpolation because of potential dangerous consequences. Instead we need to sanitize the data that goes into the query string you need to execute.

Getting Started

  • Fork this repo, and clone your fork.
  • bundle install (if that doesn't work run bundle update)
  • Follow the pending RSPEC tests to get your sense of direction.

NOTE: We strongly encourage you to at least attempt the bonus. That being said, if you decide that you'd like to move on without completing the bonus section, simply comment out the bonus tests and re-run the test suite. So long as there are pending tests, Learn will not recognize your code as passing.

BONUS

Now that we got every pokemon we want to get them ready to fight. (Did you really think you and Arel weren't going to have a battle after capturing every pokemon?) But if they battle we need to keep track of their hp (health power). And the only way to do that is to alter the database. What would be perfect is a sql query that adds an hp column and default value of 60 to every row. That sql command should be put into a migration file in db/.

Once the hp column is set up there should be an instance method called alter_hp that will allow us to change a specific pokemon's health to a new hp. It will need to take a new health power as a parameter.

Follow the pending specs for more information.

View Objectives: on Learn.co and start learning to code for free.

pokemon-scraper-staff's People

Contributors

ahimmelstoss avatar annjohn avatar aturkewi avatar babyshoes avatar bhollan avatar changamanda avatar drakeltheryuujin avatar febbraiod avatar fislabstest avatar fs-lms-test-bot avatar gj avatar howardbdev avatar irmiller22 avatar jjseymour avatar joshuabamboo avatar maxwellbenton avatar morgvanny avatar octosteve avatar peterbell avatar pletcher avatar ruchiramani avatar sarogers avatar tsiege avatar victhevenot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.