Giter Club home page Giter Club logo

oo-neopet-html-generator's Introduction

OO-Neopets

Contents

Section
Background
Objectives
Overview
File Structure
Instructions
Resources

Background

Before we cover the topic of web frameworks, like Sinatra and Rails, we introduce the idea of ERB, or "Embedded Ruby." ERB is an easy way to get Ruby to use templates, usually written in HTML, to create web pages. This lab is a pre-ERB lab in that it uses Ruby to generate HTML files without the benefit of ERB.

Hopefully upon the completion of this lab, you will:

  • feel comfortable getting objects to interact with each other
  • understand why ERB is so useful

Objectives

You're going to be making a rudimentary version of Neopets using object oriented Ruby. In the final section of this lab, you will be creating an HTML file using Ruby.

Overview

Models

On neopets.com, there are users, items, and neopets:

  • Items are of the simplest class and just have a type.
  • Users have have a name, neopoints (the Neopia version of currency), neopets, and items.
  • Like users, neopets also can have items. In addition, they have a name, a species, strength, defence, movement, and a mood.

Methods

Some basic things that users can do on neopets.com are buy pets, buy items, sell pets, feed pets, and give items to pets (kinda like giving them presents).

They can also read to their pets, submit items for auction, etc. but we'll just be focusing on the five methods above.

HTML Generator

Once all these methods are built out, you'll make a method in the user class that will generate an HTML file to display the user's "account" (an HTML dashboard, so to speak). For instance, that HTML file could look like this:

example html file

To see the basic HTML structure that went into creating the above 'profile', take a look at example.html in the views/readme_example folder.

File Structure

This lab has the following structure:

├── README.md
├── lib
│   ├── models
│   │   ├── item.rb
│   │   ├── neopet.rb
│   │   └── user.rb
│   └── scrapers
│       └── don't worry about this folder but take a look if you want
├── public
│   └── img
│       ├── items
│       │   └── bunch of item jpg files
│       ├── neopets
│       │   └── bunch of neopet jpg files
│       └── readme-images
│           └── example-html-page.png
├── spec
│   ├── specs
│   └── spec_helper.rb
└── views
    ├── readme_example
    │   └── example.html
    └── users
        └── your user.rb file will create html files in this folder

It will be helpful to be familiar with this structure as your Neopet class will select a random species for a new neopet using the file names in the folder public/img/neopets/.

Along the same lines, your Item class will select a random type from the file names in the public/img/items folder.

Furthermore, your User class will have a method, make_index_page, that will generate an HTML file and save it to the views/users/ folder.

Instructions

This is a test-driven lab and tests are written in order of increasing difficulty. Therefore, we suggest that you tackle them in order.

If you get stuck, be sure to refer to the curated resources below. If still stuck, feel free to:

  • google to your heart's content
  • ask a classmate
  • ask an instructor

Resources

View OO-Neopets on Learn.co and start learning to code for free.

oo-neopet-html-generator's People

Contributors

ahimmelstoss avatar annjohn avatar fislabstest avatar fs-lms-test-bot avatar kthffmn avatar sarogers avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oo-neopet-html-generator's Issues

Confusing spec

spec/2_neopet_spec.rb "calls on #get_points to assign strength, defence, movement, and happiness" test is confusing, and we are reading from the file to look for the answer.

Also, "initialize" is spelled wrong on line 18.

spec errors from molly

spec for mood "ecstatic" is wrong, should be 9 - 10 not 7 - 8

user spec "describe neopets" is wrong?

inconsistent naming

in 1_item_spec.rb a method "format_type" is tested (line 37), but later in 7_html_spec.rb it becomes "formatted_type" (line 82)

Incorrect test

Probably incorrect test here in 3_user_spec.rb, line 57: "it uses PET_NAMES array...". The problem is that ["Daisy","Rocky","Bandit"] does not fully represent PET_NAMES array, so this spec can either pass or fail even if the method tested here is written correctly

table appearance

looks like something is missing here. I recall a back and forth with @kthffmn about stripping out the relative images but this still appears like something is missing.

screen shot 2014-11-18 at 10 55 27 am

Error in spec 'lists the user's items'

Error in the very last spec for 7_html_spec.rb ('lists the user's items')

Last line before the two ends at the end of the spec call for items.formatted_type when there is no such method. The method should actually be items.format_type

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.