Skip to content
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

Get external sub by uuid #911

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/recurly/external_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ExternalSubscription < Resource

define_attribute_methods %w(
account
uuid
external_id
external_product_reference
quantity
Expand Down Expand Up @@ -53,5 +54,9 @@ def get_external_payment_phase(external_payment_phase_uuid)
def self.find_by_external_id(external_id)
self.find("external-id-#{external_id}")
end

def self.find_by_uuid(uuid)
self.find("uuid-#{uuid}")
end
end
end
1 change: 1 addition & 0 deletions spec/fixtures/accounts/external_subscriptions/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Content-Type: application/xml; charset=utf-8
<external_invoices href="https://api.recurly.com/v2/external_subscriptions/sdam2lfeop3e/external_invoices"/>
<external_payment_phases href="https://api.recurly.com/v2/external_subscriptions/sdam2lfeop3e/external_payment_phases"/>
<external_id>1234abcd</external_id>
<uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>
<external_product_reference nil="nil"></external_product_reference>
<last_purchased nil="nil"></last_purchased>
<auto_renew type="boolean">false</auto_renew>
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/external_subscriptions/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Content-Type: application/xml; charset=utf-8
<external_invoices href="https://api.recurly.com/v2/external_subscriptions/sdam2lfeop3e/external_invoices"/>
<external_payment_phases href="https://api.recurly.com/v2/external_subscriptions/sdam2lfeop3e/external_payment_phases"/>
<external_id>external-id</external_id>
<uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>
<external_product_reference>
<id>sd1eheqcn5a2</id>
<reference_code>1234</reference_code>
Expand Down
2 changes: 2 additions & 0 deletions spec/recurly/external_subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
created_at: "2019-08-24T14:15:22Z",
updated_at: "2019-08-24T14:15:22Z"
),
uuid: "72bb9966bb5dc3767461ce4368a6b366",
quantity: 1,
activated_at: "2022-11-07 17:08:18",
created_at: "2022-11-07 17:08:18",
Expand Down Expand Up @@ -75,6 +76,7 @@
<trial_ends_at>2022-11-14 17:08:18</trial_ends_at>\
<trial_started_at>2022-11-07 17:08:18</trial_started_at>\
<updated_at>2022-11-07 17:08:18</updated_at>\
<uuid>72bb9966bb5dc3767461ce4368a6b366</uuid>\
</external_subscription>
XML
end
Expand Down
Loading