Giter Club home page Giter Club logo

oo-airbnb's Introduction

Airbnb Relationship Practice

Deliverables

You are building an app for an Airbnb competitor

  • Your domain includes the models Listing, Trip, and Guest
    • A Listing (i.e. a house or apartment) has many trips
      • A listing has a city attribute which is a string of a city name, e.g. 'Seattle'
      • It cannot be changed after it is initialized
    • A Guest has many trips
      • A guest is initialized with a name. It cannot be changed after it is initialized
    • A Trip belongs to a listing and a guest
      • It will also be initialized with a guest, listing, and a duration of the trip

As always, begin with making sure to draw out the relationships and understand the domain. Then, below you will find the methods that we'd expect for you to complete. They are grouped by class, they are not ordered in any particular way beyond that.

Listing

  • Listing#guests
    • Returns an array of all Guest instances who have stayed at a listing
  • Listing#trips
    • Returns an array of all Trip instances at a listing
  • Listing#trip_count
    • Returns the number of trips that have been taken to that listing
  • Listing.all
    • Returns an array of all Listing instances that have been created
  • Listing.find_all_by_city
    • Takes an argument of a city name (as a string) and returns an array of all Listing instances for that city
  • Listing.most_popular
    • Finds the listing that has had the most trips

Guest

  • Guest#listings
    • Returns an array of all Listing instances a guest has stayed at
  • Guest#trips
    • Returns an array of all Trip instances a guest has taken
  • Guest#trip_count
    • Returns the number of trips a Guest has taken
  • Guest.all
    • Returns an array of all Guest instances
  • Guest.pro_traveler
    • Returns an array of all Guest instances who have made over 1 trip
  • Guest.find_all_by_name
    • Takes an argument of a guest's name (as a string), returns an array of Guest instances with that name

Trip

  • Trip#listing
    • Returns the Listing object for the trip
  • Trip#guest
    • Returns the Guest object for the trip
  • Trip.all
    • Returns an array of all Trips created

oo-airbnb's People

Contributors

evolfo avatar maxcell avatar yberdysh avatar

Watchers

 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.