Giter VIP home page Giter VIP logo

photo-ops's Introduction

Photo Ops

Documentation valid for master branch

Intro

The goal of the project is to build a simple application around Photo Ops.

List of dependencies

  • Paperclip (file attachment library for ActiveRecord)
  • Testing
    • factory-bot-rails
    • shoulda-matchers

API Endpoints

Our API will expose the following RESTful endpoints.

Endpoint Functionality
GET /photographers List all photographers
PUT /photos/:code/revoke Revoke code from a photo
GET /photos/:code Get a photo using your code
GET /photos/:code?type=large Get a photo base in type
GET /photographers/:photographer_id/photos List all photos from a photographer
POST /photographers/:photographer_id/photos Create a photo

Analysis

I decided to use request specs instead of the controller specs. RSpec Release Note

I start generating the themes and stands models but we are not going to use for the endpoints. All the action is in the Photographer and Photo models.

In the spec/model, I have the model_spec where we test the relationship between the models and the validations of the fields.

I use factories to test the models. For the Photo model I decided upload an image from the fixtures instate of use a fake avatar image.

All the endpoints are tested in the requests folder and have comments and annotations.

In the controllers/concerns I have two modules to manage all the response of the API, json_response and exception_handler.

Paperclip, why use this gem?

Paperclip

In my opinion, the best gem for file attachment. Good test documentation for validate all the fields, for the Test::Unit too. Module: Paperclip::Shoulda::Matchers

Currently I use the File Store in the public folder but the AWS S3 integration is so easy.

Paperclip support Fingerprint your files. One of the requirements for Scaling. Guides Asset Pipeline

The multiple files per upload challenge.

The challenge here is test all the functionality, send a hash of photos with the parameters, and itearate later in the controller to create the photo related with the photographer, very similar like here StackOverflow code But I was not so happy, so my idea for do that is use something like dropzonejs and generate diferents Ajax request for the Post. Issue here, is going to generate multiple codes.
Blog explain uploads multipe Files with DropzoneJS and Paperclip

photo-ops's People

Contributors

emacip avatar

Watchers

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