-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create endpoints to find, create, update contact in Maropost #4
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.
I have a comment about RestClient requests but I'll leave this for someone else to review cause I have meetings this morning.
lib/maropost/api.rb
Outdated
def self.find(email) | ||
url = "#{Maropost.configuration.api_url}/contacts/email.json?contact[email]=#{email}" | ||
|
||
response = RestClient::Request.execute( |
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.
hey Serene...we've wrapped RestClient
requests to do some additional logging (https://rubygems.org/gems/rest-client-jogger)...could you update these RestClient::Request.execute
s to use that? Here's an example (but @jessedoyle might be able to let you know how we are doing it in the new DE app):
https://github.com/amaabca/ama_oauth_client/blob/master/lib/ama_oauth_client/sudo_mode/model.rb#L5
Then to get the logging you just have to add this to the app (if it isn't there already):
RestClient::Jogger::EventSubscriber.new.subscribe
lib/maropost/api.rb
Outdated
url: url, | ||
payload: { auth_token: Maropost.configuration.auth_token }.to_json, | ||
headers: { content_type: 'application/json', accept: 'application/json' }, | ||
verify_ssl: OpenSSL::SSL::VERIFY_NONE |
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.
can we also change this (and the other calls) to verify SSL?
lib/maropost/api.rb
Outdated
def self.find(email) | ||
url = "#{Maropost.configuration.api_url}/contacts/email.json?contact[email]=#{email}" | ||
|
||
response = RestClient::Request.execute( |
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.
this is repeated for each method can this be extracted to a method that takes the url, payload, and method?
can you add a commit message with examples of the api calls |
💩 |
👋 |
🐘 🐘 🐘 |
No description provided.