First install git-flow
via Homebrew (see git-flow repo for instructions on other systems) brew install git-flow
Navigate to the git directory for your project and run:
git checkout -b develop
{ | |
"id": "http://jsonapi.org/schema#", | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "JSON API Schema", | |
"description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org", | |
"type": "object", | |
"resources":{ | |
"type": "array", | |
"items": { | |
"type": "object", |
{ | |
"type": "object", | |
"required": ["domains"], | |
"properties": { | |
"domains" : { | |
"type": "array", | |
"items": { | |
"type" : "object", | |
"required" : [ | |
"created_at", |
module ScopeConcern | |
extend ActiveSupport::Concern | |
included do | |
superclass.send(:define_singleton_method, "#{self.model_name.demodulize.underscore}_records") do | |
where(type: "#{self.class.name}") | |
end | |
end | |
end |
class DomainSerializer | |
attributes :id, :name | |
# Override publicly-exposed ID to actually be GUID | |
def id | |
self.guid | |
end | |
end | |
class RecordSerializer |
require 'rails_helper' | |
RSpec.describe 'Domains Requests' do | |
describe 'GET /api/domains/{id}' do | |
it 'responds with the requested domain' do | |
domain = FactoryGirl.create(:domain) | |
get api_domain_path(domain) |
= field_set_tag do | |
= f.input :title, placeholder: 'Friendly Name', required: true, disabled: (f.object.title.present?) | |
= field_set_tag 'IP Address Range' do | |
= f.input :starts_with, placeholder: 'IPv4 Address', required: true, as: :string | |
= f.input :ends_with, placeholder: 'IPv4 Address', required: true, as: :string | |
= field_set_tag 'Assessment Scope' do | |
= f.association :assessment_scope, collection: @account.assessment_scopes, required: true |
module GuidConcern | |
extend ActiveSupport::Concern | |
included do | |
before_validation :set_guid!, on: :create, if: :has_guid_concern? | |
validate :guid_concern_validator, if: :has_guid_concern? | |
end | |
module ClassMethods | |
def displayed_with_guid(options={}) |
section.details dl { | |
$modal-detail-header-color: $blue !default; | |
$modal-detail-header-weight: 100 !default; | |
$modal-detail-body-bg-color: #FFF !default; | |
$modal-detail-body-padding: rem-calc(10) !default; | |
dt { | |
color: $modal-detail-header-color; | |
font-weight: $modal-detail-header-weight; |
module Tradesman | |
module Controller | |
class ApiResponder < ActionController::Responder | |
SerializerWrapper = Struct.new(:serializer, :object) do | |
def serializable_hash(options={}) | |
instance = serializer.new(object, options) | |
if instance.respond_to?(:serializable_hash) | |
instance.serializable_hash |