Code Monkey home page Code Monkey logo

hubspot-ruby's Introduction

HubSpot REST API wrappers for ruby

Build Status

This is the master branch and contains unreleased and potentially breaking changes. If you are looking for the most recent stable release you want the v0-stable branch.

Wraps the HubSpot REST API for convenient access from ruby applications.

Documentation for the HubSpot REST API can be found here: https://developers.hubspot.com/docs/endpoints

Setup

gem install hubspot-ruby

Or with bundler,

gem "hubspot-ruby"

Getting Started

This library can be configured to use OAuth or an API key. To find the appropriate values for either approach, please visit the HubSpot API Authentication docs.

Below is a complete list of configuration options with the default values:

Hubspot.configure({
  hapikey: <HAPIKEY>,
  base_url: "https://api.hubapi.com",
  portal_id: <PORTAL_ID>,
  logger: Logger.new(nil),
  access_token: <ACCESS_TOKEN>,
  client_id: <CLIENT_ID>,
  client_secret: <CLIENT_SECRET>,
  redirect_uri: <REDIRECT_URI>,
  read_timeout: nil, # or :timeout to set read_timeout and open_timeout
  open_timeout: nil,
})

If you're new to using the HubSpot API, visit the HubSpot Developer Tools to learn about topics like "what's a portal id?" and creating a testing environment.

Authentication with an API key

To set the HubSpot API key, aka hapikey, run the following:

Hubspot.configure(hapikey: "YOUR_API_KEY")

If you have a HubSpot account, you can find your API key by logging in and visiting: https://app.hubspot.com/keys/get

Authentication with OAuth 2.0

Configure the library with the client ID and secret from your HubSpot App

Hubspot.configure(
    client_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    client_secret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    redirect_uri: "https://myapp.com/oauth")

To initiate an OAuth connection to your app, create a URL with the required scopes:

Hubspot::OAuth.authorize_url(["contacts", "content"])

After the user accepts the scopes and installs the integration with their HubSpot account, they will be redirected to the URI requested with the query parameter code appended to the URL. code can then be passed to HubSpot to generate an access token:

Hubspot::OAuth.create(params[:code])

To use the returned access_token string for authentication, you'll need to update the configuration:

Hubspot.configure(
    client_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    client_secret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    redirect_uri: "https://myapp.com/oauth",
    access_token: access_token)

Now all requests will use the provided access token when querying the API:

Hubspot::Contact.all

Refreshing the token

When you create a HubSpot OAuth token, it will have an expiration date given by the expires_in field returned from the create API. If you with to continue using the token without needing to create another, you'll need to refresh the token:

Hubspot::OAuth.refresh(refresh_token)

A note on OAuth credentials

At this time, OAuth tokens are configured globally rather than on a per-connection basis.

Usage

Classes have been created that map to Hubspot resource types and attempt to abstract away as much of the API specific details as possible. These classes generally follow the ActiveRecord pattern and general Ruby conventions. Anyone familiar with Ruby On Rails should find this API closely maps with familiar concepts.

Creating a new resource

irb(main):001:0> company = Hubspot::Company.new(name: "My Company LLC.")
=> #<Hubspot::Company:0x000055b9219cc068 @changes={"name"=>"My Company LLC."}, @properties={}, @id=nil, @persisted=false, @deleted=false>

irb(main):002:0> company.persisted?
=> false

irb(main):003:0> company.save
=> true

irb(main):004:0> company.persisted?
=> true
irb(main):001:0> company = Hubspot::Company.create(name: "Second Financial LLC.")
=> #<Hubspot::Company:0x0000557ea7119fb0 @changes={}, @properties={"hs_lastmodifieddate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceId"=>nil, "versions"=>[{"name"=>"hs_lastmodifieddate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "name"=>{"value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"name", "value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "createdate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"createdate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}, {"name"=>"createdate", "value"=>"1552234087467", "timestamp"=>1552234087467, "sourceId"=>"API", "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}}, @id=1726317857, @persisted=true, @deleted=false, @metadata={"portalId"=>62515, "companyId"=>1726317857, "isDeleted"=>false, "additionalDomains"=>[], "stateChanges"=>[], "mergeAudits"=>[]}>

irb(main):002:0> company.persisted?
=> true

Find an existing resource

Note: Hubspot uses a combination of different names for the "ID" property of a resource based on what type of resource it is (eg. vid for Contact). This library attempts to abstract that away and generalizes an id property for all resources

irb(main):001:0> company = Hubspot::Company.find(1726317857)
=> #<Hubspot::Company:0x0000562e4988c9a8 @changes={}, @properties={"hs_lastmodifieddate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceId"=>nil, "versions"=>[{"name"=>"hs_lastmodifieddate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "name"=>{"value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"name", "value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "createdate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"createdate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}}, @id=1726317857, @persisted=true, @deleted=false, @metadata={"portalId"=>62515, "companyId"=>1726317857, "isDeleted"=>false, "additionalDomains"=>[], "stateChanges"=>[], "mergeAudits"=>[]}>

irb(main):002:0> company = Hubspot::Company.find(1)
Traceback (most recent call last):
        6: from /home/chris/projects/hubspot-ruby/bin/console:20:in `<main>'
        5: from (irb):2
        4: from /home/chris/projects/hubspot-ruby/lib/hubspot/resource.rb:17:in `find'
        3: from /home/chris/projects/hubspot-ruby/lib/hubspot/resource.rb:81:in `reload'
        2: from /home/chris/projects/hubspot-ruby/lib/hubspot/connection.rb:10:in `get_json'
        1: from /home/chris/projects/hubspot-ruby/lib/hubspot/connection.rb:52:in `handle_response'
Hubspot::RequestError (Response body: {"status":"error","message":"resource not found","correlationId":"7c8ba50e-16a4-4a52-a304-ff249175a8f1","requestId":"b4898274bf8992924082b4a460b90cbe"})

Updating resource properties

irb(main):001:0> company = Hubspot::Company.find(1726317857)
=> #<Hubspot::Company:0x0000563b9f3ee230 @changes={}, @properties={"hs_lastmodifieddate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceId"=>nil, "versions"=>[{"name"=>"hs_lastmodifieddate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"CALCULATED", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "name"=>{"value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"name", "value"=>"Second Financial LLC.", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}, "createdate"=>{"value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceId"=>nil, "versions"=>[{"name"=>"createdate", "value"=>"1552234087467", "timestamp"=>1552234087467, "source"=>"API", "sourceVid"=>[], "requestId"=>"fd45773b-30d0-4d9d-b3b8-a85e01534e46"}]}}, @id=1726317857, @persisted=true, @deleted=false, @metadata={"portalId"=>62515, "companyId"=>1726317857, "isDeleted"=>false, "additionalDomains"=>[], "stateChanges"=>[], "mergeAudits"=>[]}>

irb(main):002:0> company.name
=> "Second Financial LLC."

irb(main):003:0> company.name = "Third Financial LLC."
=> "Third Financial LLC."

irb(main):004:0> company.changed?
=> true

irb(main):005:0> company.changes
=> {:name=>"Third Financial LLC."}

irb(main):006:0> company.save
=> true

irb(main):007:0> company.changed?
=> false

irb(main):008:0> company.changes
=> {}

Note: Unlike ActiveRecord in Rails, in some cases not all properties of a resource are known. If these properties are not returned by the API then they will not have a getter method defined for them until they've been set first. This may change in the future to improve the user experience and different methods are being tested.

irb(main):001:0> company = Hubspot::Company.new
=> #<Hubspot::Company:0x0000561d0a8bdff8 @changes={}, @properties={}, @id=nil, @persisted=false, @deleted=false>

irb(main):002:0> company.name
Traceback (most recent call last):
        3: from /home/chris/projects/hubspot-ruby/bin/console:20:in `<main>'
        2: from (irb):2
        1: from /home/chris/projects/hubspot-ruby/lib/hubspot/resource.rb:215:in `method_missing'
NoMethodError (undefined method `name' for #<Hubspot::Company:0x0000561d0a8bdff8>)

irb(main):003:0> company.name = "Foobar"
=> "Foobar"

irb(main):004:0> company.name
=> "Foobar"

Collections

To make working with API endpoints that return multiple resources easier, the returned instances will be wrapped in a collection instance. Just like in Rails, the collection instance provides helper methods for limiting the number of returned resources, paging through the results, and handles passing the options each time a new API call is made. The collection exposes all Ruby Array methods so you can use things like size(), first(), last(), and map().

irb(main):001:0> contacts = Hubspot::Contact.all
=> #<Hubspot::PagedCollection:0x000055ba3c2b55d8 @limit_param="limit", @limit=25, @offset_param="offset", @offset=nil, @options={}, @fetch_proc=#<Proc:0x000055ba3c2b5538@/home/chris/projects/hubspot-ruby/lib/hubspot/contact.rb:18>, @resources=[...snip...], @next_offset=9242374, @has_more=true>

irb(main):002:0> contacts.more?
=> true

irb(main):003:0> contacts.next_offset
=> 9242374

irb(main):004:0> contacts.size
=> 25

irb(main):005:0> contacts.first
=> #<Hubspot::Contact:0x000055ba3c29bac0 @changes={}, @properties={"firstname"=>{"value"=>"My Street X 1551971239 => My Street X 1551971267 => My Street X 1551971279"}, "lastmodifieddate"=>{"value"=>"1551971286841"}, "company"=>{"value"=>"MadKudu"}, "lastname"=>{"value"=>"Test0830181615"}}, @id=9153674, @persisted=true, @deleted=false, @metadata={"addedAt"=>1535664601481, "vid"=>9153674, "canonical-vid"=>9153674, "merged-vids"=>[], "portal-id"=>62515, "is-contact"=>true, "profile-token"=>"AO_T-mPNHk6O7jh8u8D2IlrhZn7GO91w-weZrC93_UaJvdB0U4o6Uc_PkPJ3DOpf15sUplrxMzG9weiTTpPI05Nr04zxnaNYBVcWHOlMbVlJ2Avq1KGoCBVbIoQucOy_YmCBIfOXRtcc", "profile-url"=>"https://app.hubspot.com/contacts/62515/contact/9153674", "form-submissions"=>[], "identity-profiles"=>[{"vid"=>9153674, "saved-at-timestamp"=>1535664601272, "deleted-changed-timestamp"=>0, "identities"=>[{"type"=>"EMAIL", "value"=>"[email protected]", "timestamp"=>1535664601151, "is-primary"=>true}, {"type"=>"LEAD_GUID", "value"=>"01a107c4-3872-44e0-ab2e-47061507ffa1", "timestamp"=>1535664601259}]}], "merge-audits"=>[]}>

irb(main):006:0> contacts.next_page
=> #<Hubspot::PagedCollection:0x000055ba3c2b55d8 @limit_param="limit", @limit=25, @offset_param="offset", @offset=9242374, @options={}, @fetch_proc=#<Proc:0x000055ba3c2b5538@/home/chris/projects/hubspot-ruby/lib/hubspot/contact.rb:18>, @resources=[...snip...], @next_offset=9324874, @has_more=true>

For Hubspot resources that support batch updates for updating multiple resources, the collection provides an update_all() method:

irb(main):001:0> companies = Hubspot::Company.all(limit: 5)
=> #<Hubspot::PagedCollection:0x000055d5314fe0c8 @limit_param="limit", @limit=5, @offset_param="offset", @offset=nil, @options={}, @fetch_proc=#<Proc:0x000055d5314fe028@/home/chris/projects/hubspot-ruby/lib/hubspot/company.rb:21>, @resources=[...snip...], @next_offset=116011506, @has_more=true>

irb(main):002:0> companies.size
=> 5

irb(main):003:0> companies.update_all(lifecyclestage: "opportunity")
=> true

irb(main):004:0> companies.refresh
=> #<Hubspot::PagedCollection:0x000055d5314fe0c8 @limit_param="limit", @limit=5, @offset_param="offset", @offset=nil, @options={}, @fetch_proc=#<Proc:0x000055d5314fe028@/home/chris/projects/hubspot-ruby/lib/hubspot/company.rb:21>, @resources=[...snip...], @next_offset=116011506, @has_more=true>

Deleting a resource

irb(main):001:0> contact = Hubspot::Contact.find(9324874)
=> #<Hubspot::Contact:0x000055a87c87aee0 ...snip... >

irb(main):002:0> contact.delete
=> true

Resource types

Note: These are the currently defined classes the support the new resource API. This list will continue to grow as we update other classes. All existing classes will be updated prior to releasing v1.0.

  • Contact -> Hubspot::Contact
  • Company -> Hubspot::Company

Contributing to hubspot-ruby

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Testing

This project uses VCR to test interactions with the HubSpot API. VCR records HTTP requests and replays them during future tests.

To run the tests, run bundle exec rake or bundle exec rspec.

By default, the VCR recording mode is set to :none, which allows recorded requests to be re-played but raises for any new request. This prevents the test suite from issuing unexpected HTTP requests.

To add a new test or update a VCR recording, run the test with the VCR_RECORD environment variable:

VCR_RECORD=1 bundle exec rspec spec

Disclaimer

This project and the code therein was not created by and is not supported by HubSpot, Inc or any of its affiliates.

hubspot-ruby's People

Contributors

adimichele avatar alejeune avatar benliscio avatar blakewest avatar capelio avatar carolhsu avatar cbisnett avatar coxw avatar dam avatar dan987 avatar dinosimone avatar fonji avatar hundredwatt avatar loadkpi avatar lukeasrodgers avatar mwalsher avatar nandooliveira avatar ngsikai avatar nicholas-horton avatar paulodiniz avatar pieper126 avatar robnazzal avatar rudiney avatar sensadrome avatar srgoldman avatar strangewill avatar sviccari avatar trueinviso avatar vincenzor avatar yurikoval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hubspot-ruby's Issues

[Question] Get all contacts w/ Default Params and Email

I'm attempting to fetch all contacts w/ the Email address, First name, Last name, and Company.

When I run the following code, all I get is the Email Address. I've looked through the source code, but I'm unsure of how to correctly request the contact properties. How would I tweak my code in order to request multiple properties?

Hubspot::Contact.all({ property: 'email' }

Unable to load properties.rake

LoadError: cannot load such file -- /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/bundler/gems/hubspot-ruby-8db4406cdf5a/lib/tasks/properties.rake

Heroku won't publish. I'm pulling directly from the repo, so maybe it's my own fault (had to do that to get certain functions to work). Any advice appreciated!

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.3
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
       The git source `git://github.com/adimichele/hubspot-ruby.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
       fatal: not a git repository (or any parent up to mount point /)
       Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
       Fetching git://github.com/adimichele/hubspot-ruby.git
       Fetching gem metadata from https://rails-assets.org/..
       Fetching gem metadata from https://rubygems.org/...........
       Fetching version metadata from https://rails-assets.org/..
       Fetching version metadata from https://rubygems.org/..
       Fetching dependency metadata from https://rails-assets.org/..
       Fetching dependency metadata from https://rubygems.org/.
       Resolving dependencies...
       Using rake 12.3.1
       Using concurrent-ruby 1.1.3
       Using minitest 5.11.3
       Using thread_safe 0.3.6
       Using builder 3.2.3
       Using erubi 1.7.1
       Using mini_portile2 2.3.0
       Using crass 1.0.4
       Using rack 2.0.6
       Using nio4r 2.3.1
       Using websocket-extensions 0.1.3
       Using mini_mime 1.0.1
       Using coffee-script-source 1.12.2
       Using execjs 2.7.0
       Using method_source 0.9.2
       Using thor 0.20.3
       Using formtastic_i18n 0.6.0
       Using kaminari-core 1.1.1
       Using arel 9.0.0
       Using rb-fsevent 0.10.3
       Using ffi 1.9.25
       Using mimemagic 0.3.2
       Using bcrypt 3.1.12
       Using msgpack 1.2.4
       Using popper_js 1.14.5
       Using bundler 1.15.2
       Using chartkick 3.0.1
       Using climate_control 0.2.0
       Using orm_adapter 0.5.0
       Using mini_magick 4.9.2
       Using liquid 4.0.1
       Using temple 0.8.0
       Using tilt 2.0.8
       Using mime-types-data 3.2018.0812
       Using multi_xml 0.6.0
       Using multi_json 1.13.1
       Using libv8 6.7.288.46.1 (x86_64-linux)
       Using mysql2 0.5.2
       Using pg 1.1.3
       Using puma 3.12.0
       Using truncate_html 0.9.3
       Using uk_postcode 2.1.3
       Using i18n 1.1.1
       Using sitemap_generator 6.0.1
       Using nokogiri 1.8.5
       Using rack-test 1.1.0
       Using sprockets 4.0.0.beta4
       Using warden 1.2.8
       Using tzinfo 1.2.5
       Using websocket-driver 0.7.0
       Using autoprefixer-rails 9.3.1
       Using uglifier 3.2.0
       Using mail 2.7.1
       Using coffee-script 2.4.1
       Using rb-inotify 0.9.10
       Using ruby-vips 2.0.13
       Using marcel 0.3.3
       Using bootsnap 1.3.2
       Using terrapin 0.6.0
       Using mime-types 3.2.2
       Using mini_racer 0.2.4
       Using haml 5.0.4
       Fetching activesupport 5.2.1.1
       Using sass-listen 4.0.0
       Using image_processing 1.7.1
       Using cocaine 0.6.0
       Using httparty 0.16.3
       Using loofah 2.2.3
       Using sass 3.7.2
       Using ckeditor 4.2.4
       Using rails-html-sanitizer 1.0.4
       Using bootstrap 4.1.3
       Installing activesupport 5.2.1.1
       Using rails-dom-testing 2.0.3
       Using globalid 0.4.1
       Using arbre 1.1.1
       Fetching activemodel 5.2.1.1
       Using groupdate 4.1.0
       Using hubspot-ruby 0.5.0 from git://github.com/adimichele/hubspot-ruby.git (at master@8db4406)
       Using jbuilder 2.8.0
       Fetching actionview 5.2.1.1
       Fetching activejob 5.2.1.1
       Installing activejob 5.2.1.1
       Installing activemodel 5.2.1.1
       Installing actionview 5.2.1.1
       Fetching activerecord 5.2.1.1
       Installing activerecord 5.2.1.1
       Fetching actionpack 5.2.1.1
       Using kaminari-actionview 1.1.1
       Installing actionpack 5.2.1.1
       Using kaminari-activerecord 1.1.1
       Using friendly_id 5.2.4
       Using nilify_blanks 1.3.0
       Using kaminari 1.1.1
       Fetching actioncable 5.2.1.1
       Fetching actionmailer 5.2.1.1
       Fetching railties 5.2.1.1
       Installing actioncable 5.2.1.1
       Installing actionmailer 5.2.1.1
       Installing railties 5.2.1.1
       Using formtastic 3.1.5
       Using has_scope 0.7.2
       Using ransack 2.1.0
       Fetching activestorage 5.2.1.1
       Installing activestorage 5.2.1.1
       Using sprockets-rails 3.2.1
       Using responders 2.4.0
       Using jquery-rails 4.3.3
       Using coffee-rails 4.2.2
       Fetching rails 5.2.1.1
       Using font-awesome-rails 4.7.0.4
       Using sass-rails 5.0.7
       Using inherited_resources 1.9.0
       Using devise 4.5.0
       Using activeadmin 1.4.2
       Using formadmin 0.2.1
       Installing rails 5.2.1.1
       Using exception_handler 0.8.0.0
       Using fl 0.3.9 from source at `vendor/gems/fl`
       Bundle complete! 21 Gemfile dependencies, 108 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Bundle completed (9.40s)
       Cleaning up the bundler cache.
       The git source `git://github.com/adimichele/hubspot-ruby.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
       Removing activestorage (5.2.1)
       Removing rails (5.2.1)
       Removing activesupport (5.2.1)
       Removing activejob (5.2.1)
       Removing actioncable (5.2.1)
       Removing activemodel (5.2.1)
       Removing railties (5.2.1)
       Removing actionmailer (5.2.1)
       Removing activerecord (5.2.1)
       Removing actionpack (5.2.1)
       Removing actionview (5.2.1)
       Removing hubspot-ruby (009520d38b31)
       The latest bundler is 2.0.0.pre.2, but you are currently running 1.15.2.
       To update, run `gem install bundler --pre`
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
 !
 !     Could not detect rake tasks
 !     ensure you can run `$ bundle exec rake -P` against your app
 !     and using the production group of your Gemfile.
 !     fatal: not a git repository (or any parent up to mount point /)
 !     Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
 !     rake aborted!
 !     LoadError: cannot load such file -- /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/bundler/gems/hubspot-ruby-8db4406cdf5a/lib/tasks/properties.rake
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:281:in `block in load'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:253:in `load_dependency'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:281:in `load'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load_rakefile'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/default_loader.rb:11:in `load'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:781:in `load_imports'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:711:in `raw_load_rakefile'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:104:in `block in load_rakefile'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:103:in `load_rakefile'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:82:in `block in run'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
 !     /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
 !     vendor/bundle/bin/rake:17:in `load'
 !     vendor/bundle/bin/rake:17:in `<main>'
 !
/app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
ensure you can run `$ bundle exec rake -P` against your app
and using the production group of your Gemfile.
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
rake aborted!
LoadError: cannot load such file -- /tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/bundler/gems/hubspot-ruby-8db4406cdf5a/lib/tasks/properties.rake
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:281:in `block in load'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/dependencies.rb:281:in `load'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/default_loader.rb:11:in `load'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:781:in `load_imports'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:711:in `raw_load_rakefile'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:104:in `block in load_rakefile'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:103:in `load_rakefile'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:82:in `block in run'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/tmp/build_f0ce8a789b1c37c39ede7535e17d3270/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
vendor/bundle/bin/rake:17:in `load'
vendor/bundle/bin/rake:17:in `<main>'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:860:in `rake'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:84:in `block (2 levels) in run_assets_precompile_rake_task'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:134:in `log'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:78:in `block in run_assets_precompile_rake_task'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:48:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:77:in `run_assets_precompile_rake_task'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:109:in `block (2 levels) in compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:881:in `allow_git'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:103:in `block in compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:48:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:92:in `compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails2.rb:62:in `block in compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:48:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails2.rb:60:in `compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails3.rb:42:in `block in compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:48:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails3.rb:41:in `compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:41:in `block in compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:48:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:44:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:40:in `compile'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:20:in `block (2 levels) in <main>'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:134:in `log'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:19:in `block in <main>'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:35:in `block in trace'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:17:in `block in instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:16:in `instrument'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:35:in `trace'
	from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:15:in `<main>'
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

Multi-tenancy support / dynamically set the api key?

I'm currently setting my hubspot API key in a 'hubspot.rb' file in config/initializers:

Hubspot.configure(hapikey: Rails.application.secrets.hubspot_api_key)

This works fine for a single-tenant application. For multi-tenancy, I'm storing the account's API key in the database (encrypted), like a couple of other integrations my software uses. For example, for Mailgun, I'm setting the account specific info (API Key, etc) dynamically when sending mail.

Is there any way to dynamically set the hubspot api key instead of setting it once, application wide, in an initializer?

No OAuth?

It looks like OAuth is the preferred way to connect to the API but that is not documented anywhere. Is it supported? I am not able to get a plain API key.

Form API Submission Format

It appears that the form submission is encoded as JSON. While it will post successfully, it creates an entry with no contact information. According to the API documentation, the form fields should be URI encoded.

opts[:body].to_json should be changed to URI.encode(opts[:body].map{|k,v| "#{k}=#{v}"}.join("&")) inside submit of FormsConnection < Connection.

uninitialized constant Hubspot::Company

I've installed the gem in my rails gemfile.

All of the other module subclasses are recognized and work as expected, but for some reason ::Company does not exist.

 Hubspot::Company
NameError: uninitialized constant Hubspot::Company
    from (irb):19
    from /home/andrew/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in `start'
    from /home/andrew/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/console.rb:9:in `start'
    from /home/andrew/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /home/andrew/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/andrew/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>'

My Code:

    company = Hubspot::Company.create!(name, {company_domain_name: realtor_url, phone_number: phone} )

Recent created contacts

HI, I see we have this for recently updated contacts. Do we have an endpoint that will return recently created contacts? If not, can I submit a pr to support this? We need this endpoint to bring down our call numbers to Hubspot. We are close to the limit. Thanks.

Add Appraisal

A description of Appraisal and it's purpose:

Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals." Appraisal is designed to make it easy to check for regressions in your library without interfering with day-to-day development using Bundler.

Naming conventions

This is bordering on extreme pedantry, but v1.0 gives us the chance to standardise on the official HubSpot naming conventions in this code.

For example, Hubspot => HubSpot as a module name.

Also, the HubSpot term for the company identity is companyID (rather than vid, which typically refers to the contact ID).

Happy to submit a PR if this something worth considering at this forthcoming release?

Threadsafe version

Is there a version of this gem that does configuration on an instance? I am building an integration with hubspot for multiple accounts so don't want to set my HAPI key on the class.

Hubspot::Contact.find_by_email generating error not returning nil

hubspot_contact = Hubspot::Contact.find_by_email email

Having problems with this code above. When the contact is not found, I was expecting it to be nil. Instead, I am getting a Hubspot::RequestError

Hubspot::RequestError: Response body: {"status":"error","message":"contact does not exist","correlationId":"e378d2f2-57f9-4e60-93ab-269681d419d4","requestId":"0043a897-2017-4735-945e-5ecad6fbe9cd"}
from /Users/csalvato/.rvm/gems/ruby-1.9.3-p551@powersupply/gems/hubspot-ruby-0.1.8/lib/hubspot/connection.rb:9:in `get_json'

In my code, I am trying to use begin -> rescue blocks, but that doesn't seem to be catching the error for proper handling either.

Discussion: API design

Goals to think about as we refactor and add support for new endpoints:

  • Avoid leaky abstractions (ex: surfacing HTTParty responses or errors to the gem user)
  • Include the Hubspot API error message when a request fails
  • Discuss “handling failure” on the README so readers know what to expect when a request fails

Speaking of handling failure... I've been thinking about two ways for this library to express failure:

  1. regard failure as a normal return value (aka, always return a Response-like object). This does not apply to the more exception 500-related status codes
  2. raise an exception for non-200 response codes.

I'm typically anti-exception and prefer to treat failure as a normal return value. The ruby community, especially those wrapping third-party APIs, strongly favor using exceptions.

To help us decide, let's consider these design options from the gem user's perspective:

# hubspot-ruby returns a Response object
class Account
 def self.update(account_id, params)
   response = Hubspot::Account.update(account_id, params)
   handle_response(response)
 end

 private
 def handle_response(response)
  if response.success?
    response.data
  else
   # error flow (maybe return the errors, log the failed request, etc)
  end
 end
end

# Pros
# - This design encourages gem users to consider error cases
# - Errors are part of the return value, not an exception
# - Favors conditionals over rescuing

# Cons
# - Handling each API response is more verbose as the gem user will call 
#   `response.success?` before accessing `response.data` 
# - This approach is less idiomatic in the Ruby community. Most API wrappers 
#   raise when a request returns an error
# hubspot-ruby raises for any non-200 response
class Account
 def self.update(account_id, params)
   Hubspot::Account.update(account_id, params)
 rescue Hubspot::Error => exception
   # error flow (maybe return the errors, log the failed request, etc)
 end
end

# Pros
# - This design doesn't require "success?" checks before accessing data. (example)

# Cons
# - Encourages/requires gem users to wrap API calls in a rescue
# - Gem users may forget to wrap an API call in a rescue, resulting in an exception

I would love your feedback on which approach (Response vs Exception) seems best to you.

Add support for access_token and oauth_token

Great work on this. Are you going to add support for other auth types?
I am using my access tokens from oauth and tweeked connection.rb to use it.

Hapikey is oauth key in my case.

auth = "Bearer " + Hubspot::Config.hapikey response = get(url, headers: { 'Content-Type' => 'application/json', 'Authorization' => auth }, format: :json)

Publish newer versions?

The latest version available on rubygems.org is 0.1.8, and master currently sits at 0.1.12.

Concrete motivation for this request is the Contacts::find_by_email method. In the latest published version, the "batch mode" branch of logic within that method has a comment which reads TODO: Transform response, and fails to produce Hubspot::Contact instances.

The current version of contact.rb does consistently produce Hubspot::Contact instances in both batch and non-batch mode. This was added in 5fcfcab and it looks like any release beyond 0.1.8 (even just 0.1.9) would address this.

SSL Connection Reset in find_by_email

We keep seeing intermittent errors on the SSL connection getting reset.
The error message reads: Errno::ECONNRESET: Connection reset by peer - SSL_connect.
It keeps happening in the find_by_email call.

As a user of the API, is there special precautions that we need to take?

Form encoding for submissions

In the Hubspot::FormConnection.submit method, the content type is set to 'application/x-www-form-urlencoded', but the body is still encoded to JSON. Per the documentation, the body should be form encoded, eg: firstname=TestContact&lastname=FormSub&email=formsub@hub...

Hubspot::Form#submit requires the `:portal_id` parameter

Hubspot::Form#submit

The SUBMIT_DATA_PATH constant includes a :portal_id parameter: '/uploads/form/v2/:portal_id/:form_guid'

However, the submit instance method only passes the :form_guid in as a param: Hubspot::Connection.post_json(FORM_PATH, params: { form_guid: @guid }, body: opts)

So, when I attempted to use the submit method, an exception was raised:

Hubspot::ConfigurationError: 'portal_id' not configured
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/config.rb:24:in `block in ensure!'
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/config.rb:23:in `each'
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/config.rb:23:in `ensure!'
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/connection.rb:47:in `generate_url'
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/connection.rb:91:in `submit'
        from /Users/jason/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hubspot-ruby-0.1.8/lib/hubspot/form.rb:66:in `submit'

Not sure what the appropriate resolution is, I can see 2 possiblities:

  1. include a :portal_id key in the opts hash
  2. Global configure the portal_id

Requires ActiveSupport::Autoload

Was attempting to use this in a plain ruby project and this simple program

require 'dotenv'
require 'pry'
Dotenv.load

require 'hubspot-ruby'

Throws the following error:

/Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/number_helper.rb:3:in `<module:NumberHelper>': uninitialized constant ActiveSupport::Autoload (NameError)
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/number_helper.rb:2:in `<module:ActiveSupport>'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/number_helper.rb:1:in `<top (required)>'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:2:in `<top (required)>'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric.rb:3:in `<top (required)>'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/core_ext.rb:2:in `block in <top (required)>'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/core_ext.rb:1:in `each'
    from /Users/justin/.gem/ruby/2.2.5/gems/activesupport-4.2.6/lib/active_support/core_ext.rb:1:in `<top (required)>'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/justin/.gem/ruby/2.2.5/gems/hubspot-ruby-0.1.8/lib/hubspot-ruby.rb:1:in `<top (required)>'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Users/justin/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from app.rb:5:in `<main>'

Contacts API test failure

Discovered by @patrickdavey during pull request #2.

 1) Contacts API Live test finds a contact by utk
     Failure/Error: Hubspot::Contact.find_by_utk("f844d2217850188692f2610c717c2e9b").should be_present
       expected present? to return true, got false
     # ./spec/live/contacts_integration_spec.rb:30:in `block (2 levels) in <top (required)>'
     # ./spec/support/cassette_helper.rb:5:in `block in extended'

Failure with Ruby 2.3.1

A script with just the line require 'hubspot-ruby' (everything else but the shebang line is commented out or after an exit) causes:

/Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/deprecation/proxy_wrappers.rb:124:in `initialize': undefined method `instance' for ActiveSupport::Deprecation:Class (NoMethodError)
Did you mean?  instance_of?
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/deprecation/proxy_wrappers.rb:10:in `new'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/deprecation/proxy_wrappers.rb:10:in `new'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext/load_error.rb:30:in `<top (required)>'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext.rb:3:in `block in <top (required)>'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext.rb:2:in `each'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext.rb:2:in `<top (required)>'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/hubspot-ruby-0.1.8/lib/hubspot-ruby.rb:1:in `<top (required)>'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
    from /Users/brandon/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from post.rb:5:in `<main>'

Get all companies not using the correct endpoint

It looks like Hubspot changed their endpoints last year for getting all companies or all deals. See this announcement: https://integrate.hubspot.com/t/upcoming-changes-to-recent-endpoints-for-companies-and-deals/1121

It seems like the Hubspot::Company.all method should be updated to use the new endpoint URL described here: https://developers.hubspot.com/docs/methods/companies/get-all-companies

I'm sure the same is true for deals, but my issue currently is with companies.

How can we help?

At Huntress Labs we use this gem to integrate with our HubSpot instance. I see there are several issues filed and a number of pull requests waiting to be reviewed and merged. I would like to help out maintaining this project since it's important to us. Would you mind adding me as a maintainer or would it be easier if we just fork the repository?

cc: @dan987

Errno::ECONNRESET: Connection reset by peer - SSL_connect in Hubspot::Contact.create!("[email protected]", {firstname: "First", lastname: "Last"})

Sometimes I get an error when trying to create a contact, although the contact on the Hubspot side is created successfully. I use Ubuntu 16.04 and Ruby 2.4.1. Earlier a similar problem was opened here, but it was closed.
Request Hubspot :: Contact.create_or_update! ([{Email: '[email protected]', firstname: 'First', lastname: 'Last'}]) gives the same result.

Hubspot depreciated v2 of Blog Topic API

Starting seeing this error today

[1] » Hubspot::Topic.list
Hubspot::RequestError: Response body:
...
HubSpot - Page not found

I have an email from them back on April 24, 2015 announcing Blog Topic API v3, which mentions v2 being depreciated around June 15th.

Creating Deals - Readme

I see that you can create a deal (def create!(portal_id, company_ids, vids, params={})), but what's the recommended call? I'd be happy to update the readme and submit a PR. :)

CompanyProperties using outdated endpoints

The CompanyProperties endpoints are outdated and need to be updated to reflect the CompanyProperty HubSpot API docs.

Work to be done: Update the CompanyProperty endpoints (currently referencing /companies/v2/properties and /companies/v2/groups/) to the newer endpoints: /properties/v1/companies/properties.

Do the old endpoints still work?
Yes. They work because HubSpot is redirecting these old URLs to hit the new endpoints, resulting in a response from the new endpoint.

Cannot use create_or_update! without passing email in properties

...specifically for a set of contacts who do not have a :vid or the :vid is not known.

The create_or_update! function does not remove the:email from the contact_hash, before converting the hash_to_properties.

I am seeing some activity logged on "merged contacts" (whose email has become a comma-separated list of emails), indicating the email is being changed through the API. For some reason, the email never actually changes, despite activity being logged.

I'm not intending to update the :email field. Though, I'm not sure how to use create_or_update!, keeping the :email field as the identifier, without inadvertently modifying contacts where the email does not match up exactly.

Is the email being intentionally passed in properties:, even when the :email is being used as the identifier? Any thoughts on whether or not this is an issue?

I'd be happy to write up a PR. :)

ContactProperties using outdated endpoints

The ContactProperties endpoints are outdated and need to be updated to reflect the ContactProperty HubSpot API docs.

Work to be done: Update the ContactProperty endpoints (currently referencing /contacts/v2/properties and /contacts/v2/groups/) to the newer endpoints: /properties/v1/contacts/properties.

Do the old endpoints still work?
Yes. They work because HubSpot is redirecting these old URLs to hit the new endpoints, resulting in a response from the new endpoint.

Missing rake folder in public gem

After installing the gem I was unable to deploy my app due to the following rake error:

rake aborted!
LoadError: cannot load such file -- /Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/hubspot-ruby-0.2.0/lib/tasks/properties.rake
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `block in load'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/bin/ruby_executable_hooks:15:in `eval'
/Users/jeremylopez/.rvm/gems/ruby-2.2.3@awaken/bin/ruby_executable_hooks:15:in `<main>'

After navigating to the location of the gem, the lib folder had no tasks folder. After specifying in my gemfile to pull directly from your repo, everything worked. Figured this might be helpful to someone.

Properties API not allowing to create property with 'date' as datatype

I am trying to create property with date as datatype in Hubspot through contact properties API. But it is raising error Invalid type : date when I make API call to create property using following API method -

Hubspot::ContactProperties.create!({params})

Seems this issue is due to following definition of PROPERTY_SPECS constant in hubspot/properties.rb where date is not listed in valid_types -

PROPERTY_SPECS = {
group_field_names: %w(name displayName displayOrder properties),
field_names: %w(name groupName description fieldType formField type displayOrder label options),
valid_field_types: %w(textarea select text date file number radio checkbox),
valid_types: %w(string number bool datetime enumeration),
options: %w(description value label hidden displayOrder)
}

Although date is listed as valid datatype in Hubspot contact properties API - http://developers.hubspot.com/docs/methods/contacts/v2/create_contacts_property

Do we need to add date as valid type here?

Any help will be highly appreciated.

Thank you.

Define a consistent return value for each action

The return values for each action vary for each class and vary for instance methods and class methods. This inconsistent behavior can be confusing to users and those interested in contributing to the library.

For example, depending on which class you're using, calling .update! or #update! will vary between returning a hash or an instance of the class.

How can we make this consistent and give our users the best experience?

Gem fails to initialize on Windows

lib/hubspot/config.rb:

DEFAULT_LOGGER = Logger.new('/dev/null')

This line causes a problem when the gem is initialized via Gemfile. This is because doing this on Windows will result in the exception:
No such file or directory @ rb_sysopen - /dev/null (Errno::ENOENT)

The better, platform independent approach is to use it like this:
DEFAULT_LOGGER = Logger.new(nil)

This would fix the problem.

P.S. I still don't like that we are instantiating a new Logger instance during gem initialization. This is just not needed at this point.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.