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

conflicting versions of JSON gem #10

Open
TrevorHinesley opened this issue Nov 14, 2014 · 4 comments
Open

conflicting versions of JSON gem #10

TrevorHinesley opened this issue Nov 14, 2014 · 4 comments

Comments

@TrevorHinesley
Copy link

Bundler could not find compatible versions for gem "json":
  In Gemfile:
    r_hapi (>= 0) ruby depends on
      json (~> 1.5.1) ruby

    stripe (>= 0) ruby depends on
      json (1.8.1)
@zdman135
Copy link

maybe because of this line:
gem.add_runtime_dependency 'json', '>= 1.5.1'

Should probably update it. I dunno why it is left at 1.5.1

@nicobrenner
Copy link

Hey @zdman135, @TrevorHinesley are you still using this gem? if not, what are you using? Any recommendations?

Thank you!

@codesoda
Copy link

@nicobrenner Which gem / solution did you end up using?

@nicobrenner
Copy link

@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

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

No branches or pull requests

4 participants