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

Add lookup rest api #51

Merged
merged 3 commits into from
Sep 16, 2016
Merged

Add lookup rest api #51

merged 3 commits into from
Sep 16, 2016

Conversation

enilsen16
Copy link
Contributor

@enilsen16 enilsen16 commented Sep 12, 2016

Merges ex_twilio_lookup into ex_twilio. Thanks for the help @danielberkompas

Copy link
Owner

@danielberkompas danielberkompas left a 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}
Copy link
Owner

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
Copy link
Owner

@danielberkompas danielberkompas Sep 16, 2016

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__)
Copy link
Owner

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)

@enilsen16
Copy link
Contributor Author

Should be good to go now. Thanks!

@danielberkompas danielberkompas merged commit 6d9392d into danielberkompas:master Sep 16, 2016
@danielberkompas
Copy link
Owner

⭐ ⭐ ⭐

@enilsen16 enilsen16 deleted the lookup_api branch September 16, 2016 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants