-
Notifications
You must be signed in to change notification settings - Fork 27
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
conflicting versions of JSON gem #10
Comments
maybe because of this line: Should probably update it. I dunno why it is left at 1.5.1 |
Hey @zdman135, @TrevorHinesley are you still using this gem? if not, what are you using? Any recommendations? Thank you! |
@nicobrenner Which gem / solution did you end up using? |
@codesoda ended up writing some code to use the API directly and created a job in Rails to handle that. Here's some sample code, hope it helps: class HubspotLeadsProcess
extend Resque::Plugins::Retry
@queue = :hubspot_leads_process
def self.perform(fullname, phone, email, company, source, employees)
post_to_hubspot(fullname, phone, email, company, source, employees)
end
def self.post_to_hubspot(fullname, phone, email, company, source, employees)
fullname_array = fullname.split(' ', 2)
firstname = fullname_array[0]
lastname = fullname_array[1]
properties = { properties: [ { property: 'email', value: email },
{ property: 'firstname', value: firstname },
{ property: 'lastname', value: lastname },
{ property: 'company', value: company },
{ property: 'employees', value: employees },
{ property: 'phone', value: phone },
{ property: 'source', value: source } ] }
url = "https://api.hubapi.com/contacts/v1/contact/?" \
"access_token=#{access_token}"
uri = URI.parse(url)
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request.body = JSON.dump(properties)
response = Net::HTTP.start(uri.hostname,
uri.port,
use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
response
end
end |
The text was updated successfully, but these errors were encountered: