Created
January 24, 2022 16:12
-
-
Save mrhead/bd321c2d237fcf4deb4f86eac5a52ef1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Clients::Convertkit | |
def tags | |
request(:get, "/tags")["tags"] | |
end | |
def get_subscriber_by_email(email:) | |
request(:get, "/subscribers", params: { email_address: email }) | |
end | |
end | |
integration = Integration.find(1274) | |
tags = integration.contract.client.tags.map { |t| t["id"].to_s } | |
missing_fields = integration.fields.reject do |field| | |
field.resource_id.in?(tags) | |
end | |
integration.contract.client.get_subscriber_by_email(email: profile.email) | |
integration.contract.client.get_subscriber_by_email(email: profile.member.email) | |
missing_profiles = integration.profiles.select do |profile| | |
begin | |
integration.contract.client.get_subscriber(id: profile.resource_id) | |
print "." | |
sleep 1 | |
true | |
rescue Clients::Error => e | |
puts "ERROR" | |
puts "message: #{e.message}" | |
puts "status_code: #{e.status_code}" | |
puts "response: #{e.response}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment