SimpleHubspot Gem is a pure light-weight implementation for Hubspot API
Add this line to your application's Gemfile:
gem 'simple_hubspot'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple_hubspot
require 'simple_hubspot'
Setting your hapikey
you can create a new file in initializers from Rails
rails g simple_hubspot:install
SimpleHubspot.configure do |config|
config.hapikey= "YOUR API KEY"
end
SimpleHubspot::Contact.create_or_update "[email protected]", { name: "John", age: 14, country: 'BRAZIL' }
SimpleHubspot::Contact.find_by_email "[email protected]"
SimpleHubspot::Contact.update 1234, { email: "[email protected]" }
payload = { email: '[email protected]',
property_one: 'value 1',
property_two: 'value 2',
hs_context: { hutk: '60c2ccdfe4892f0fa0593940b12c11aa',
ipAddress: '127.0.0.10',
pageUrl: 'http://demo.hubapi.com/contact/',
pageName: 'Contact Us' } }
SimpleHubspot::Form.submit_form 'FORM_GUID', payload
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
- Fork it ( https://github.com/[my-github-username]/simple_hubspot/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request