Comments (3)
Hello @andrzejsliwa
@dlcarter is away due to the holidays, so I will try to help you, and he can chime in after. While Blueprinter is currently open source, we haven't released it with a 0.1.0 version yet. We don't have a blog post on it yet, but you should hear more about it once we make 0.1.0, which should not be long. You can still give it a try, assuming inside a rails app:
# Gemfile
gem 'blueprinter', github: 'procore/blueprinter', branch: 'master'
# app/blueprints/user_blueprint
class UserBlueprint < Blueprinter::Base
identifier :uuid # or you can leave this out to default to :id
field :email, name: :login
view :normal do
fields :first_name, :last_name
end
view :extended do
include_view :normal
field :address
end
end
# app/users_controllers
class UsersController < ApplicationController
def index
render json: UserBlueprint.render(User.all, view: :normal)
end
def show
user = User.find params[:id]
render json: UserBlueprint.render(user, view: :extended)
end
end
from blueprinter.
@andrzejsliwa the gem is released, currently 0.2.0. So a typical gem install blueprinter
would work now. I'll close this for now, but if you have any other questions, feel free to re-open or start a new issue.
from blueprinter.
We also welcome any help with issues or PRs as well!
from blueprinter.
Related Issues (20)
- Transformer mutates original hash
- Discussion of a stable reflection API HOT 3
- Something weird when using transform. Use case: to lower camelCase HOT 2
- lazy load for association HOT 3
- Render one blueprint inside another? HOT 2
- Is there a way to exclude fields and associations and pass/process a block HOT 2
- Oj does not work after version 3.13 HOT 8
- "LocalJumpError: unexpected return" after update to 1.0 HOT 7
- How to create a field that is derived from other fields that are defined in the blueprint? HOT 1
- [bug] config.sort_fields_by = :definition causes SystemStackError: stack level too deep HOT 3
- [Feature Request][Rails] Render views from ActionController::API controllers HOT 5
- [Question/Support] Set one view as the default view HOT 3
- Mixed suggestions HOT 6
- Move global configuration HOT 6
- Extractor configurability HOT 5
- Separate internal options from external ones HOT 2
- Deprecate DateTimeFormatter HOT 3
- Implement association as it's own thing HOT 7
- [Feature Request] Support for nested associations defined at callsite HOT 1
- [bug] V 1.0.2 - Issue with Association when including custom name HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blueprinter.