-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add response iteration and conversion #129
Conversation
Returns the Stripe response mapping of keys to types. | ||
""" | ||
@spec response_mapping :: Keyword.t | ||
def response_mapping, do: @response_mapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, I think coveralls skips over single-line defs for coverage analysis
``` | ||
{:ok, resp} = Stripe.Connect.Oauth.token(code) | ||
|
||
IO.inspect resp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't want this in released code 💣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavidAntaramian this is just a code example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless what you're saying is that the above renders the below? It might be better to indicate with an
iex> {:ok, resp} = Stripe.Connect.OAuth.token(code)
...> IO.inspect resp
%Stripe.Connect.OAuth.TokenResponse{...}
example
fingerprint: :string, | ||
funding: :string, | ||
last4: :string, | ||
metadata: :metadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just specify this as :map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I chose :metadata
instead of map was to be explicit that it was just structureless data (from Stripe's perspective), and because convert_value
has a when is_map(format)
clause, which might make that confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha
84e1986
to
c8ab995
Compare
This PR reworks Stripe response handling to iterate over the response and convert necessary values.
This does not yet handle lists from Stripe nor take in options to push to Stripe.
Reduces scope of certain struct keys as a result.