Skip to content

Commit

Permalink
get external sub by uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
amandamfielding committed Aug 27, 2024
1 parent e2bbdd4 commit 94d95c6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
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

0 comments on commit 94d95c6

Please sign in to comment.