This is a list of issues or discrepencies between the wording or intention of PSR-2 itself and the CodeSniffer PSR-2 ruleset.
Add suggestions in the comments or tweet me (@philsturgeon) if you have more inconsistencies to report.
This is a list of issues or discrepencies between the wording or intention of PSR-2 itself and the CodeSniffer PSR-2 ruleset.
Add suggestions in the comments or tweet me (@philsturgeon) if you have more inconsistencies to report.
source 'https://rubygems.org' | |
gem 'faraday' | |
gem 'net-http-persistent' | |
gem 'typhoeus' | |
gem 'patron' | |
gem 'httpclient' | |
gem 'net-http2' |
Hey, I’m super lost.
Currently im trying to make API Flow work:
There is an output.json which is a test case, and accoring to Postmans JSON Schema it is invalid.
I'm fixing a few (headers cannot have a null value) but the auth section is triggering errors. It looks like this:
class Api::V3::CompanyPresenter | |
attr_accessor :company, :includes | |
def initialize(company, includes: []) | |
@company = company | |
@includes = Array(includes) | |
end | |
def as_json | |
{ |
Taken verbatim from https://www.congress.gov/bill/114th-congress/house-bill/2029/text
TITLE <<NOTE: Visa Waiver Program Improvement and Terrorist Travel
Prevention Act of 2015.>> II--TERRORIST TRAVEL PREVENTION AND VISA
WAIVER PROGRAM REFORM
SEC. 201. <<NOTE: 8 USC 1101 note.>> SHORT TITLE.
This title may be cited as the ``Visa Waiver Program Improvement and
Terrorist Travel Prevention Act of 2015''.
bundle exec rspec | grep -ohi 'rspec \./[^\:]*' | sed -e 's/^rspec //' | while read f; do [[ -a "$f" ]] && git rm "$f"; done |
Modifying a global resource can feel a bit weird, but essentially as an authorized user, you are looking at your customized representation of the resource, and not just a direct 1:1 of whats in the database.
PATCH /bars/123
with field liked: true
PATCH /bars/123
with field liked: false
This can feel a bit weird if you consider it as corrupting the global value, but headers often change the response and that's probably fine. It can be weird to show different attributes depending on the user (I avoid this) but you can probably jam it in meta
as the JSON-API allows this already? It's relevant data, just not necessairily part of the resource.
As somebody who's built APIs with PHP since 2009, and built APIs with Rails for the last two years, the contrast in some of the tooling available is mind-blowing. When it comes to factories for generating test data, spec-driven testing with tools like RSpec, mutation testing, simplistic state machines, serialization and deserialization in JSON-API, REPL debugging with breakpoints, file upload handlers, etc., Ruby (and Rails) very often has a strong lead in maturity of the tooling.
Objectively speaking, PHP either does not have some of these tools, or they're immature in comparison. This is by no means a fault of PHP as a language or a community. Ruby has had Gems for far longer than PHP has had Composer, and while PHP is starting to learn how to get this done in a post-framework-everything world, it has a way to go.
This talk looks at some of the cool stuff Ruby can do, and some of the lesser known tools that provide similar functionality in PHP.
<?php | |
class Example | |
{ | |
public $number; | |
public $text; | |
public function __construct(int $number, string $text) | |
{ | |
$this->number = $number; |