-
Notifications
You must be signed in to change notification settings - Fork 4
Upgrade 2.5 api #14
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
base: master
Are you sure you want to change the base?
Upgrade 2.5 api #14
Conversation
| alias Recurly.{Resource, Adjustment, Account, Invoice, Subscription} | ||
|
|
||
| @account_endpoint "/accounts/<%= account_code %>/adjustments" | ||
| @invoice_endpoint "/invoices/<%= invoice_number %>/adjustments" |
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.
Seems to be two streamable endpoints now. How should that be handled?
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.
There is probably a much cleaner way to implement, but this is how I'd imagine the interface to work:
def stream(options) do
keys = Keyword.keys(options)
cond do
:account_code in keys ->
{account_code, options} = Keyword.pop_first(options, :account_code)
Resource.stream(Adjustment, account_path(account_code), options)
:invoice_number in keys ->
{invoice_number, options} = Keyword.pop_first(options, :invoice_number)
Resource.stream(Adjustment, invoice_path(invoice_number), options)
end
end
# examples:
stream(account_code: "myaccount", order: :desc)
stream(invoice_number: "1001", order: :asc)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.
Your read_only markings look correct. Anything other questions you need answered to finish this?
| alias Recurly.{Resource, Adjustment, Account, Invoice, Subscription} | ||
|
|
||
| @account_endpoint "/accounts/<%= account_code %>/adjustments" | ||
| @invoice_endpoint "/invoices/<%= invoice_number %>/adjustments" |
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.
There is probably a much cleaner way to implement, but this is how I'd imagine the interface to work:
def stream(options) do
keys = Keyword.keys(options)
cond do
:account_code in keys ->
{account_code, options} = Keyword.pop_first(options, :account_code)
Resource.stream(Adjustment, account_path(account_code), options)
:invoice_number in keys ->
{invoice_number, options} = Keyword.pop_first(options, :invoice_number)
Resource.stream(Adjustment, invoice_path(invoice_number), options)
end
end
# examples:
stream(account_code: "myaccount", order: :desc)
stream(invoice_number: "1001", order: :asc)|
@blatyo Do you have time to keep working on this? If not, I'll pick up the last commit. |
|
@bhelx Sorry, the approach I took changed for me. It turned out we didn't immediately need any new features. Mostly just support for existing endpoints that weren't setup. These are the changes I'm running with in production at the moment. master...blatyo:master You're definitely welcome to take this PR over. The remaining bits of our Recurly integration got reprioritized, so I'm focused elsewhere. |
|
@blatyo thanks. It's no problem. I'll pick up this PR then see what else I can do. I have the feeling I can get this library up to 2.9 without implementing everything. |
|
@bhelx This is a really nice library! Are there any plans on continuing with the update to API version 2.9? Or maybe even upgrading it to 2.19? |
|
@iurimadeira I check the logs on the server side from time to time looking for this library's user agent. I wasn't aware anyone was using the library so I stopped improving it. Happy to take any PRs you want to apply. It shouldn't be too hard to get it up to date. |
Figured I'd do the update incrementally. These are all the API changes listed for 2.5. The ones not checked off, I wasn't sure what to do with. I'm also not sure I'm correctly applying
read_only. How can I tell if a field is read only?Route changes:
Request and Response Changes:
<started_with_gift>element.<converted_at>element.<updated_at>element.<id>element.<subtotal_after_discount_in_cents>element.<attempt_next_collection_at>element.<recovery_reason>element.<all_line_items>link when invoice response only shows first 500 line items.<gateway_type>element.<origin>element.<description>element.<message>element.<approval_code>element.<collected_at>element.<has_live_subscription>element.<has_active_subscription>element.<has_future_subscription>element.<has_canceled_subscription>element.<has_past_due_invoice>element.<product_code>element.<product_code>element.<currency>element. This change affects all versions of the API.<currency>element. This change affects all versions of the API.