recurly-client-ruby icon indicating copy to clipboard operation
recurly-client-ruby copied to clipboard

How to get a count of returned subscriptions

Open noctivityinc opened this issue 4 years ago • 4 comments

Warning: Github issues are not an official support channel for Recurly. If you have an urgent request we suggest you contact us through an official channel: [email protected] or https://recurly.zendesk.com

When we use the list_subscriptions method, like this:

subscriptions = RECURLY_CLIENT.list_subscriptions

How can we get a COUNT of the number of results returned? It's not in API response (which is odd) and if we try subscriptions.count we get an error.

The only way I can see is to loop through all the results with a counter, which is highly inefficient.

noctivityinc avatar Mar 18 '21 12:03 noctivityinc

According to the README, it SHOULD work, so this might be a bug...

3.0.0 :019 > accounts = RECURLY_CLIENT.list_accounts
 => #<Recurly::Pager:0x00007f911682ce78 @client=#<Recurly::Client:0x00007f9117bcc118 @api_key="91d6c5883cbb46cf8c9110f73ac2bce2...
3.0.0 :020 > accounts.count
Traceback (most recent call last):
        1: from (irb):20:in `<main>'
ArgumentError (wrong number of arguments (given 2, expected 1))
3.0.0 :021 >

noctivityinc avatar Mar 18 '21 13:03 noctivityinc

This is definitely related to Ruby 3.0. Thanks

noctivityinc avatar Mar 18 '21 15:03 noctivityinc

@noctivityinc, you're correct that this was missed in the changes for ruby 3.0.0. We'll get this fixed right away.

douglasmiller avatar Mar 18 '21 15:03 douglasmiller

Thank you. Ill keep pointing out more issues along that line that we encounter.

On Thu, Mar 18, 2021 at 11:39 AM Douglas Miller @.***> wrote:

@noctivityinc https://github.com/noctivityinc, you're correct that this was missed in the changes for ruby 3.0.0. We'll get this fixed right away.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/recurly/recurly-client-ruby/issues/677#issuecomment-802029223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATIAWJPKL34LOLOSX3Y7DTEINCVANCNFSM4ZMSJGHQ .

noctivityinc avatar Mar 18 '21 15:03 noctivityinc