-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add lookup rest api #51
Add lookup rest api #51
Conversation
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.
Sorry for how long it took me to get to this. It's pretty close, just a couple more changes needed.
|
||
- [Twilio docs](https://www.twilio.com/docs/api/lookups) | ||
""" | ||
alias ExTwilio.{Parser, Api, Config} |
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.
You don't use the Api
module, I don't think. So, no need to alias it here.
national_format: nil, | ||
phone_number: nil, | ||
country_code: nil, | ||
add_ons: nil |
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.
I think I would rather see this struct nested inside a submodule, like this:
defmodule PhoneNumber do
defstruct url: nil,
carrier: nil,
national_format: nil,
phone_number: nil,
country_code: nil,
add_ons: nil
end
This way, a list of ExTwilio.Lookup.PhoneNumber
structs could be returned rather than a list of ExTwilio.Lookup
structs.
|
||
"#{@base_url}#{phone_number}#{query_string}" | ||
|> HTTPoison.get!([], [hackney: auth]) | ||
|> Parser.parse(__MODULE__) |
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.
After nesting the struct under a submodule, you would need to update this to:
|> Parser.parse(PhoneNumber)
Should be good to go now. Thanks! |
⭐ ⭐ ⭐ |
Merges ex_twilio_lookup into ex_twilio. Thanks for the help @danielberkompas