Given an object has an owner
association (relation), when expanded by default it will be exposed as:
{
"name": "service-production",
"owner": {
"id": "5d8201b0...",
"name": "Alice",
"email": "[email protected]"
},
class NameFormat | |
attr_reader :first_name, :last_name, :middle_name | |
def initialize(person) | |
@person = person | |
@first_name = person.first_name | |
@last_name = person.last_name | |
@middle_name = person.middle_name |
Given an object has an owner
association (relation), when expanded by default it will be exposed as:
{
"name": "service-production",
"owner": {
"id": "5d8201b0...",
"name": "Alice",
"email": "[email protected]"
},
I'll use Stripe as an example. The client is responsible for:
Stripe::Request::Charge.get(id: 'sdfsdf')
)API_HOST='http://utilities.theklaibers.com' | |
CACHE_HOST='localhost:11211' |
cat *.json |\ | |
jq 'map(select(.from.name=="Nate Klaiber"))' |\ | |
jq '.[].message' |\ | |
grep -v 'jq' |\ | |
sed -e 's/\([[:punct:]]\)//g' |\ | |
grep -v '^$' |\ | |
tr '\n' ' ' |\ | |
tr ' ' '\n' |\ | |
tr '[:upper:]' '[:lower:]' |\ | |
sort |\ |
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
When working with API clients there are several distinct areas of concern. Each of these happen in sequence and are used with the goal of receiving a Domain Model at the end.
class FlatArray | |
instance_methods.each do |m| | |
undef_method(m) unless m =~ /(^__|^nil\?|^send$|^object_id$)/ | |
end | |
def initialize(array) | |
@target = array | |
end | |
def respond_to?(symbol, include_priv=false) |
I hereby claim:
To claim this, I am signing this object:
This is still in rough draft form. I will continue to make edits as I receive them. I will collate the list of feedback here and make notes of the changelog as revisions are made.
No string interpolation for building your routes to your resources.