nafizcristia98
Do³±czy³: 04 Mar 2024 Posty: 1
|
Wys³any: Pon Mar 04, 2024 09:08 Temat postu: Every possible response from the Stripe API is codified |
|
|
API resources define their possible fields using a DSL: class ChargeAPIResource required :id, String required :amount, Integer end API resources are written so that the structure they describe is what we’d expect back from the current version of the API. When we need to make a backwards-incompatible change, we encapsulate it in a version change module which defines doc Version changes are written so that they expect to be automatically applied backwards from the current API version and in order.
Each version change assumes that although newer changes may exist in front of them, the data they receive will look the same as when they were originally written. When generating a response, the API initially formats data by describing an API resource at the current version, then determines a target API version from one of: A Stripe Binance App Users Data Version header if one was supplied. The version of an authorized OAuth application if the request is made on the user’s behalf. The user’s pinned version, which is set on their very first request to Stripe. It then walks back through time and applies each version change module that finds along the way until that target version is reached. API versioning Requests are processed by version change modules before returning a response.
Version change modules keep older API versions abstracted out of core code paths. Developers can largely avoid thinking about them while they’re building new products. Changes with side effects Most of our backwards-incompatible API changes will modify a response, but that’s not always the case. Sometimes a more complicated change is necessary which leaks out of the module that defines it. We assign these modules a has_side_effects annotation and the transformation they define becomes a no-op: class LegacyTransfers < AbstractVersionChange description. _________________ Binance App Users Data |
|