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

Create endpoints to find, create, update contact in Maropost #4

Merged
merged 6 commits into from
Sep 25, 2017

Conversation

serene
Copy link
Contributor

@serene serene commented Sep 25, 2017

No description provided.

@rubene
Copy link
Member

rubene commented Sep 25, 2017

📖

Copy link

@jbabe jbabe left a 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.

def self.find(email)
url = "#{Maropost.configuration.api_url}/contacts/email.json?contact[email]=#{email}"

response = RestClient::Request.execute(
Copy link

@jbabe jbabe Sep 25, 2017

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.executes 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

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

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?

def self.find(email)
url = "#{Maropost.configuration.api_url}/contacts/email.json?contact[email]=#{email}"

response = RestClient::Request.execute(
Copy link
Member

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?

@rubene
Copy link
Member

rubene commented Sep 25, 2017

can you add a commit message with examples of the api calls

@rubene
Copy link
Member

rubene commented Sep 25, 2017

💩

@serene
Copy link
Contributor Author

serene commented Sep 25, 2017

👋

@rubene
Copy link
Member

rubene commented Sep 25, 2017

🐘 🐘 🐘

@serene serene merged commit 2976c93 into master Sep 25, 2017
@serene serene deleted the create_endpoints branch September 25, 2017 20:03
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.

4 participants