Skip to content

Instantly share code, notes, and snippets.

@corneliusellen
Last active March 22, 2018 23:24
Show Gist options
  • Save corneliusellen/e8836f389a974f0bbabec5053e97b5e0 to your computer and use it in GitHub Desktop.
Save corneliusellen/e8836f389a974f0bbabec5053e97b5e0 to your computer and use it in GitHub Desktop.
CFU Week 2 - Andy, Ellen and Megan

Week Two - Module 3 Some of these questions are from this week, some are from previous weeks, and some are new concepts. Try answering without research first. If you are not sure, take a guess but acknowledge that it's a guess (faking an answer in an interview without acknowledging it as a guess is a bad idea). Follow up with the necessary research to understand these concepts. These tend to be common themes during the job hunt and are worth having a solid understanding of.

What's OAuth?

  • Process of authenticating through a third party service.

What are some advantages/disadvantages of implementing OAuth? Advantages:

  • No need to store passwords
  • For users, it is less setup. You can inherit user's profile information and other data that is stored on the third party.
  • It increases your rate limit for API calls to that third party when you have the access token.

Disadvanatges:

  • Reliance on another application to always be up and running
  • Not all users will have the third party's account.
  • Can't create decisions on onboarding information

What are the four pillars of object oriented design?

  • Encapsulation
  • Abstraction
  • Polymorphism
  • Inheritance

How do they apply when creating: services?

  • Inheritance - you might have a base call that all your services use. Multiple service might use the same fundamental methods or even share state/behavior.

PORO's with the data received from an API?

  • Abstraction - POROs are modeling data structures from the API call.
  • Encapsulating - Using private methods to section off pieces of functionality.

What do we use VCR for? Why is it a good idea to use this tool?

  • VCR generates stubs from real API calls, which initially tests the actual call and subsequently makes your tests faster by saving the response for use in future tests.

What does HTTP stand for?

  • Hypertext Transfer Protocol

What class does ApplicationController inherit from when creating a Rails project with the --api flag?

  • ActionController::API

What about without the --api flag?

  • ActionController::Base

What is protects_from_forgery?

  • it is a before filter that checks the authenticity token of each request. The authenticity token is created as a hidden field within each form. It requires a user to actually fill out a form rather than making a request through postman with the form fields as parameters.

What do you need to do differently for your API to accept non-GET requests if you did not use the --api flag?

  • You must include the create, update and delete functionality in the base controller module.

How do you create the following table in SQL? In Active Record? (Users table with columns first_name, last_name, email, and age)

  • CREATE users(first_name string, last_name string, email string, age integer) rails g migration CreateUsers first_name last_name emamil age:integer rake db:migrate

What does inject do? How should you use it?

  • AKA reduce
  • It is a Ruby enumerator which uses a collector to aggregate data.
  • For example, instead of using .sum you can use .inject.

Self Assessment Rate yourself on the following scale. 3 I know and understand most of these concepts but had to look something up

^^ Please let an instructor know where you'd like support to catch you up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment