Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated API Blueprint with stripecard #386

Merged
merged 1 commit into from
Oct 27, 2016

Conversation

amyschools
Copy link
Contributor

@amyschools amyschools commented Oct 24, 2016

Closes #385

Added endpoint and data structures for StripeCard.

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below are some questions and some suggested changes.

Did you try previewing the generated API Blueprint (at localhost:8081? I'm guessing it didn't render correctly due to syntax errors.

@@ -1533,7 +1533,6 @@ This resource identifies a relationship between a User and a Skill. For example,
+ Attributes (Record Not Found Response)

# Group Users

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like accidental removal of this line.

@@ -1690,6 +1689,50 @@ This endpoint allows you to check whether a username is valid (by running a vali

+ Attributes (Unprocessable Entity Response)

#StripeCard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have a space between # and StripeCard.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it looks like this breaks the alpha ordering convention.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to prefix with Group.

@@ -1690,6 +1689,50 @@ This endpoint allows you to check whether a username is valid (by running a vali

+ Attributes (Unprocessable Entity Response)

#StripeCard

This resource identifies the relationship between a StripeCustomer and a StripeCard. A StripeCustomer has many StripeCards and StripeCard belongs to a StripeCustomer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call this a relationship. This on its own is a resource.


This resource identifies the relationship between a StripeCustomer and a StripeCard. A StripeCustomer has many StripeCards and StripeCard belongs to a StripeCustomer.

## StripeCards [/stripe_cards]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be dasherized.

+ Parameters

+ id (number) - Id of StripeCard.
+stripe_customer_id(number) - ID of StripeCustomer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the stripe_customer_id to make a request to this endpoint.


+ Response 404 (application/vnd.api+json; charset=utf-8)

+ Attributes (Record Not Found Response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add in the 401 and 403 response since we know that this is authenticated and authorized.

##StripeCards (object)
+ data(StripeCards Resource)
+ include JSON API Version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the StripeCard Resource defined?

+ include JSON API Version

##StripeCards (object)
+ data(StripeCards Resource)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need a StripeCard Response and a StripeCards Response. Look at Categories as an example here.


+ Response 200 (application/vnd.api+json; charset=utf-8)

+ Attributes (StripeCards Response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is StripeCards Response defined?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 95.517% when pulling d438f21 on 385-apiblueprint-stripecard into da5867b on develop.

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these changes should be implemented inside of this PR.

Other comments, though, are simply suggestions for refactorings that could be placed in future issue(s).


## Stripe Cards [/stripe-cards]

### List all Stripe Cards [GET]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would change Cards to cards here.


## Stripe Card [/stripe-cards/{id}]

### Retrieve a Stripe Card [GET]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would change to lowercase card.


+ Parameters

+ id (number) - Id of a Stripe card.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we're inconsistent in other endpoints about whether or not we have an id parameter on GET requests for the show actions. I'm not sure if we should open another issue for this, but we might want to consider it to make everything consistent across our entire documentation.


+ Response 403 (application/vnd.api+json; charset=utf-8)

+ Attributes (Forbidden Response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to consider opening an issue about the security implications of returning a 401 or 403 vs just a 404 to say that the object doesn't exist, so people don't sneak around trying to find extra information about cards in our API somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an issue for this: #392

I wasn't sure how to reference this comment specifically.

+ `pass`
+ `fail`
+ `unavailable`
+ `unchecked`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's no default value here. Not sure we should specify, but I guess if we don't the assumption should be that there is no default.

+ `unavailable`
+ `unchecked`
+ exp_month: `12` (number)
+ exp_year: `2017` (number)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an integer in #377 inside the database schema?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't think this value needs backticks around it if it's just an integer. Not sure, but we should check some of the other examples.

+ attributes(Stripe Card Attributes)
+ relationships(Stripe Card Relationships)
+ `project-categories`
+ data(array[Project Category Resource Identifier])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely missed this project-categories inside of here.


## Stripe Customer Resource Identifier (object)
+ id: `1` (string, required)
+ type: `stripe-customer`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's some inconsistency across our responses here. id and type should both be required.

Given some of the inconsistencies we're identifying here that stem from this blueprint not being significantly refactored after the changeover from Rails, I think we should open a parent journey issue that contains all of these suggestions for refactoring/fixes. Then we can break off into individual issues where needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added issue for this: #393

@amyschools amyschools changed the title updated api.apib with stripecard updated API Blueprint with stripecard Oct 25, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 95.517% when pulling 743147d on 385-apiblueprint-stripecard into 1b42ff1 on develop.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.205% when pulling 743147d on 385-apiblueprint-stripecard into 1b42ff1 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 95.017% when pulling 6cdf336 on 385-apiblueprint-stripecard into f7f764f on develop.

@joshsmith
Copy link
Contributor

Ignore coveralls here. I don't know why it's saying test coverage went down. Nonsense.

@joshsmith
Copy link
Contributor

I haven't checked if this renders. Does this still render correctly for you?

Good work! 🎉

@joshsmith
Copy link
Contributor

Before you can merge, you'll need to rebase and squash your commits into one.

Your reworded commit message should probably read something like:

Add API Blueprint documentation for StripeCard

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed something I'd missed here previously.

+ exp_year: 2017 (number)
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string)
+ last4: `4242` (string)
+ name: `John Doe` (string) - Cardholder name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is missing inserted-at and updated-at timestamps, which actually all objects in our database will have.

@amyschools
Copy link
Contributor Author

It was rendering earlier when i tried to push it, but won't anymore - I think it might be because of the stripe auth stuff that was added when we rebased?

@@ -2293,6 +2293,8 @@ This endpoint allows you to check whether a username is valid (by running a vali
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string)
+ last4: `4242` (string)
+ name: `John Doe` (string) - Cardholder name
+ `inserted-at`: `2014-07-07T18:01:26.000Z` (string)
+ `updated-at`: `2014-07-07T18:01:26.000Z` (string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch the alpha ordering here.

@@ -1961,7 +2021,6 @@ This endpoint allows you to check whether a username is valid (by running a vali
## Preview Resource Identifier (object)
+ id: `1` (string, required)
+ type: `preview` (string, required)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like accidental deletion here

@@ -2209,6 +2268,59 @@ This endpoint allows you to check whether a username is valid (by running a vali
+ data(Stripe Auth Resource)
+ include JSON API Version

## StripeCard (object)
+ data(StripeCard Resource)
+ include JSON API Version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is why rendering is failing. Probably should be Stripe Card and not StripeCard.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, no. This shouldn't even exist. Not sure what this is doing here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still why it's failing. Trying to hit a StripeCard Resource that doesn't exist.

+ `unchecked`
+ exp_month: 12 (number)
+ exp_year: 2017 (number)
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think these attributes should be dasherized, and surrounded by ` marks.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.515% when pulling 16ad395 on 385-apiblueprint-stripecard into f7f764f on develop.


This resource identifies a card created on the [Stripe API](https://stripe.com/docs/api#cards).

A Stripe card belongs to a Stripe customer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we changed this now in our system to say that it belongs to a user. Belonging to a customer (for us) is some unnecessary complexity.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 95.017% when pulling 23848c7 on 385-apiblueprint-stripecard into f7f764f on develop.

@joshsmith
Copy link
Contributor

Squash and rebase.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.017% when pulling ab53c82 on 385-apiblueprint-stripecard into 36236be on develop.

@@ -2511,6 +2571,59 @@ This endpoint allows you to check whether a username is valid (by running a vali
+ data(array[Stripe Plan Resource], required)
+ include JSON API Version

## Stripe Card (object)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to put these above Stripe plans.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not showing up in alpha order from the most recent commit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't show up for me randomly.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 95.515% when pulling 4d70a80 on 385-apiblueprint-stripecard into 36236be on develop.

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, a couple notes here.

@@ -2714,6 +2714,8 @@ This endpoint allows you to check whether a username is valid (by running a vali
+ data(array[User Role Resource Identifier])
+ `user-skills` (object)
+ data(array[User Skill Resource Identifier])
+ `stripe-cards` (object)
+ data(array[Stripe Card Resource Identifier])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch alpha order here.

@@ -2624,6 +2597,33 @@ This endpoint allows you to check whether a username is valid (by running a vali
+ id: `1` (string, required)
+ type: `stripe-customer`

## Stripe Plan Attributes (object)
+ amount: 999 (number) - Describes the amount of a plan in cents.
+ created: `2016-07-08T03:03:51.967Z` (string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write that this is the created time from Stripe. Did we do this in #383?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From 383:
+ *created- A timestamp, indicating when the plan was created by Stripe
I'll add the comment into this also.

@joshsmith
Copy link
Contributor

Didn't mean to approve that one. It should have been requested changes.

@joshsmith
Copy link
Contributor

And that one comment should not be showing as outdated, so make sure you expand that.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.017% when pulling cf91a38 on 385-apiblueprint-stripecard into 36236be on develop.

@joshsmith
Copy link
Contributor

@amyschools looks great, go ahead and squash again!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.082% when pulling c4204c0 on 385-apiblueprint-stripecard into a98bf75 on develop.

@amyschools amyschools merged commit 98b3bbd into develop Oct 27, 2016
@amyschools amyschools deleted the 385-apiblueprint-stripecard branch October 27, 2016 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants