Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

IncomingPhoneNumberList doesn't set requestAccountSid on its instances #36

Open
skimbrel opened this issue Jun 16, 2014 · 3 comments
Open

Comments

@skimbrel
Copy link
Contributor

So the following does not work:

TwilioRestClient client = TwilioAPI.getDefaultClient();
Map<String, String> params = new Map<String, String>();
params.put('PhoneNumber', '<some number>');
TwilioIncomingPhoneNumber phone = client.getAccount().getIncomingPhoneNumbers(params).getPageData()[0];
phone.updateResource(new Map<String, String>{'VoiceUrl' => 'http://example.com'});

Adding a call to phone.setRequestAccountSid('AC123') before calling updateResource() makes this work. List resources should be doing this in their parseResponse methods so that updating their instance elements works. Should audit all of the other resources when we fix this.

@ghost
Copy link

ghost commented Jun 16, 2014

Thanks for the workaround @skimbrel. Is there a chance that updating any other resource could get the same bug?

@skimbrel
Copy link
Contributor Author

Yes, that's very much possible — if an instance resource class is using this.getRequestAccountSid() to build its update URL and it was constructed via a codepath that doesn't do setRequestAccountSid() it will fail. We'll audit the library to make sure all of the internal codepaths that generate instance-resource objects are doing the right thing.

@ghost
Copy link

ghost commented Jun 16, 2014

I'll take it into account. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant