Permalink
Commits on Apr 11, 2018
  1. Bump version to 3.13.0

    brandur committed Apr 11, 2018
  2. Merge pull request #634 from stripe/alexander/flexible-billing

    brandur-stripe committed Apr 11, 2018
    Flexible/Metered Billing API support
  3. flexible billing primitives and tests

    alexander-stripe committed Apr 4, 2018
Commits on Apr 10, 2018
  1. Merge pull request #638 from stripe/brandur-stripe-mock-v0.12.0

    brandur-stripe committed Apr 10, 2018
    Upgrade `stripe-mock` to v0.12.0
  2. Fix one test that was incorrectly expecting a non-deleted object back

    brandur committed Apr 10, 2018
  3. Upgrade `stripe-mock` to v0.12.0

    brandur committed Apr 10, 2018
    The most important changes here are that deleted objects are now
    represented more accurately, and that IDs used in URLs are "reflected"
    back into responses so that test suites can treat return objects a
    little more realistically than they could before.
    
    This should resolve incompatibilities between `stripe-ruby` and newer
    versions of `stripe-mock`.
Commits on Apr 5, 2018
  1. Bump version to 3.12.1

    brandur committed Apr 5, 2018
  2. Merge pull request #636 from stripe/brandur-initialize-instance-var

    brandur-stripe committed Apr 5, 2018
    Initialize instance variable on the getter too
  3. Initialize instance variable on the getter too

    brandur committed Apr 5, 2018
    The test suite is currently throwing a bunch of warnings from some
    recent changes I made -- although we initialize `@additive_params` when
    setting one with `self.additive_object_param`, we don't when we check
    one with `self.additive_object_param?`. This often isn't a problem
    because every API resource sets `metadata`, but it is from the test
    suite and probably for vanilla `StripeObject`s too.
  4. Bump version to 3.12.0

    brandur committed Apr 5, 2018
  5. Merge pull request #632 from stripe/brandur-only-empty-metadata

    brandur-stripe committed Apr 5, 2018
    Fix replacement of non-`metadata` embedded `StripeObjects`
  6. Now that most hashes are non-additive, remove hack on subscription items

    brandur committed Apr 5, 2018
    See the discussion here: #632
  7. Introduce `additive_object_param` for use with `metadata`

    brandur committed Apr 4, 2018
Commits on Apr 3, 2018
  1. Fix replacement of non-`metadata` embedded `StripeObjects`

    brandur committed Apr 3, 2018
    So we have a bit of a problem right now when it comes to replacing a
    `StripeObject` that's embedded in an API resource.
    
    Most of the time when someone does this, they want to _replace_ an
    object embedded in another object. Take setting a source on a
    subscription for example:
    
    ``` ruby
    subscription.source = {
      object: 'card',
      number: 123,
    }
    subscription.save
    ```
    
    In the case above, the serialized parameters should come out as:
    
    ```
    source[object]=card&source[number]=123
    ```
    
    That should apply even if the previous source had something else set on
    it which we're not going to set this time -- say an optional parameter
    like `source[address_state]`. Those should not be present at all in the
    final serialized parameters.
    
    (Another example is setting a `payout_schedule` as seen in #631 which is
    PR is intended to address.)
    
    There is an exception to this rule in the form of metadata though.
    Metadata is a bit of a strange case in that the API will treat it as
    additive, so if we send `metadata[foo]`, that will set the `foo` key,
    but it won't overwrite any other keys that were already present.
    
    This is a problem because when a user fully sets `metadata` to a new
    object in Ruby, what they're probably trying to do is _replace_ it
    rather than add to it. For example:
    
    ``` ruby
    subscription.metadata
    => { old: 'bar' }
    
    subscription.metadata = {
      new: 'baz'
    }
    subscription.save
    ```
    
    To accomplish what the user is probably trying to do, we actually need
    to send `metadata[old]=&metadata[new]=baz` so that we empty the value of
    `old` while simultaneously setting `new` to `baz`.
    
    In summary, metadata behaves different from other embedded objects in a
    fairly fundamental way, and because the code is currently only set up to
    handle the metadata case, it's not behaving correctly when other types
    of objects are being set. A lot of the time emptying values like we do
    for `metadata` is benign, but as we've seen in #631, sometimes it's not.
    
    In this patch, I modify serialization to only empty out object values
    when we see that parameter is `metadata`.
    
    I'm really not crazy about the implementation here _at all_, but I'm
    having trouble thinking of a better way to do it. One possibility is to
    introduce a new class annotation like `empty_embedded_object :metadata`,
    but that will have to go everywhere and might be error-prone in case
    someone forgets it on a new resource type. If anyone has a suggestion
    for an alternative (or can let me know if I'm missing something), I'd
    love to hear it.
    
    This PR is an alternate to #631.
Commits on Feb 26, 2018
  1. Bump version to 3.11.0

    ob-stripe committed Feb 26, 2018
  2. Merge pull request #628 from stripe/ob-error-code

    ob-stripe committed Feb 26, 2018
    Add support for code attribute on all Stripe exceptions
Commits on Feb 23, 2018
  1. Add support for code attribute on all Stripe exceptions

    ob-stripe committed Feb 23, 2018
Commits on Feb 21, 2018
  1. Bump version to 3.10.0

    brandur committed Feb 21, 2018
  2. Merge pull request #627 from stripe/jkakar/topup-client

    brandur-stripe committed Feb 21, 2018
    Add support for /v1/topups endpoints
Commits on Feb 16, 2018
  1. Add support for /v1/topups endpoints.

    jkakar-stripe committed Feb 6, 2018
  2. Merge pull request #626 from stripe/jkakar/fix-product-issues

    jkakar-stripe committed Feb 16, 2018
    Upgrade to stripe-mock 0.8.0.
  3. Apply review feedback from @ob-stripe.

    jkakar-stripe committed Feb 16, 2018
  4. Fix broken test.

    jkakar-stripe committed Feb 16, 2018
Commits on Feb 12, 2018
  1. Bump version to 3.9.2

    ob-stripe committed Feb 12, 2018
  2. Merge pull request #625 from stripe/ob-skip-to-hash-for-nil

    ob-stripe committed Feb 12, 2018
    Skip calling to_hash for nil
  3. Skip calling to_hash for nil

    ob-stripe committed Feb 12, 2018
Commits on Dec 15, 2017
  1. Bump version to 3.9.1

    brandur committed Dec 15, 2017
Commits on Dec 14, 2017
  1. Merge pull request #616 from stripe/ob-file-duck-typing

    brandur-stripe committed Dec 14, 2017
    Use duck typing to detect File-like objects
  2. Use duck typing to detect File-like objects

    ob-stripe committed Dec 14, 2017
Commits on Dec 12, 2017
  1. Merge pull request #614 from stripe/ob-coveralls

    brandur-stripe committed Dec 12, 2017
    Add support for coveralls.io
Commits on Dec 9, 2017
  1. Add support for coveralls.io

    ob-stripe committed Dec 9, 2017
Commits on Dec 8, 2017
  1. Bump version to 3.9.0

    brandur committed Dec 8, 2017
  2. Merge pull request #613 from stripe/brandur-idempotency-error

    brandur-stripe committed Dec 8, 2017
    Introduce new `IdempotencyError` type
  3. A block and a class got longer so extend the exceptions for Rubocop

    brandur committed Dec 8, 2017
  4. Introduce new `IdempotencyError` type

    brandur committed Dec 8, 2017
    A few weeks back a new error type `idempotency_error` was introduced in
    the API. I put it in to respond to #503, but then forgot to add support
    for it in this library. This patch introduces a new exception class that
    represents it.