├── .env.test ├── .gitignore ├── .rspec ├── .travis.yml ├── Appraisals ├── Gemfile ├── Guardfile ├── History.md ├── LICENSE.txt ├── README.md ├── RELEASING.md ├── Rakefile ├── bin └── console ├── gemfiles ├── activesupport_4.2.gemfile ├── activesupport_5.0.gemfile ├── activesupport_5.1.gemfile └── activesupport_5.2.gemfile ├── hubspot-ruby.gemspec ├── lib ├── hubspot-ruby.rb ├── hubspot │ ├── blog.rb │ ├── collection.rb │ ├── company.rb │ ├── company_properties.rb │ ├── config.rb │ ├── connection.rb │ ├── contact.rb │ ├── contact_list.rb │ ├── contact_properties.rb │ ├── deal.rb │ ├── deal_pipeline.rb │ ├── deal_properties.rb │ ├── deprecator.rb │ ├── engagement.rb │ ├── exceptions.rb │ ├── form.rb │ ├── oauth.rb │ ├── owner.rb │ ├── paged_collection.rb │ ├── properties.rb │ ├── railtie.rb │ ├── resource.rb │ ├── subscription.rb │ ├── topic.rb │ └── utils.rb └── tasks │ └── hubspot.rake └── spec ├── factories ├── companies.rb └── contacts.rb ├── fixtures └── vcr_cassettes │ ├── Hubspot_Company_add_contact_with_a_valid_company_ID_and_contact_ID_adds_the_contact_to_the_company.yml │ ├── Hubspot_Company_add_contact_with_a_valid_company_ID_and_contact_ID_returns_success.yml │ ├── Hubspot_Company_add_contact_with_a_valid_company_ID_and_invalid_contact_ID_raises_an_error.yml │ ├── Hubspot_Company_add_contact_with_an_invalid_company_ID_raises_an_error.yml │ ├── Hubspot_Company_all_with_a_limit_respects_the_limit.yml │ ├── Hubspot_Company_all_with_a_limit_returns_a_collection.yml │ ├── Hubspot_Company_all_with_an_offset_has_an_offset.yml │ ├── Hubspot_Company_all_with_an_offset_identifies_if_there_are_more_resources.yml │ ├── Hubspot_Company_all_with_an_offset_returns_a_collection.yml │ ├── Hubspot_Company_all_with_no_options_has_an_offset.yml │ ├── Hubspot_Company_all_with_no_options_identifies_if_there_are_more_resources.yml │ ├── Hubspot_Company_all_with_no_options_returns_a_collection.yml │ ├── Hubspot_Company_behaves_like_a_saveable_resource_save_with_a_new_resource_clears_the_changes.yml │ ├── Hubspot_Company_behaves_like_a_saveable_resource_save_with_a_new_resource_sets_the_ID.yml │ ├── Hubspot_Company_behaves_like_a_saveable_resource_save_with_a_new_resource_succeeds.yml │ ├── Hubspot_Company_behaves_like_a_saveable_resource_save_with_an_existing_resource_clears_the_changes.yml │ ├── Hubspot_Company_behaves_like_a_saveable_resource_save_with_an_existing_resource_succeeds.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_an_existing_resource_succeeds.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails_with_an_error.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_no_changes_succeeds.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_no_changes_updates_the_properties.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_overlapping_changes_merges_and_updates_the_properties.yml │ ├── Hubspot_Company_behaves_like_an_updateable_resource_update_with_overlapping_changes_succeeds.yml │ ├── Hubspot_Company_create_with_no_properties_creates_a_new_company.yml │ ├── Hubspot_Company_create_with_properties_creates_a_new_company.yml │ ├── Hubspot_Company_create_with_properties_has_the_property_set.yml │ ├── Hubspot_Company_create_with_properties_is_persisted.yml │ ├── Hubspot_Company_delete_when_persisted_deletes_the_resource.yml │ ├── Hubspot_Company_delete_when_persisted_sets_the_deleted_flag.yml │ ├── Hubspot_Company_find_with_a_valid_ID_finds_the_company.yml │ ├── Hubspot_Company_find_with_an_invalid_ID_raises_an_error.yml │ ├── Hubspot_Company_recently_created_returns_a_collection.yml │ ├── Hubspot_Company_recently_modified_returns_a_collection.yml │ ├── Hubspot_Company_reload_with_a_valid_ID_loads_the_company_details.yml │ ├── Hubspot_Company_remove_contact_with_a_valid_company_ID_and_contact_ID_returns_success.yml │ ├── Hubspot_Company_search_domain_returns_a_collection.yml │ ├── Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_clears_the_changes.yml │ ├── Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_sets_the_ID.yml │ ├── Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_succeeds.yml │ ├── Hubspot_Contact_behaves_like_a_saveable_resource_save_with_an_existing_resource_clears_the_changes.yml │ ├── Hubspot_Contact_behaves_like_a_saveable_resource_save_with_an_existing_resource_succeeds.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_an_existing_resource_succeeds.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails_with_an_error.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_no_changes_succeeds.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_no_changes_updates_the_properties.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_overlapping_changes_merges_and_updates_the_properties.yml │ ├── Hubspot_Contact_behaves_like_an_updateable_resource_update_with_overlapping_changes_succeeds.yml │ ├── Hubspot_Contact_create_with_an_existing_email_address_raises_an_error.yml │ ├── Hubspot_Contact_create_with_an_invalid_email_address_raises_an_error.yml │ ├── Hubspot_Contact_create_with_properties_creates_a_new_contact.yml │ ├── Hubspot_Contact_create_with_properties_has_the_property_set.yml │ ├── Hubspot_Contact_create_with_properties_is_persisted.yml │ ├── Hubspot_Contact_create_without_properties_creates_a_new_contact.yml │ ├── Hubspot_Contact_find_by_email_finds_the_contact.yml │ ├── Hubspot_Contact_find_by_email_is_persisted.yml │ ├── Hubspot_Contact_find_with_a_valid_ID_finds_the_contact.yml │ ├── Hubspot_Contact_find_with_an_invalid_ID_raises_an_error.yml │ ├── Hubspot_Contact_merge_with_a_valid_contact_succeeds.yml │ ├── Hubspot_Contact_merge_with_an_invalid_contact_raises_an_error.yml │ ├── Hubspot_Contact_merge_with_invalid_contact_ids_raises_an_error.yml │ ├── Hubspot_Contact_merge_with_valid_contact_ids_succeeds.yml │ ├── Hubspot_Contact_search_when_the_query_returns_contacts_has_contacts.yml │ ├── Hubspot_Contact_search_when_the_query_returns_no_contacts_does_not_have_a_next_page.yml │ ├── Hubspot_Contact_search_when_the_query_returns_no_contacts_does_not_have_more.yml │ ├── Hubspot_Contact_search_when_the_query_returns_no_contacts_has_no_contacts.yml │ ├── add_contact_to_company_class.yml │ ├── add_contact_to_company_instance.yml │ ├── add_contacts_to_lists.yml │ ├── all_deal_pipelines.yml │ ├── blog_list.yml │ ├── blog_posts.yml │ ├── blog_posts │ ├── all_blog_posts.yml │ └── filter_blog_posts.yml │ ├── blog_posts_list.yml │ ├── company_batch_update.yml │ ├── company_create.yml │ ├── company_create_with_params.yml │ ├── company_destroy.yml │ ├── company_example.yml │ ├── company_find_by_domain.yml │ ├── company_find_by_domain_with_params.yml │ ├── company_find_by_id.yml │ ├── company_get_contact_vids.yml │ ├── company_properties │ ├── all_groups.yml │ ├── all_properties.yml │ ├── create_group.yml │ ├── create_group_some_params.yml │ ├── create_property.yml │ ├── delete_group.yml │ ├── delete_non_group.yml │ ├── delete_non_property.yml │ ├── delete_property.yml │ ├── exclude_by_group.yml │ ├── filter_by_group.yml │ ├── groups_example.yml │ ├── groups_excluded.yml │ ├── groups_included.yml │ ├── properties_example.yml │ ├── properties_in_groups.yml │ ├── properties_not_in_groups.yml │ ├── update_group.yml │ └── update_property.yml │ ├── company_update.yml │ ├── company_with_contacts.yml │ ├── contact_create.yml │ ├── contact_create_existing_email.yml │ ├── contact_create_invalid_email.yml │ ├── contact_create_or_update_existing_email.yml │ ├── contact_create_or_update_invalid_email.yml │ ├── contact_create_or_update_with_params.yml │ ├── contact_create_with_params.yml │ ├── contact_destroy.yml │ ├── contact_example.yml │ ├── contact_find_by_email.yml │ ├── contact_find_by_email_batch_mode.yml │ ├── contact_find_by_id.yml │ ├── contact_find_by_id_batch_mode.yml │ ├── contact_find_by_utk.yml │ ├── contact_find_by_utk_batch_mode.yml │ ├── contact_list │ └── add_contact_to_dynamic_list.yml │ ├── contact_list_batch_find.yml │ ├── contact_list_destroy.yml │ ├── contact_list_example.yml │ ├── contact_list_find.yml │ ├── contact_list_refresh.yml │ ├── contact_list_update.yml │ ├── contact_lists │ ├── add_contact.yml │ └── add_existing_contact.yml │ ├── contact_merge.yml │ ├── contact_properties │ ├── all_groups.yml │ ├── all_properties.yml │ ├── create_group.yml │ ├── create_group_some_params.yml │ ├── create_property.yml │ ├── delete_group.yml │ ├── delete_non_group.yml │ ├── delete_non_property.yml │ ├── delete_property.yml │ ├── groups_example.yml │ ├── groups_included.yml │ ├── groups_not_excluded.yml │ ├── properties_example.yml │ ├── properties_in_groups.yml │ ├── properties_not_in_groups.yml │ ├── update_group.yml │ └── update_property.yml │ ├── contact_search.yml │ ├── contact_update.yml │ ├── contacts │ ├── create_contact.yml │ └── update_contact.yml │ ├── contacts_among_list.yml │ ├── create_deal_pipeline.yml │ ├── create_form.yml │ ├── create_list.yml │ ├── create_list_with_filters.yml │ ├── create_or_update.yml │ ├── deal_all_groups.yml │ ├── deal_all_properties.yml │ ├── deal_create.yml │ ├── deal_create_group.yml │ ├── deal_create_group_some_params.yml │ ├── deal_create_property.yml │ ├── deal_delete_group.yml │ ├── deal_delete_non_group.yml │ ├── deal_delete_non_property.yml │ ├── deal_delete_property.yml │ ├── deal_example.yml │ ├── deal_find.yml │ ├── deal_find_by_company.yml │ ├── deal_groups_example.yml │ ├── deal_groups_included.yml │ ├── deal_groups_not_excluded.yml │ ├── deal_properties_example.yml │ ├── deal_properties_in_groups.yml │ ├── deal_properties_not_in_groups.yml │ ├── deal_update_group.yml │ ├── deal_update_property.yml │ ├── delete_deal_pipeline.yml │ ├── destroy_deal.yml │ ├── dump_contact_properties_and_groups.yml │ ├── dump_deal_properties_and_groups.yml │ ├── engagement_associate.yml │ ├── engagement_associated_example.yml │ ├── engagement_call_create.yml │ ├── engagement_call_destroy.yml │ ├── engagement_call_example.yml │ ├── engagement_call_find.yml │ ├── engagement_create.yml │ ├── engagement_destroy.yml │ ├── engagement_example.yml │ ├── engagement_find.yml │ ├── engagement_find_by_association.yml │ ├── engagement_find_by_contact.yml │ ├── engagement_find_by_country.yml │ ├── fail_to_create_form.yml │ ├── fail_to_create_list.yml │ ├── field_among_form.yml │ ├── fields_among_form.yml │ ├── find_all_companies.yml │ ├── find_all_contacts.yml │ ├── find_all_dynamic_lists.yml │ ├── find_all_forms.yml │ ├── find_all_lists.yml │ ├── find_all_recent_companies.yml │ ├── find_all_recent_contacts.yml │ ├── find_all_recent_created_contacts.yml │ ├── find_all_recent_updated_deals.yml │ ├── find_all_stastic_lists.yml │ ├── find_deal_pipeline.yml │ ├── form_destroy.yml │ ├── form_example.yml │ ├── form_find.yml │ ├── form_post.yml │ ├── form_submit_data.yml │ ├── form_update.yml │ ├── one_month_blog_posts_list.yml │ ├── owner_all.yml │ ├── owner_example.yml │ ├── owner_find_by_email.yml │ ├── owner_find_by_emails.yml │ ├── remove_contacts_from_lists.yml │ ├── restore_contact_properties_and_groups.yml │ ├── restore_deal_properties_and_groups.yml │ ├── topic_list.yml │ └── topics_list.yml ├── lib ├── hubspot-ruby_spec.rb ├── hubspot │ ├── blog_spec.rb │ ├── company_properties_spec.rb │ ├── company_spec.rb │ ├── config_spec.rb │ ├── connection_spec.rb │ ├── contact_list_spec.rb │ ├── contact_properties_spec.rb │ ├── contact_spec.rb │ ├── deal_pipeline_spec.rb │ ├── deal_properties_spec.rb │ ├── deal_spec.rb │ ├── deprecator_spec.rb │ ├── engagement_spec.rb │ ├── form_spec.rb │ ├── owner_spec.rb │ ├── properties_spec.rb │ ├── resource_spec.rb │ ├── topic_spec.rb │ └── utils_spec.rb └── tasks │ └── hubspot_spec.rb ├── shared_examples ├── saveable_resource.rb └── updateable_resource.rb ├── spec_helper.rb └── support ├── capture_output.rb ├── cassette_helper.rb ├── hubspot_api_helpers.rb ├── rake.rb ├── tests_helper.rb └── vcr.rb /.env.test: -------------------------------------------------------------------------------- 1 | HUBSPOT_HAPI_KEY=demo 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # rcov generated 2 | coverage 3 | coverage.data 4 | 5 | # rdoc generated 6 | rdoc 7 | 8 | # yard generated 9 | doc 10 | .yardoc 11 | 12 | # bundler 13 | .bundle 14 | 15 | Gemfile.lock 16 | gemfiles/*.lock 17 | 18 | # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: 19 | # 20 | # * Create a file at ~/.gitignore 21 | # * Include files you want ignored 22 | # * Run: git config --global core.excludesfile ~/.gitignore 23 | # 24 | # After doing this, these files will be ignored in all your git projects, 25 | # saving you from having to 'pollute' every project you touch with them 26 | # 27 | # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) 28 | # 29 | # For MacOS: 30 | # 31 | .DS_Store 32 | 33 | # For vim: 34 | *.swp 35 | 36 | # Rubymine 37 | .idea 38 | 39 | # RVM 40 | .rvmrc 41 | 42 | tmp 43 | 44 | # RVM setup 45 | .ruby-* 46 | 47 | # Generaged gem files 48 | *.gem 49 | 50 | # Sublime Text project files 51 | *.sublime-project 52 | *.sublime-workspace 53 | 54 | # Ignore local environment variables 55 | /.env 56 | 57 | # Byebug history 58 | .byebug_history 59 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format documentation 3 | --require spec_helper 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | sudo: false 3 | cache: bundler 4 | 5 | before_install: gem install bundler 6 | 7 | rvm: 8 | - 2.5 9 | - 2.4 10 | - 2.3 11 | 12 | gemfile: 13 | - gemfiles/activesupport_4.2.gemfile 14 | - gemfiles/activesupport_5.0.gemfile 15 | - gemfiles/activesupport_5.1.gemfile 16 | - gemfiles/activesupport_5.2.gemfile 17 | -------------------------------------------------------------------------------- /Appraisals: -------------------------------------------------------------------------------- 1 | appraise "activesupport_4.2" do 2 | gem "activesupport", "~> 4.2.2" 3 | end 4 | 5 | appraise "activesupport_5.0" do 6 | gem "activesupport", "~> 5.0.0" 7 | end 8 | 9 | appraise "activesupport_5.1" do 10 | gem "activesupport", "~> 5.1.0" 11 | end 12 | 13 | appraise "activesupport_5.2" do 14 | gem "activesupport", "~> 5.2.2" 15 | end 16 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | # Add dependencies to hubspot-ruby.gemspec 3 | gemspec 4 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # A sample Guardfile 2 | # More info at https://github.com/guard/guard#readme 3 | 4 | guard :rspec, cmd: 'bundle exec rspec' do 5 | watch(%r{^spec/.+_spec\.rb$}) 6 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } 7 | watch('spec/spec_helper.rb') { "spec" } 8 | end 9 | 10 | -------------------------------------------------------------------------------- /History.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 (TBD) 2 | 3 | * [#168] `Hubspot.configure` will raise when given none or multiple ways to 4 | authenticate with the HubSpot API. 5 | 6 | [#168]: https://github.com/adimichele/hubspot-ruby/pull/168 7 | 8 | * [#167] Updates the endpoints referenced in `CompanyProperties` to match the new 9 | HubSpot CompanyProperty endpoints. 10 | 11 | [#167]: https://github.com/adimichele/hubspot-ruby/pull/167 12 | 13 | * [#166] Updates the endpoints referenced in `ContactProperties` to match the new 14 | HubSpot ContactProperty endpoints. 15 | 16 | [#166]: https://github.com/adimichele/hubspot-ruby/pull/166 17 | 18 | ## 0.6.1 (November 29, 2018) 19 | 20 | * [#148] Deprecate the use of the hubspot rake tasks. Deprecating these tasks 21 | includes deprecating the use of `Hubspot::Utils.dump_properties` and 22 | `Hubspot::Utils.restore_properties`. 23 | 24 | [#148]: https://github.com/adimichele/hubspot-ruby/pull/148 25 | 26 | * [#148] Fix backwards compatibility to ensure users can access the hubspot rake 27 | tasks 28 | 29 | [#148]: https://github.com/adimichele/hubspot-ruby/pull/148 30 | 31 | ## 0.6.0 (November 28, 2018) 32 | 33 | * [#141] Add `HubSpot` as an alias of `Hubspot` 34 | 35 | [#141]: https://github.com/adimichele/hubspot-ruby/pull/140 36 | 37 | * [#134] Add support to find recently created or recently modified Companies 38 | 39 | [#134]: https://github.com/adimichele/hubspot-ruby/pull/134 40 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining 2 | a copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to 7 | the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be 10 | included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 17 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 18 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing to Rubygems 2 | 3 | 1. Update gemspec. 4 | 2. Push updates to github. 5 | 3. Build gem with `gem build hubspot-ruby.gemspec`. 6 | 4. Push the resulting .gem file to Rubygems with `gem push` 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'rubygems' 4 | require 'bundler' 5 | begin 6 | Bundler.setup(:default, :development) 7 | rescue Bundler::BundlerError => e 8 | $stderr.puts e.message 9 | $stderr.puts "Run `bundle install` to install missing gems" 10 | exit e.status_code 11 | end 12 | require 'rake' 13 | 14 | require 'rspec/core' 15 | require 'rspec/core/rake_task' 16 | 17 | RSpec::Core::RakeTask.new(:spec) 18 | 19 | desc "Default: runs the full test suite." 20 | task default: :spec 21 | 22 | require 'rdoc/task' 23 | Rake::RDocTask.new do |rdoc| 24 | version = File.exist?('VERSION') ? File.read('VERSION') : "" 25 | 26 | rdoc.rdoc_dir = 'rdoc' 27 | rdoc.title = "hubspot-ruby #{version}" 28 | rdoc.rdoc_files.include('README*') 29 | rdoc.rdoc_files.include('lib/**/*.rb') 30 | end 31 | 32 | Dir.glob('lib/tasks/*.rake').each { |r| load r } 33 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "hubspot-ruby" 5 | 6 | # Include Byebug for debugging 7 | require "byebug" 8 | 9 | # You can add fixtures and/or initialization code here to make experimenting 10 | # with your gem easier. You can also use a different console, if you like. 11 | 12 | # (If you use this, don't forget to add pry to your Gemfile!) 13 | # require "pry" 14 | # Pry.start 15 | 16 | # Configure with the demo key by default 17 | Hubspot.configure(hapikey: 'demo') 18 | 19 | require "irb" 20 | IRB.start(__FILE__) 21 | -------------------------------------------------------------------------------- /gemfiles/activesupport_4.2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "activesupport", "~> 4.2.2" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/activesupport_5.0.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "activesupport", "~> 5.0.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/activesupport_5.1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "activesupport", "~> 5.1.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/activesupport_5.2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "activesupport", "~> 5.2.2" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /hubspot-ruby.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = "hubspot-ruby" 3 | s.version = "0.7.0" 4 | s.require_paths = ["lib"] 5 | s.authors = ["Andrew DiMichele", "Chris Bisnett"] 6 | s.description = "hubspot-ruby is a wrapper for the HubSpot REST API" 7 | s.licenses = ["MIT"] 8 | s.files = [".rspec", "Gemfile", "Guardfile", "LICENSE.txt", "README.md", "RELEASING.md", "Rakefile", "hubspot-ruby.gemspec"] 9 | s.files += Dir["lib/**/*.rb"] 10 | s.files += Dir["lib/**/*.rake"] 11 | s.files += Dir["spec/**/*.rb"] 12 | s.homepage = "http://github.com/adimichele/hubspot-ruby" 13 | s.summary = "hubspot-ruby is a wrapper for the HubSpot REST API" 14 | s.metadata = { 15 | "changelog_uri" => "https://github.com/adimichele/hubspot-ruby/blob/master/History.md" 16 | } 17 | 18 | s.required_ruby_version = ">= 2.3" 19 | 20 | # Add runtime dependencies here 21 | s.add_runtime_dependency "activesupport", ">= 4.2.2" 22 | s.add_runtime_dependency "httparty", ">= 0.10" 23 | 24 | # Add development-only dependencies here 25 | s.add_development_dependency("appraisal", "~> 2.2") 26 | s.add_development_dependency("dotenv") 27 | s.add_development_dependency("rake", "~> 11.0") 28 | s.add_development_dependency("rspec", "~> 3.8") 29 | s.add_development_dependency("rspec-its", "~> 1.2") 30 | s.add_development_dependency("webmock") 31 | s.add_development_dependency("vcr") 32 | s.add_development_dependency("rdoc") 33 | s.add_development_dependency("bundler") 34 | s.add_development_dependency("simplecov") 35 | s.add_development_dependency("awesome_print") 36 | s.add_development_dependency("timecop") 37 | s.add_development_dependency("guard-rspec") 38 | s.add_development_dependency("byebug") 39 | s.add_development_dependency("faker") 40 | s.add_development_dependency("factory_bot") 41 | end 42 | 43 | -------------------------------------------------------------------------------- /lib/hubspot-ruby.rb: -------------------------------------------------------------------------------- 1 | require 'active_support' 2 | require 'active_support/core_ext' 3 | require 'httparty' 4 | require 'hubspot/exceptions' 5 | require 'hubspot/resource' 6 | require 'hubspot/collection' 7 | require 'hubspot/paged_collection' 8 | require 'hubspot/properties' 9 | require 'hubspot/company' 10 | require 'hubspot/company_properties' 11 | require 'hubspot/config' 12 | require 'hubspot/connection' 13 | require 'hubspot/contact' 14 | require 'hubspot/contact_properties' 15 | require 'hubspot/contact_list' 16 | require 'hubspot/form' 17 | require 'hubspot/blog' 18 | require 'hubspot/topic' 19 | require 'hubspot/deal' 20 | require 'hubspot/deal_pipeline' 21 | require 'hubspot/deal_properties' 22 | require 'hubspot/deprecator' 23 | require 'hubspot/owner' 24 | require 'hubspot/engagement' 25 | require 'hubspot/subscription' 26 | require 'hubspot/oauth' 27 | 28 | module Hubspot 29 | def self.configure(config={}) 30 | Hubspot::Config.configure(config) 31 | end 32 | 33 | require 'hubspot/railtie' if defined?(Rails) 34 | end 35 | 36 | # Alias the module for those looking to use the stylized name HubSpot 37 | HubSpot = Hubspot 38 | -------------------------------------------------------------------------------- /lib/hubspot/collection.rb: -------------------------------------------------------------------------------- 1 | class Hubspot::Collection 2 | def initialize(opts = {}, &block) 3 | @options = opts 4 | @fetch_proc = block 5 | fetch 6 | end 7 | 8 | def refresh 9 | fetch 10 | self 11 | end 12 | 13 | def resources 14 | @resources 15 | end 16 | 17 | def update_all(opts = {}) 18 | return true if empty? 19 | 20 | # This assumes that all resources are the same type 21 | resource_class = resources.first.class 22 | unless resource_class.respond_to?(:batch_update) 23 | raise "#{resource_class} does not support bulk update" 24 | end 25 | 26 | resource_class.batch_update(resources, opts) 27 | end 28 | 29 | protected 30 | def fetch 31 | @resources = @fetch_proc.call(@options) 32 | end 33 | 34 | def respond_to_missing?(name, include_private = false) 35 | @resources.respond_to?(name, include_private) 36 | end 37 | 38 | def method_missing(method, *args, &block) 39 | @resources.public_send(method, *args, &block) 40 | end 41 | end -------------------------------------------------------------------------------- /lib/hubspot/company_properties.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class CompanyProperties < Properties 3 | 4 | ALL_PROPERTIES_PATH = "/properties/v1/companies/properties" 5 | ALL_GROUPS_PATH = "/properties/v1/companies/groups" 6 | CREATE_PROPERTY_PATH = "/properties/v1/companies/properties" 7 | UPDATE_PROPERTY_PATH = "/properties/v1/companies/properties/named/:property_name" 8 | DELETE_PROPERTY_PATH = "/properties/v1/companies/properties/named/:property_name" 9 | CREATE_GROUP_PATH = "/properties/v1/companies/groups" 10 | UPDATE_GROUP_PATH = "/properties/v1/companies/groups/named/:group_name" 11 | DELETE_GROUP_PATH = "/properties/v1/companies/groups/named/:group_name" 12 | 13 | class << self 14 | def add_default_parameters(opts={}) 15 | superclass.add_default_parameters(opts) 16 | end 17 | 18 | def all(opts={}, filter={}) 19 | superclass.all(ALL_PROPERTIES_PATH, opts, filter) 20 | end 21 | 22 | def groups(opts={}, filter={}) 23 | superclass.groups(ALL_GROUPS_PATH, opts, filter) 24 | end 25 | 26 | def create!(params={}) 27 | superclass.create!(CREATE_PROPERTY_PATH, params) 28 | end 29 | 30 | def update!(property_name, params={}) 31 | superclass.update!(UPDATE_PROPERTY_PATH, property_name, params) 32 | end 33 | 34 | def delete!(property_name) 35 | superclass.delete!(DELETE_PROPERTY_PATH, property_name) 36 | end 37 | 38 | def create_group!(params={}) 39 | superclass.create_group!(CREATE_GROUP_PATH, params) 40 | end 41 | 42 | def update_group!(group_name, params={}) 43 | superclass.update_group!(UPDATE_GROUP_PATH, group_name, params) 44 | end 45 | 46 | def delete_group!(group_name) 47 | superclass.delete_group!(DELETE_GROUP_PATH, group_name) 48 | end 49 | 50 | def same?(src, dst) 51 | superclass.same?(src, dst) 52 | end 53 | 54 | def valid_params(params) 55 | superclass.valid_params(params) 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/hubspot/config.rb: -------------------------------------------------------------------------------- 1 | require 'logger' 2 | require 'hubspot/connection' 3 | 4 | module Hubspot 5 | class Config 6 | CONFIG_KEYS = [ 7 | :hapikey, :base_url, :portal_id, :logger, :access_token, :client_id, 8 | :client_secret, :redirect_uri, :read_timeout, :open_timeout 9 | ] 10 | DEFAULT_LOGGER = Logger.new(nil) 11 | DEFAULT_BASE_URL = "https://api.hubapi.com".freeze 12 | 13 | class << self 14 | attr_accessor *CONFIG_KEYS 15 | 16 | def configure(config) 17 | config.stringify_keys! 18 | @hapikey = config["hapikey"] 19 | @base_url = config["base_url"] || DEFAULT_BASE_URL 20 | @portal_id = config["portal_id"] 21 | @logger = config["logger"] || DEFAULT_LOGGER 22 | @access_token = config["access_token"] 23 | @client_id = config["client_id"] if config["client_id"].present? 24 | @client_secret = config["client_secret"] if config["client_secret"].present? 25 | @redirect_uri = config["redirect_uri"] if config["redirect_uri"].present? 26 | @read_timeout = config['read_timeout'] || config['timeout'] 27 | @open_timeout = config['open_timeout'] || config['timeout'] 28 | 29 | unless authentication_uncertain? 30 | raise Hubspot::ConfigurationError.new("You must provide either an access_token or an hapikey") 31 | end 32 | 33 | if access_token.present? 34 | Hubspot::Connection.headers("Authorization" => "Bearer #{access_token}") 35 | end 36 | self 37 | end 38 | 39 | def reset! 40 | @hapikey = nil 41 | @base_url = DEFAULT_BASE_URL 42 | @portal_id = nil 43 | @logger = DEFAULT_LOGGER 44 | @access_token = nil 45 | Hubspot::Connection.headers({}) 46 | end 47 | 48 | def ensure!(*params) 49 | params.each do |p| 50 | raise Hubspot::ConfigurationError.new("'#{p}' not configured") unless instance_variable_get "@#{p}" 51 | end 52 | end 53 | 54 | private 55 | 56 | def authentication_uncertain? 57 | access_token.present? ^ hapikey.present? 58 | end 59 | end 60 | 61 | reset! 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/hubspot/contact.rb: -------------------------------------------------------------------------------- 1 | class Hubspot::Contact < Hubspot::Resource 2 | self.id_field = "vid" 3 | self.update_method = "post" 4 | 5 | ALL_PATH = '/contacts/v1/lists/all/contacts/all' 6 | CREATE_PATH = '/contacts/v1/contact' 7 | CREATE_OR_UPDATE_PATH = '/contacts/v1/contact/createOrUpdate/email/:email' 8 | DELETE_PATH = '/contacts/v1/contact/vid/:id' 9 | FIND_PATH = '/contacts/v1/contact/vid/:id/profile' 10 | FIND_BY_EMAIL_PATH = '/contacts/v1/contact/email/:email/profile' 11 | FIND_BY_USER_TOKEN_PATH = '/contacts/v1/contact/utk/:token/profile' 12 | MERGE_PATH = '/contacts/v1/contact/merge-vids/:id/' 13 | SEARCH_PATH = '/contacts/v1/search/query' 14 | UPDATE_PATH = '/contacts/v1/contact/vid/:id/profile' 15 | 16 | class << self 17 | def all(opts = {}) 18 | Hubspot::PagedCollection.new(opts) do |options, offset, limit| 19 | response = Hubspot::Connection.get_json( 20 | ALL_PATH, 21 | options.merge("count" => limit, "vidOffset" => offset) 22 | ) 23 | 24 | contacts = response["contacts"].map { |result| from_result(result) } 25 | [contacts, response["vid-offset"], response["has-more"]] 26 | end 27 | end 28 | 29 | def find_by_email(email) 30 | response = Hubspot::Connection.get_json(FIND_BY_EMAIL_PATH, email: email) 31 | from_result(response) 32 | end 33 | 34 | def find_by_user_token(token) 35 | response = Hubspot::Connection.get_json(FIND_BY_USER_TOKEN_PATH, token: token) 36 | from_result(response) 37 | end 38 | alias_method :find_by_utk, :find_by_user_token 39 | 40 | def create(email, properties = {}) 41 | super(properties.merge("email" => email)) 42 | end 43 | 44 | def create_or_update(email, properties = {}) 45 | request = { 46 | properties: Hubspot::Utils.hash_to_properties(properties.stringify_keys, key_name: "property") 47 | } 48 | response = Hubspot::Connection.post_json(CREATE_OR_UPDATE_PATH, params: {email: email}, body: request) 49 | from_result(response) 50 | end 51 | 52 | def search(query, opts = {}) 53 | Hubspot::PagedCollection.new(opts) do |options, offset, limit| 54 | response = Hubspot::Connection.get_json( 55 | SEARCH_PATH, 56 | options.merge(q: query, offset: offset, count: limit) 57 | ) 58 | 59 | contacts = response["contacts"].map { |result| from_result(result) } 60 | [contacts, response["offset"], response["has-more"]] 61 | end 62 | end 63 | 64 | def merge(primary, secondary) 65 | Hubspot::Connection.post_json( 66 | MERGE_PATH, 67 | params: { id: primary.to_i, no_parse: true }, 68 | body: { "vidToMerge" => secondary.to_i } 69 | ) 70 | 71 | true 72 | end 73 | end 74 | 75 | def name 76 | [firstname, lastname].compact.join(' ') 77 | end 78 | 79 | def merge(contact) 80 | self.class.merge(@id, contact.to_i) 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /lib/hubspot/contact_properties.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class ContactProperties < Properties 3 | 4 | ALL_PROPERTIES_PATH = "/properties/v1/contacts/properties" 5 | ALL_GROUPS_PATH = "/properties/v1/contacts/groups" 6 | CREATE_PROPERTY_PATH = "/properties/v1/contacts/properties" 7 | UPDATE_PROPERTY_PATH = "/properties/v1/contacts/properties/named/:property_name" 8 | DELETE_PROPERTY_PATH = "/properties/v1/contacts/properties/named/:property_name" 9 | CREATE_GROUP_PATH = "/properties/v1/contacts/groups" 10 | UPDATE_GROUP_PATH = "/properties/v1/contacts/groups/named/:group_name" 11 | DELETE_GROUP_PATH = "/properties/v1/contacts/groups/named/:group_name" 12 | 13 | class << self 14 | def add_default_parameters(opts={}) 15 | superclass.add_default_parameters(opts) 16 | end 17 | 18 | def all(opts={}, filter={}) 19 | superclass.all(ALL_PROPERTIES_PATH, opts, filter) 20 | end 21 | 22 | def groups(opts={}, filter={}) 23 | superclass.groups(ALL_GROUPS_PATH, opts, filter) 24 | end 25 | 26 | def create!(params={}) 27 | superclass.create!(CREATE_PROPERTY_PATH, params) 28 | end 29 | 30 | def update!(property_name, params={}) 31 | superclass.update!(UPDATE_PROPERTY_PATH, property_name, params) 32 | end 33 | 34 | def delete!(property_name) 35 | superclass.delete!(DELETE_PROPERTY_PATH, property_name) 36 | end 37 | 38 | def create_group!(params={}) 39 | superclass.create_group!(CREATE_GROUP_PATH, params) 40 | end 41 | 42 | def update_group!(group_name, params={}) 43 | superclass.update_group!(UPDATE_GROUP_PATH, group_name, params) 44 | end 45 | 46 | def delete_group!(group_name) 47 | superclass.delete_group!(DELETE_GROUP_PATH, group_name) 48 | end 49 | 50 | def same?(src, dst) 51 | superclass.same?(src, dst) 52 | end 53 | 54 | def valid_params(params) 55 | superclass.valid_params(params) 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/hubspot/deal_pipeline.rb: -------------------------------------------------------------------------------- 1 | require 'hubspot/utils' 2 | 3 | module Hubspot 4 | # 5 | # HubSpot Deals API 6 | # 7 | # {http://developers.hubspot.com/docs/methods/deal-pipelines/overview} 8 | # 9 | class DealPipeline 10 | PIPELINES_PATH = "/deals/v1/pipelines" 11 | PIPELINE_PATH = "/deals/v1/pipelines/:pipeline_id" 12 | 13 | attr_reader :active 14 | attr_reader :display_order 15 | attr_reader :label 16 | attr_reader :pipeline_id 17 | attr_reader :stages 18 | 19 | def initialize(response_hash) 20 | @active = response_hash["active"] 21 | @display_order = response_hash["displayOrder"] 22 | @label = response_hash["label"] 23 | @pipeline_id = response_hash["pipelineId"] 24 | @stages = response_hash["stages"] 25 | end 26 | 27 | class << self 28 | def find(pipeline_id) 29 | response = Hubspot::Connection.get_json(PIPELINE_PATH, { pipeline_id: pipeline_id }) 30 | new(response) 31 | end 32 | 33 | def all 34 | response = Hubspot::Connection.get_json(PIPELINES_PATH, {}) 35 | response.map { |p| new(p) } 36 | end 37 | 38 | # Creates a DealPipeline 39 | # {https://developers.hubspot.com/docs/methods/deal-pipelines/create-deal-pipeline} 40 | # @return [Hubspot::PipeLine] Company record 41 | def create!(post_data={}) 42 | response = Hubspot::Connection.post_json(PIPELINES_PATH, params: {}, body: post_data) 43 | new(response) 44 | end 45 | end 46 | 47 | # Destroys deal_pipeline 48 | # {http://developers.hubspot.com/docs/methods/companies/delete_company} 49 | # @return [TrueClass] true 50 | def destroy! 51 | Hubspot::Connection.delete_json(PIPELINE_PATH, pipeline_id: @pipeline_id) 52 | end 53 | 54 | def [](stage) 55 | @stages[stage] 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lib/hubspot/deal_properties.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class DealProperties < Properties 3 | 4 | ALL_PROPERTIES_PATH = '/deals/v1/properties' 5 | ALL_GROUPS_PATH = '/deals/v1/groups' 6 | CREATE_PROPERTY_PATH = '/deals/v1/properties/' 7 | UPDATE_PROPERTY_PATH = '/deals/v1/properties/named/:property_name' 8 | DELETE_PROPERTY_PATH = '/deals/v1/properties/named/:property_name' 9 | CREATE_GROUP_PATH = '/deals/v1/groups/' 10 | UPDATE_GROUP_PATH = '/deals/v1/groups/named/:group_name' 11 | DELETE_GROUP_PATH = '/deals/v1/groups/named/:group_name' 12 | 13 | class << self 14 | def add_default_parameters(opts={}) 15 | superclass.add_default_parameters(opts) 16 | end 17 | 18 | def all(opts={}, filter={}) 19 | superclass.all(ALL_PROPERTIES_PATH, opts, filter) 20 | end 21 | 22 | def groups(opts={}, filter={}) 23 | superclass.groups(ALL_GROUPS_PATH, opts, filter) 24 | end 25 | 26 | def create!(params={}) 27 | superclass.create!(CREATE_PROPERTY_PATH, params) 28 | end 29 | 30 | def update!(property_name, params={}) 31 | superclass.update!(UPDATE_PROPERTY_PATH, property_name, params) 32 | end 33 | 34 | def delete!(property_name) 35 | superclass.delete!(DELETE_PROPERTY_PATH, property_name) 36 | end 37 | 38 | def create_group!(params={}) 39 | superclass.create_group!(CREATE_GROUP_PATH, params) 40 | end 41 | 42 | def update_group!(group_name, params={}) 43 | superclass.update_group!(UPDATE_GROUP_PATH, group_name, params) 44 | end 45 | 46 | def delete_group!(group_name) 47 | superclass.delete_group!(DELETE_GROUP_PATH, group_name) 48 | end 49 | 50 | def same?(src, dst) 51 | superclass.same?(src, dst) 52 | end 53 | 54 | def valid_params(params) 55 | superclass.valid_params(params) 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/hubspot/deprecator.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class Deprecator 3 | def self.build(version: "1.0") 4 | ActiveSupport::Deprecation.new(version, "hubspot-ruby") 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/hubspot/exceptions.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class RequestError < StandardError 3 | attr_accessor :response 4 | 5 | def initialize(response, message=nil) 6 | message += "\n" if message 7 | me = super("#{message}Response body: #{response.body}",) 8 | me.response = response 9 | return me 10 | end 11 | end 12 | 13 | class ConfigurationError < StandardError; end 14 | class MissingInterpolation < StandardError; end 15 | class ContactExistsError < RequestError; end 16 | class InvalidParams < StandardError; end 17 | class ApiError < StandardError; end 18 | end 19 | -------------------------------------------------------------------------------- /lib/hubspot/oauth.rb: -------------------------------------------------------------------------------- 1 | require 'httparty' 2 | 3 | module Hubspot 4 | class OAuth < Connection 5 | include HTTParty 6 | 7 | DEFAULT_OAUTH_HEADERS = {"Content-Type" => "application/x-www-form-urlencoded;charset=utf-8"} 8 | 9 | class << self 10 | def refresh(token, params={}, options={}) 11 | oauth_post(token_url, { grant_type: "refresh_token", refresh_token: token }.merge(params), 12 | options) 13 | end 14 | 15 | def create(code, params={}, options={}) 16 | oauth_post(token_url, { grant_type: "authorization_code", code: code }.merge(params), 17 | options) 18 | end 19 | 20 | def authorize_url(scopes, params={}) 21 | client_id = params[:client_id] || Hubspot::Config.client_id 22 | redirect_uri = params[:redirect_uri] || Hubspot::Config.redirect_uri 23 | scopes = Array.wrap(scopes) 24 | 25 | "https://app.hubspot.com/oauth/authorize?client_id=#{client_id}&scope=#{scopes.join("%20")}&redirect_uri=#{redirect_uri}" 26 | end 27 | 28 | def token_url 29 | token_url = Hubspot::Config.base_url + "/oauth/v1/token" 30 | end 31 | 32 | def oauth_post(url, params, options={}) 33 | no_parse = options[:no_parse] || false 34 | 35 | body = { 36 | client_id: Hubspot::Config.client_id, 37 | client_secret: Hubspot::Config.client_secret, 38 | redirect_uri: Hubspot::Config.redirect_uri, 39 | }.merge(params) 40 | 41 | response = post(url, body: body, headers: DEFAULT_OAUTH_HEADERS) 42 | log_request_and_response url, response, body 43 | 44 | raise(Hubspot::RequestError.new(response)) unless response.success? 45 | 46 | no_parse ? response : response.parsed_response 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/hubspot/owner.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | # 3 | # HubSpot Owners API 4 | # 5 | # {http://developers.hubspot.com/docs/methods/owners/get_owners} 6 | # 7 | # TODO: Create an Owner 8 | # TODO: Update an Owner 9 | # TODO: Delete an Owner 10 | class Owner 11 | GET_OWNER_PATH = '/owners/v2/owners/:owner_id' # GET 12 | GET_OWNERS_PATH = '/owners/v2/owners' # GET 13 | CREATE_OWNER_PATH = '/owners/v2/owners' # POST 14 | UPDATE_OWNER_PATH = '/owners/v2/owners/:owner_id' # PUT 15 | DELETE_OWNER_PATH = '/owners/v2/owners/:owner_id' # DELETE 16 | 17 | 18 | attr_reader :properties, :owner_id, :email 19 | 20 | def initialize(property_hash) 21 | @properties = property_hash 22 | @owner_id = @properties['ownerId'] 23 | @email = @properties['email'] 24 | end 25 | 26 | def [](property) 27 | @properties[property] 28 | end 29 | 30 | class << self 31 | def all(include_inactive=false) 32 | path = GET_OWNERS_PATH 33 | params = { includeInactive: include_inactive } 34 | response = Hubspot::Connection.get_json(path, params) 35 | response.map { |r| new(r) } 36 | end 37 | 38 | def find(id, include_inactive=false) 39 | response = Hubspot::Connection.get_json(path, owner_id: id, 40 | include_inactive: include_inactive) 41 | new(response) 42 | end 43 | 44 | def find_by_email(email, include_inactive=false) 45 | path = GET_OWNERS_PATH 46 | params = { email: email, includeInactive: include_inactive } 47 | response = Hubspot::Connection.get_json(path, params) 48 | response.blank? ? nil : new(response.first) 49 | end 50 | 51 | def find_by_emails(emails, include_inactive=false) 52 | emails.map { |email| find_by_email(email, include_inactive) }.reject(&:blank?) 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/hubspot/paged_collection.rb: -------------------------------------------------------------------------------- 1 | class Hubspot::PagedCollection < Hubspot::Collection 2 | attr_accessor :offset, :limit 3 | 4 | def initialize(opts = {}, &block) 5 | @limit_param = opts.delete(:limit_param) || "limit" 6 | @limit = opts.delete(:limit) || 25 7 | @offset_param = opts.delete(:offset_param) || "offset" 8 | @offset = opts.delete(:offset) 9 | 10 | super(opts, &block) 11 | end 12 | 13 | def more? 14 | @has_more 15 | end 16 | 17 | def next_offset 18 | @next_offset 19 | end 20 | 21 | def next_page? 22 | @has_more 23 | end 24 | 25 | def next_page 26 | @offset = next_offset 27 | fetch 28 | self 29 | end 30 | 31 | protected 32 | def fetch 33 | @resources, @next_offset, @has_more = @fetch_proc.call(@options, @offset, @limit) 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/hubspot/railtie.rb: -------------------------------------------------------------------------------- 1 | require 'hubspot-ruby' 2 | require 'rails' 3 | module Hubspot 4 | class Railtie < Rails::Railtie 5 | rake_tasks do 6 | spec = Gem::Specification.find_by_name('hubspot-ruby') 7 | load "#{spec.gem_dir}/lib/tasks/hubspot.rake" 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/hubspot/subscription.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | class Subscription 3 | SUBSCRIPTIONS_PATH = '/email/public/v1/subscriptions' 4 | TIMELINE_PATH = '/email/public/v1/subscriptions/timeline' 5 | SUBSCRIPTION_PATH = '/email/public/v1/subscriptions/:email_address' 6 | 7 | attr_reader :subscribed 8 | attr_reader :marked_as_spam 9 | attr_reader :bounced 10 | attr_reader :status 11 | attr_reader :subscription_statuses 12 | 13 | def initialize(response_hash) 14 | @subscribed = response_hash['subscribed'] 15 | @marked_as_spam = response_hash['markedAsSpam'] 16 | @bounced = response_hash['bounced'] 17 | @status = response_hash['status'] 18 | @subscription_statuses = response_hash['SubscriptionStatuses'] 19 | end 20 | 21 | class << self 22 | def status(email) 23 | response = Hubspot::Connection.get_json(SUBSCRIPTION_PATH, {email_address: email}) 24 | new(response) 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /lib/hubspot/topic.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | # 3 | # HubSpot Topics API 4 | # 5 | class Topic 6 | TOPICS_PATH = "/blogs/v3/topics" 7 | TOPIC_PATH = "/blogs/v3/topics/:topic_id" 8 | 9 | class << self 10 | # Lists the topics 11 | # {https://developers.hubspot.com/docs/methods/blogv2/get_topics) 12 | # @return [Hubspot::Topic] array of topics 13 | def list 14 | response = Hubspot::Connection.get_json(TOPICS_PATH, {}) 15 | response['objects'].map { |t| new(t) } 16 | end 17 | 18 | # Finds the details for a specific topic_id 19 | # {https://developers.hubspot.com/docs/methods/blogv2/get_topics_topic_id } 20 | # @return Hubspot::Topic 21 | def find_by_topic_id(id) 22 | response = Hubspot::Connection.get_json(TOPIC_PATH, { topic_id: id }) 23 | new(response) 24 | end 25 | end 26 | 27 | attr_reader :properties 28 | 29 | def initialize(response_hash) 30 | @properties = response_hash #no need to parse anything, we have properties 31 | end 32 | 33 | def [](property) 34 | @properties[property] 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/tasks/hubspot.rake: -------------------------------------------------------------------------------- 1 | require 'hubspot-ruby' 2 | 3 | namespace :hubspot do 4 | desc 'Dump properties to file' 5 | task :dump_properties, [:kind, :file, :hapikey, :include, :exclude] do |_, args| 6 | Hubspot::Deprecator.build.deprecation_warning("hubspot:dump_properties") 7 | 8 | hapikey = args[:hapikey] || ENV['HUBSPOT_API_KEY'] 9 | kind = args[:kind] 10 | unless %w(contact deal).include?(kind) 11 | raise ArgumentError, ':kind must be either "contact" or "deal"' 12 | end 13 | klass = kind == 'contact' ? Hubspot::ContactProperties : Hubspot::DealProperties 14 | props = Hubspot::Utils::dump_properties(klass, hapikey, build_filter(args)) 15 | if args[:file].blank? 16 | puts JSON.pretty_generate(props) 17 | else 18 | File.open(args[:file], 'w') do |f| 19 | f.write(JSON.pretty_generate(props)) 20 | end 21 | end 22 | end 23 | 24 | desc 'Restore properties from file' 25 | task :restore_properties, [:kind, :file, :hapikey, :dry_run] do |_, args| 26 | Hubspot::Deprecator.build.deprecation_warning("hubspot:restore_properties") 27 | 28 | hapikey = args[:hapikey] || ENV['HUBSPOT_API_KEY'] 29 | if args[:file].blank? 30 | raise ArgumentError, ':file is a required parameter' 31 | end 32 | kind = args[:kind] 33 | unless %w(contact deal).include?(kind) 34 | raise ArgumentError, ':kind must be either "contact" or "deal"' 35 | end 36 | klass = kind == 'contact' ? Hubspot::ContactProperties : Hubspot::DealProperties 37 | file = File.read(args[:file]) 38 | props = JSON.parse(file) 39 | Hubspot::Utils.restore_properties(klass, hapikey, props, args[:dry_run] != 'false') 40 | end 41 | 42 | private 43 | 44 | def build_filter(args) 45 | { include: val_to_array(args[:include]), 46 | exclude: val_to_array(args[:exclude]) 47 | } 48 | end 49 | 50 | def val_to_array(val) 51 | val.blank? ? val : val.split(/\W+/) 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /spec/factories/companies.rb: -------------------------------------------------------------------------------- 1 | 2 | FactoryBot.define do 3 | factory :company, class: Hubspot::Company do 4 | to_create { |instance| instance.save } 5 | 6 | add_attribute(:name) { Faker::Company.name } 7 | add_attribute(:domain) { Faker::Internet.domain_name } 8 | end 9 | end -------------------------------------------------------------------------------- /spec/factories/contacts.rb: -------------------------------------------------------------------------------- 1 | 2 | FactoryBot.define do 3 | factory :contact, class: Hubspot::Contact do 4 | to_create { |instance| instance.save } 5 | 6 | firstname { Faker::Name.first_name } 7 | lastname { Faker::Name.last_name } 8 | email { Faker::Internet.safe_email("#{Time.new.to_i.to_s[-5..-1]}#{(0..3).map { (65 + rand(26)).chr }.join}") } 9 | end 10 | end -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_add_contact_with_an_invalid_company_ID_raises_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/companies/v2/companies/1/contacts/1?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: 'null' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 404 15 | message: Not Found 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:21 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Content-Length: 22 | - '190' 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d6990ee98a136ceae0728e218e93a53eb1556981061; expires=Sun, 03-May-20 27 | 14:44:21 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BFE94E1F0F5FB0729826BCF1CFD012E79B2069A65000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979501' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | X-Hubspot-Notfound: 39 | - 'true' 40 | Access-Control-Allow-Credentials: 41 | - 'false' 42 | Strict-Transport-Security: 43 | - max-age=31536000; includeSubDomains; preload 44 | Expect-Ct: 45 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 46 | Server: 47 | - cloudflare 48 | Cf-Ray: 49 | - 4d1b408fc84157c3-IAD 50 | body: 51 | encoding: UTF-8 52 | string: '{"status":"error","message":"Couldn''t find a company with the ID ''1'' 53 | in portal ''62515''","correlationId":"e2fbd77d-011a-448e-b716-127c26146599","requestId":"e5f62eb2bf0bcfd004e6371b23c3130c"}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:21 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_all_with_a_limit_respects_the_limit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/companies/v2/companies/paged?hapikey=&limit=1&offset= 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:15 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=dc9f014c971b0afa360fe1bb246a93f6f1556981054; expires=Sun, 03-May-20 25 | 14:44:14 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2BDAB94079B0A081FB11A3E1382FD037AF32AFF1CE000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979518' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '58' 36 | Vary: 37 | - Accept-Encoding, User-Agent 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b406849969f70-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"has-more":true,"offset":117000761,"companies":[{"portalId":62515,"companyId":117000761,"isDeleted":false,"properties":{},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}]}' 51 | http_version: 52 | recorded_at: Sat, 04 May 2019 14:44:15 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_all_with_a_limit_returns_a_collection.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/companies/v2/companies/paged?hapikey=&limit=1&offset= 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:14 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=da3c189233ce9174020f84d64b974f1a11556981053; expires=Sun, 03-May-20 25 | 14:44:13 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B12A7F41B26EA82C225E6A14DC19C868B4CCE8A62000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979519' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '59' 36 | Vary: 37 | - Accept-Encoding, User-Agent 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b40636b56573f-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"has-more":true,"offset":117000761,"companies":[{"portalId":62515,"companyId":117000761,"isDeleted":false,"properties":{},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}]}' 51 | http_version: 52 | recorded_at: Sat, 04 May 2019 14:44:14 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/companies/v2/companies/0?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"Foobar"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 404 15 | message: Not Found 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:52 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Content-Length: 22 | - '190' 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=de2241f32219ae19b03994e7e7ec232321556981032; expires=Sun, 03-May-20 27 | 14:43:52 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BF2BF4CECD6C593D8E94419B718142BBABB003225000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979555' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | X-Hubspot-Notfound: 39 | - 'true' 40 | Access-Control-Allow-Credentials: 41 | - 'false' 42 | Strict-Transport-Security: 43 | - max-age=31536000; includeSubDomains; preload 44 | Expect-Ct: 45 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 46 | Server: 47 | - cloudflare 48 | Cf-Ray: 49 | - 4d1b3fdbaed3cf64-IAD 50 | body: 51 | encoding: UTF-8 52 | string: '{"status":"error","message":"Couldn''t find a company with the ID ''0'' 53 | in portal ''62515''","correlationId":"b5a45d72-6aae-440d-8a19-57655b3bce0a","requestId":"09af4fcf24c1891bccea019f4c21cf06"}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:43:52 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails_with_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/companies/v2/companies/0?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"Foobar"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 404 15 | message: Not Found 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:52 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Content-Length: 22 | - '190' 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=de134823efd285b284c0a4a801154ec331556981032; expires=Sun, 03-May-20 27 | 14:43:52 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BED46D4C79E1F2B9D75A1B102CB637010E8BE42FC000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979554' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '58' 38 | X-Hubspot-Notfound: 39 | - 'true' 40 | Access-Control-Allow-Credentials: 41 | - 'false' 42 | Strict-Transport-Security: 43 | - max-age=31536000; includeSubDomains; preload 44 | Expect-Ct: 45 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 46 | Server: 47 | - cloudflare 48 | Cf-Ray: 49 | - 4d1b3fdd8df495ae-IAD 50 | body: 51 | encoding: UTF-8 52 | string: '{"status":"error","message":"Couldn''t find a company with the ID ''0'' 53 | in portal ''62515''","correlationId":"a0cac8b2-78e7-4a4e-976a-ffac432ce5ea","requestId":"c09777ad893f1a2de369da52a52ae3a7"}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:43:52 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_create_with_no_properties_creates_a_new_company.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:56 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=db64cbaf48ab2b3bc0f5df17a00a8dd231556981036; expires=Sun, 03-May-20 27 | 14:43:56 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B49840C0D5562833448F7B5EAE9431B8696BAF168000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979542' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '57' 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b3ff78db0c175-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"portalId":62515,"companyId":1897466917,"isDeleted":false,"properties":{"hs_lastmodifieddate":{"value":"1556981036758","timestamp":1556981036758,"source":"CALCULATED","sourceId":null,"versions":[{"name":"hs_lastmodifieddate","value":"1556981036758","timestamp":1556981036758,"source":"CALCULATED","sourceVid":[],"requestId":"86bf9b24-4e4d-4285-9669-20885e5c1c0b"}]},"createdate":{"value":"1556981036758","timestamp":1556981036758,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1556981036758","timestamp":1556981036758,"source":"API","sourceVid":[],"requestId":"86bf9b24-4e4d-4285-9669-20885e5c1c0b"},{"name":"createdate","value":"1556981036758","timestamp":1556981036758,"sourceId":"API","source":"API","sourceVid":[],"requestId":"86bf9b24-4e4d-4285-9669-20885e5c1c0b"}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}' 51 | http_version: 52 | recorded_at: Sat, 04 May 2019 14:43:56 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_create_with_properties_creates_a_new_company.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"Foo Bar Inc."}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:57 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d001902e7ae7f7e11ffa7553959fbc7701556981037; expires=Sun, 03-May-20 27 | 14:43:57 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B4E2E2C5860F57D5274847B464FE9013DA430594A000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979541' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b3ff94ccdcec4-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"portalId":62515,"companyId":1896332000,"isDeleted":false,"properties":{"hs_lastmodifieddate":{"value":"1556981037033","timestamp":1556981037033,"source":"CALCULATED","sourceId":null,"versions":[{"name":"hs_lastmodifieddate","value":"1556981037033","timestamp":1556981037033,"source":"CALCULATED","sourceVid":[],"requestId":"33b2536e-0795-4944-81ce-3b16728235d1"}]},"name":{"value":"Foo 51 | Bar Inc.","timestamp":1556981037033,"source":"API","sourceId":null,"versions":[{"name":"name","value":"Foo 52 | Bar Inc.","timestamp":1556981037033,"source":"API","sourceVid":[],"requestId":"33b2536e-0795-4944-81ce-3b16728235d1"}]},"createdate":{"value":"1556981037033","timestamp":1556981037033,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1556981037033","timestamp":1556981037033,"source":"API","sourceVid":[],"requestId":"33b2536e-0795-4944-81ce-3b16728235d1"},{"name":"createdate","value":"1556981037033","timestamp":1556981037033,"sourceId":"API","source":"API","sourceVid":[],"requestId":"33b2536e-0795-4944-81ce-3b16728235d1"}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}' 53 | http_version: 54 | recorded_at: Sat, 04 May 2019 14:43:57 GMT 55 | recorded_with: VCR 4.0.0 56 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_create_with_properties_has_the_property_set.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"Foo Bar Inc."}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:57 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d995f159e108bcb0cbc9449da8e6a73da1556981037; expires=Sun, 03-May-20 27 | 14:43:57 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B231EE75CE1CBA2488D6ADFC0D804E289780753B4000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979540' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '58' 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b3ffb7a2dc1ed-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"portalId":62515,"companyId":1896332001,"isDeleted":false,"properties":{"hs_lastmodifieddate":{"value":"1556981037384","timestamp":1556981037384,"source":"CALCULATED","sourceId":null,"versions":[{"name":"hs_lastmodifieddate","value":"1556981037384","timestamp":1556981037384,"source":"CALCULATED","sourceVid":[],"requestId":"be7eeb26-abf0-4170-998a-6953d926fd7a"}]},"name":{"value":"Foo 51 | Bar Inc.","timestamp":1556981037384,"source":"API","sourceId":null,"versions":[{"name":"name","value":"Foo 52 | Bar Inc.","timestamp":1556981037384,"source":"API","sourceVid":[],"requestId":"be7eeb26-abf0-4170-998a-6953d926fd7a"}]},"createdate":{"value":"1556981037384","timestamp":1556981037384,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1556981037384","timestamp":1556981037384,"source":"API","sourceVid":[],"requestId":"be7eeb26-abf0-4170-998a-6953d926fd7a"},{"name":"createdate","value":"1556981037384","timestamp":1556981037384,"sourceId":"API","source":"API","sourceVid":[],"requestId":"be7eeb26-abf0-4170-998a-6953d926fd7a"}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}' 53 | http_version: 54 | recorded_at: Sat, 04 May 2019 14:43:57 GMT 55 | recorded_with: VCR 4.0.0 56 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_create_with_properties_is_persisted.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"Foo Bar Inc."}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:43:57 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=dca10de0b06db40286526d3b75baeb5f31556981037; expires=Sun, 03-May-20 27 | 14:43:57 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BA8A3E0ABAF34E3D5CB0EF3293D0CCE65D5D7576E000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979538' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '56' 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b3ffd1a43cf24-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"portalId":62515,"companyId":1896332002,"isDeleted":false,"properties":{"hs_lastmodifieddate":{"value":"1556981037667","timestamp":1556981037667,"source":"CALCULATED","sourceId":null,"versions":[{"name":"hs_lastmodifieddate","value":"1556981037667","timestamp":1556981037667,"source":"CALCULATED","sourceVid":[],"requestId":"812b5670-80fa-4b29-85c3-8f2e2ddda94d"}]},"name":{"value":"Foo 51 | Bar Inc.","timestamp":1556981037667,"source":"API","sourceId":null,"versions":[{"name":"name","value":"Foo 52 | Bar Inc.","timestamp":1556981037667,"source":"API","sourceVid":[],"requestId":"812b5670-80fa-4b29-85c3-8f2e2ddda94d"}]},"createdate":{"value":"1556981037667","timestamp":1556981037667,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1556981037667","timestamp":1556981037667,"source":"API","sourceVid":[],"requestId":"812b5670-80fa-4b29-85c3-8f2e2ddda94d"},{"name":"createdate","value":"1556981037667","timestamp":1556981037667,"sourceId":"API","source":"API","sourceVid":[],"requestId":"812b5670-80fa-4b29-85c3-8f2e2ddda94d"}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}' 53 | http_version: 54 | recorded_at: Sat, 04 May 2019 14:43:57 GMT 55 | recorded_with: VCR 4.0.0 56 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Company_find_with_an_invalid_ID_raises_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/companies/v2/companies/0?hapikey= 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:43:56 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Content-Length: 20 | - '151' 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d50c420de0daabaf28bb75fe191f257501556981036; expires=Sun, 03-May-20 25 | 14:43:56 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B2AD66FB2FD2DD7261FC60752C0FCFCE4915D75B6000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979543' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '58' 36 | X-Hubspot-Notfound: 37 | - 'true' 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 4d1b3ff61b6d23dc-IAD 48 | body: 49 | encoding: UTF-8 50 | string: '{"status":"error","message":"resource not found","correlationId":"4ad5e1b3-c2b2-4793-b481-d0a5831e941d","requestId":"b7b571273c323fc7331c9515bc23a533"}' 51 | http_version: 52 | recorded_at: Sat, 04 May 2019 14:43:56 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_clears_the_changes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Lorinda"},{"property":"lastname","value":"Will"},{"property":"email","value":"81063wwmj@example.org"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:24 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=ded3e4bf0fc7ea336dbc1c970a0808e3d1556981063; expires=Sun, 03-May-20 27 | 14:44:23 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BD4184792028274D7BBE7222F793C38A6DD0B4030000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979495' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '57' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40a15c49c193-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053074,"canonical-vid":12053074,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mP5LJVjcko2s4gnkV7PkT2tzIc7h_rtcNoktMxdqbVuWgelb5mhqwWFxY25wBDnnuhz8r7TnIKN4p22Ln5nN10yEgn_Tat6rUjfkJaLRgYhYu5he5FBmGHJFjxpemiZzKVFTdfA","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053074","properties":{"firstname":{"value":"Lorinda","versions":[{"value":"Lorinda","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063934,"selected":false}]},"email":{"value":"81063wwmj@example.org","versions":[{"value":"81063wwmj@example.org","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063934,"selected":false}]},"lastname":{"value":"Will","versions":[{"value":"Will","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063934,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053074,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"81063wwmj@example.org","timestamp":1556981063938,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"45774fbc-43d4-4bad-8976-337e340a4385","timestamp":1556981063952,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:24 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_sets_the_ID.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Benny"},{"property":"lastname","value":"Schamberger"},{"property":"email","value":"81063mlec@example.net"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:23 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=dc81fe4a55a5ccbf30d7670e172996ab31556981063; expires=Sun, 03-May-20 27 | 14:44:23 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B80FBD622718E9306C4BD596551D7F4029266965E000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979496' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '58' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b409ec89f9f88-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053024,"canonical-vid":12053024,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mPptcfsMRrBMDqq17SthfZJhUwDtsyFgiLW_I2iEdC8Odcs2hQ9h37dWt_ZBaUUsSQ81MxKXeUyN6oKlNu4qZodX4oIj0caCIIcvgISffZnQtLTkPF_t3f1aWwVWOGcCwzouEyL","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053024","properties":{"firstname":{"value":"Benny","versions":[{"value":"Benny","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063516,"selected":false}]},"email":{"value":"81063mlec@example.net","versions":[{"value":"81063mlec@example.net","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063516,"selected":false}]},"lastname":{"value":"Schamberger","versions":[{"value":"Schamberger","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063516,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053024,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"81063mlec@example.net","timestamp":1556981063522,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"6b79a739-99ee-41b4-8b02-ab1a465bcbe7","timestamp":1556981063534,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:23 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_behaves_like_a_saveable_resource_save_with_a_new_resource_succeeds.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Lucius"},{"property":"lastname","value":"Hilpert"},{"property":"email","value":"81062snfk@example.net"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:23 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d47253ac0b1911ed56c9fe3925d18daf41556981063; expires=Sun, 03-May-20 27 | 14:44:23 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B7448659FD6C682A6FACB9EC694610C8EA74EC3F6000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979497' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b409c4b23c189-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12052974,"canonical-vid":12052974,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mPQ4HGnJ-qj2B06ZDIQSq7Zahu_T5W41J6zQVxYNswci8XfeMhV-Zb6bBUtBWgRCV9JpI_J7VzwATBdIc4139Q094nyAERLhnwpWmqgBBR2dDrSF7K0cirtyxYQwxrHwO8aotjF","profile-url":"https://app.hubspot.com/contacts/62515/contact/12052974","properties":{"firstname":{"value":"Lucius","versions":[{"value":"Lucius","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063121,"selected":false}]},"email":{"value":"81062snfk@example.net","versions":[{"value":"81062snfk@example.net","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063121,"selected":false}]},"lastname":{"value":"Hilpert","versions":[{"value":"Hilpert","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981063121,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12052974,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"81062snfk@example.net","timestamp":1556981063126,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"6872940d-61cb-4a49-9ab2-4ae9e3fdd580","timestamp":1556981063138,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:23 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact/vid/0/profile?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"foobar"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 404 15 | message: Not Found 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:27 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=df22b14291ba4aef37f6ff980460cf9981556981067; expires=Sun, 03-May-20 27 | 14:44:27 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B5D0E77B388290D36601E68574DC2E2C409767B8B000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979487' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '58' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | X-Hubspot-Notfound: 42 | - 'true' 43 | Access-Control-Allow-Credentials: 44 | - 'false' 45 | Strict-Transport-Security: 46 | - max-age=31536000; includeSubDomains; preload 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Server: 50 | - cloudflare 51 | Cf-Ray: 52 | - 4d1b40b92b22c184-IAD 53 | body: 54 | encoding: UTF-8 55 | string: '{"status":"error","message":"resource not found","correlationId":"25ece7d2-a29f-48af-ac1e-5214e9fe2b22","requestId":"249b909d49e4cd09fe9ceb1d1989192a"}' 56 | http_version: 57 | recorded_at: Sat, 04 May 2019 14:44:27 GMT 58 | recorded_with: VCR 4.0.0 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_behaves_like_an_updateable_resource_update_with_an_invalid_resource_fails_with_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact/vid/0/profile?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"foobar"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 404 15 | message: Not Found 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:29 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=df3860ebc3e096b64a30561c4a30bfb241556981069; expires=Sun, 03-May-20 27 | 14:44:29 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BBA23064EB8E7FF0AAF75883C01A2F4CD2A673070000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979486' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | X-Hubspot-Notfound: 42 | - 'true' 43 | Access-Control-Allow-Credentials: 44 | - 'false' 45 | Strict-Transport-Security: 46 | - max-age=31536000; includeSubDomains; preload 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Server: 50 | - cloudflare 51 | Cf-Ray: 52 | - 4d1b40c29c53cf54-IAD 53 | body: 54 | encoding: UTF-8 55 | string: '{"status":"error","message":"resource not found","correlationId":"0c178784-740b-4dcf-806d-182dcd58b1e9","requestId":"23a2ffa5b68f2f3214a7ad5be920435c"}' 56 | http_version: 57 | recorded_at: Sat, 04 May 2019 14:44:29 GMT 58 | recorded_with: VCR 4.0.0 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_create_with_an_invalid_email_address_raises_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"email","value":"an_invalid_email"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 400 15 | message: Bad Request 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:39 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d471e679583030d4e8dca92cafef2ff741556981079; expires=Sun, 03-May-20 27 | 14:44:39 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BE1063EAF8F9BC9081FF37377E5DDE4EB5CB361B5000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979467' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40ffde18c1ed-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"validationResults":[{"isValid":false,"message":"Email address an_invalid_email 54 | is invalid","error":"INVALID_EMAIL","name":"email"}],"status":"error","message":"Property 55 | values were not valid","correlationId":"0a40ba3a-1594-4647-a48d-a84a6af2cb57","requestId":"feac3dd272a81eeb29178aa452ff2364"}' 56 | http_version: 57 | recorded_at: Sat, 04 May 2019 14:44:39 GMT 58 | recorded_with: VCR 4.0.0 59 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_create_with_properties_creates_a_new_contact.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Allison"},{"property":"email","value":"coyu81074@example.org"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:35 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d54eeed29d4473c9a32fa418c2bbdef5b1556981074; expires=Sun, 03-May-20 27 | 14:44:34 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B957F814E2FC1E1BC5FD037CCF125F11DB9E60C72000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979472' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '56' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40e688bccf58-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053474,"canonical-vid":12053474,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mPruc891sE0l71v2l2HUUgbyGNctPsaXwWSm9pvj94jmQ-Z3SVNeZ3H-xa7kzZfzq66x5T2MyvRqQFBm0b6ZF4cHTFvOaR2fJgV6NZnUEYML_4t0dLdaq04_KzI9pcdKPNQREzs","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053474","properties":{"firstname":{"value":"Allison","versions":[{"value":"Allison","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981074987,"selected":false}]},"email":{"value":"coyu81074@example.org","versions":[{"value":"coyu81074@example.org","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981074987,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053474,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"coyu81074@example.org","timestamp":1556981074992,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"66e5e8fa-38f0-4d00-87ac-d9a6a50f066b","timestamp":1556981075005,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:35 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_create_with_properties_has_the_property_set.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Allison"},{"property":"email","value":"pbpk81075@example.net"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:35 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d26abe0a188701f3745aebd47afb51a4b1556981075; expires=Sun, 03-May-20 27 | 14:44:35 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B5BBA7AA36C606C359B8C5740A4B3366E82878BE0000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979471' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40e8dbd395c0-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053524,"canonical-vid":12053524,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mNOQIE4Vsixg05aO1tGmKlHn83spD60s7ZB54KPVBRNi61nJHPmtyUo2IKmiiS68UoqOMV1dV745eDuCOjhQb_3VxSTQlgCiFh39gPDxk1Q-LlR64xOeSf7E1cHs5aYrIXWdeHA","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053524","properties":{"firstname":{"value":"Allison","versions":[{"value":"Allison","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981075389,"selected":false}]},"email":{"value":"pbpk81075@example.net","versions":[{"value":"pbpk81075@example.net","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981075389,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053524,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"pbpk81075@example.net","timestamp":1556981075395,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"ae9b3942-a6b5-4a89-8060-445616103644","timestamp":1556981075424,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:35 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_create_with_properties_is_persisted.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"firstname","value":"Allison"},{"property":"email","value":"gqbs81075@example.net"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:37 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d806098fc08037f16990549c5f38682c91556981076; expires=Sun, 03-May-20 27 | 14:44:36 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B763739D20BC82B341BA29B99D02CF3005C51F746000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979470' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40f1f922c175-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053276,"canonical-vid":12053276,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mOiTcNUHUxIvwpv_mREcpY8SbCjTkOJPgEbA1tdO3jzPeEjiz7VwAKsjoeVkwpdjwpSIoHmnBCC9YaDzd7eDlPIIxPY036_Evj0kt95dmOPr0sPLY9F0PiFlLJPnnPMyFdj09Bd","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053276","properties":{"firstname":{"value":"Allison","versions":[{"value":"Allison","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981076865,"selected":false}]},"email":{"value":"gqbs81075@example.net","versions":[{"value":"gqbs81075@example.net","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981076865,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053276,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"gqbs81075@example.net","timestamp":1556981076869,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"121dbf08-dd81-40ee-a7d0-510ce81a12c3","timestamp":1556981076880,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:37 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_create_without_properties_creates_a_new_contact.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"property":"email","value":"xyak81074@example.net"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:34 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=d3f24ea8de2cd435dc4b3f66e6f4e03051556981074; expires=Sun, 03-May-20 27 | 14:44:34 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2BBD76D600323C77A233FD290FAC79132AD6849426000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979473' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '57' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40e40dbacec4-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"vid":12053275,"canonical-vid":12053275,"merged-vids":[],"portal-id":62515,"is-contact":true,"profile-token":"AO_T-mN1e6MQsIOjbF1SbrDlysA1mIDrq5XB6ZSjPXG0_E86Tq9hwZgnpOhvSikhZRorhxPsG_vT3b52Pj_ctFAm_H82sT4BRZ3v9uMwVZYLxmxdZ0lbKevoNs95vF4W9NmaG_8djfj4","profile-url":"https://app.hubspot.com/contacts/62515/contact/12053275","properties":{"email":{"value":"xyak81074@example.net","versions":[{"value":"xyak81074@example.net","source-type":"API","source-id":null,"source-label":null,"timestamp":1556981074594,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":12053275,"is-deleted":false,"is-contact":false,"pointer-vid":0,"previous-vid":0,"linked-vids":[],"saved-at-timestamp":0,"deleted-changed-timestamp":0,"identities":[{"type":"EMAIL","value":"xyak81074@example.net","timestamp":1556981074598,"is-primary":true,"source":"UNSPECIFIED"},{"type":"LEAD_GUID","value":"81d56379-65fe-40cc-b1a4-0ac1a5442733","timestamp":1556981074610,"source":"UNSPECIFIED"}]}],"merge-audits":[]}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:34 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_find_with_an_invalid_ID_raises_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/contact/vid/0/profile?hapikey= 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:34 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d5af6e5b89e89217cb97f1963dc74bf291556981074; expires=Sun, 03-May-20 25 | 14:44:34 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B79A0DE85775AB97FED8136570DCBA2F2126E2322000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979474' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '58' 36 | Vary: 37 | - Accept-Encoding 38 | - Accept-Encoding 39 | X-Hubspot-Notfound: 40 | - 'true' 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b40e2ca78cf24-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"status":"error","message":"contact does not exist","correlationId":"7bd39b3c-db46-497a-89bb-1e553eeeeb04","requestId":"d53e9612f568210aea835dc141d2c200"}' 54 | http_version: 55 | recorded_at: Sat, 04 May 2019 14:44:34 GMT 56 | recorded_with: VCR 4.0.0 57 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_merge_with_invalid_contact_ids_raises_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact/merge-vids/1/?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"vidToMerge":2}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 400 15 | message: Bad Request 16 | headers: 17 | Date: 18 | - Sat, 04 May 2019 14:44:44 GMT 19 | Content-Type: 20 | - application/json;charset=utf-8 21 | Transfer-Encoding: 22 | - chunked 23 | Connection: 24 | - keep-alive 25 | Set-Cookie: 26 | - __cfduid=dd6e4c80e6fc76ce91df1bb171a75a8ef1556981084; expires=Sun, 03-May-20 27 | 14:44:44 GMT; path=/; domain=.hubapi.com; HttpOnly 28 | X-Trace: 29 | - 2B3419610968BDABD048CD6E59C94F6FE0D4E422C1000000000000000000 30 | X-Hubspot-Ratelimit-Daily: 31 | - '1000000' 32 | X-Hubspot-Ratelimit-Daily-Remaining: 33 | - '979454' 34 | X-Hubspot-Ratelimit-Secondly: 35 | - '60' 36 | X-Hubspot-Ratelimit-Secondly-Remaining: 37 | - '59' 38 | Vary: 39 | - Accept-Encoding 40 | - Accept-Encoding 41 | Access-Control-Allow-Credentials: 42 | - 'false' 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains; preload 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Server: 48 | - cloudflare 49 | Cf-Ray: 50 | - 4d1b41203ab1c1f2-IAD 51 | body: 52 | encoding: UTF-8 53 | string: '{"status":"error","message":"canonical vid is not a valid contact or 54 | is already in the process of being merged","correlationId":"07183c3f-3867-4a1c-b264-c3680ed82231","requestId":"4a37890c8fc6c30556da6644b72f7e7b"}' 55 | http_version: 56 | recorded_at: Sat, 04 May 2019 14:44:44 GMT 57 | recorded_with: VCR 4.0.0 58 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_search_when_the_query_returns_no_contacts_does_not_have_a_next_page.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/search/query?count=25&hapikey=&offset=&q=123xyz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:42 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d85121fe22139586c1de3409cd4d816431556981082; expires=Sun, 03-May-20 25 | 14:44:42 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2BECBFC4251B8CC234F9742AC70FB8640DC3DF2210000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979458' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '59' 36 | Vary: 37 | - Accept-Encoding 38 | - Accept-Encoding 39 | Access-Control-Allow-Credentials: 40 | - 'false' 41 | Strict-Transport-Security: 42 | - max-age=31536000; includeSubDomains; preload 43 | Expect-Ct: 44 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 45 | Server: 46 | - cloudflare 47 | Cf-Ray: 48 | - 4d1b4113ef3c957e-IAD 49 | body: 50 | encoding: UTF-8 51 | string: '{"query":"123xyz","offset":0,"has-more":false,"total":0,"contacts":[]}' 52 | http_version: 53 | recorded_at: Sat, 04 May 2019 14:44:42 GMT 54 | recorded_with: VCR 4.0.0 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_search_when_the_query_returns_no_contacts_does_not_have_more.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/search/query?count=25&hapikey=&offset=&q=123xyz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:42 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d4cae83122d476ab9af2f8e446bfaff061556981081; expires=Sun, 03-May-20 25 | 14:44:41 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B64293F3FA1545E7A92E3DE047F6A35CE015D648E000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979459' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '57' 36 | Vary: 37 | - Accept-Encoding 38 | - Accept-Encoding 39 | Access-Control-Allow-Credentials: 40 | - 'false' 41 | Strict-Transport-Security: 42 | - max-age=31536000; includeSubDomains; preload 43 | Expect-Ct: 44 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 45 | Server: 46 | - cloudflare 47 | Cf-Ray: 48 | - 4d1b411258c69fb8-IAD 49 | body: 50 | encoding: UTF-8 51 | string: '{"query":"123xyz","offset":0,"has-more":false,"total":0,"contacts":[]}' 52 | http_version: 53 | recorded_at: Sat, 04 May 2019 14:44:42 GMT 54 | recorded_with: VCR 4.0.0 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Hubspot_Contact_search_when_the_query_returns_no_contacts_has_no_contacts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/search/query?count=25&hapikey=&offset=&q=123xyz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Sat, 04 May 2019 14:44:41 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d22974880869fcec034dfa64b56de6d371556981081; expires=Sun, 03-May-20 25 | 14:44:41 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B854C0DFFC4D22DC576CA16131293C0FD61BD8B97000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '1000000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '979460' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '58' 36 | Vary: 37 | - Accept-Encoding 38 | - Accept-Encoding 39 | Access-Control-Allow-Credentials: 40 | - 'false' 41 | Strict-Transport-Security: 42 | - max-age=31536000; includeSubDomains; preload 43 | Expect-Ct: 44 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 45 | Server: 46 | - cloudflare 47 | Cf-Ray: 48 | - 4d1b411109e85799-IAD 49 | body: 50 | encoding: UTF-8 51 | string: '{"query":"123xyz","offset":0,"has-more":false,"total":0,"contacts":[]}' 52 | http_version: 53 | recorded_at: Sat, 04 May 2019 14:44:41 GMT 54 | recorded_with: VCR 4.0.0 55 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/blog_posts/all_blog_posts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/content/api/v2/blog-posts?content_group_id=123&created__gt=1344556800000&hapikey=demo&order_by=-created&state=PUBLISHED 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Mon, 19 Nov 2018 15:39:20 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=dd2827db985138ce76890f7bfad1fbd471542641959; expires=Tue, 19-Nov-19 25 | 15:39:19 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2BFC6D2D4D1BED97061BF9B453B1EFA0E45E5002F5000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '160000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '142173' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '59' 36 | Vary: 37 | - Accept-Encoding, User-Agent 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 47c3c4d9baf85a80-BOS 48 | body: 49 | encoding: UTF-8 50 | string: '{"limit":20,"objects":[],"offset":0,"total":0,"total_count":0}' 51 | http_version: 52 | recorded_at: Wed, 10 Oct 2012 00:00:00 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/blog_posts/filter_blog_posts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/content/api/v2/blog-posts?content_group_id=123&created__gt=1344556800000&hapikey=demo&order_by=-created&state=DRAFT 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Date: 16 | - Mon, 19 Nov 2018 16:25:34 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Transfer-Encoding: 20 | - chunked 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=dff5befb63e71fcb8388b5345f4be0bf31542644734; expires=Tue, 19-Nov-19 25 | 16:25:34 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2BF349589BFBAE83FE736A318A842CD15CE36AA6A8000000000000000000 28 | X-Hubspot-Ratelimit-Daily: 29 | - '160000' 30 | X-Hubspot-Ratelimit-Daily-Remaining: 31 | - '139305' 32 | X-Hubspot-Ratelimit-Secondly: 33 | - '60' 34 | X-Hubspot-Ratelimit-Secondly-Remaining: 35 | - '59' 36 | Vary: 37 | - Accept-Encoding, User-Agent 38 | Access-Control-Allow-Credentials: 39 | - 'false' 40 | Strict-Transport-Security: 41 | - max-age=31536000; includeSubDomains; preload 42 | Expect-Ct: 43 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 44 | Server: 45 | - cloudflare 46 | Cf-Ray: 47 | - 47c40896aa4f5a80-BOS 48 | body: 49 | encoding: UTF-8 50 | string: '{"limit":20,"objects":[],"offset":0,"total":0,"total_count":0}' 51 | http_version: 52 | recorded_at: Wed, 10 Oct 2012 00:00:00 GMT 53 | recorded_with: VCR 4.0.0 54 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"New Company 1434405222"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Mon, 15 Jun 2015 21:53:42 GMT 23 | Content-Length: 24 | - '500' 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"portalId":62515,"companyId":43137784,"isDeleted":false,"properties":{"name":{"value":"New 30 | Company 1434405222","timestamp":1434405222565,"source":"API","sourceId":null,"versions":[{"name":"name","value":"New 31 | Company 1434405222","timestamp":1434405222565,"source":"API","sourceVid":[]}]},"createdate":{"value":"1434405222565","timestamp":1434405222565,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1434405222565","timestamp":1434405222565,"source":"API","sourceVid":[]}]}}}' 32 | http_version: 33 | recorded_at: Mon, 15 Jun 2015 21:53:42 GMT 34 | recorded_with: VCR 2.4.0 35 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_create_with_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"domain","value":"new-company-domain-1434405363"},{"name":"name","value":"New 9 | Company with Params 1434405363"}]}' 10 | headers: 11 | Content-Type: 12 | - application/json 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Credentials: 19 | - 'false' 20 | Content-Type: 21 | - application/json; charset=UTF-8 22 | Date: 23 | - Mon, 15 Jun 2015 21:56:04 GMT 24 | Content-Length: 25 | - '759' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: '{"portalId":62515,"companyId":43137824,"isDeleted":false,"properties":{"domain":{"value":"new-company-domain-1434405363","timestamp":1434405364102,"source":"API","sourceId":null,"versions":[{"name":"domain","value":"new-company-domain-1434405363","timestamp":1434405364102,"source":"API","sourceVid":[]}]},"name":{"value":"New 31 | Company with Params 1434405363","timestamp":1434405364102,"source":"API","sourceId":null,"versions":[{"name":"name","value":"New 32 | Company with Params 1434405363","timestamp":1434405364102,"source":"API","sourceVid":[]}]},"createdate":{"value":"1434405364102","timestamp":1434405364102,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1434405364102","timestamp":1434405364102,"source":"API","sourceVid":[]}]}}}' 33 | http_version: 34 | recorded_at: Mon, 15 Jun 2015 21:56:04 GMT 35 | recorded_with: VCR 2.4.0 36 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_destroy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[{"name":"name","value":"newcompany_y_1434460999@hsgem.com"}]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Tue, 16 Jun 2015 13:23:19 GMT 23 | Content-Length: 24 | - '522' 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"portalId":62515,"companyId":43178999,"isDeleted":false,"properties":{"name":{"value":"newcompany_y_1434460999@hsgem.com","timestamp":1434460999517,"source":"API","sourceId":null,"versions":[{"name":"name","value":"newcompany_y_1434460999@hsgem.com","timestamp":1434460999517,"source":"API","sourceVid":[]}]},"createdate":{"value":"1434460999517","timestamp":1434460999517,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1434460999517","timestamp":1434460999517,"source":"API","sourceVid":[]}]}}}' 30 | http_version: 31 | recorded_at: Tue, 16 Jun 2015 13:23:19 GMT 32 | - request: 33 | method: delete 34 | uri: https://api.hubapi.com/companies/v2/companies/43178999?hapikey=demo 35 | body: 36 | encoding: US-ASCII 37 | string: '' 38 | headers: {} 39 | response: 40 | status: 41 | code: 200 42 | message: OK 43 | headers: 44 | Access-Control-Allow-Credentials: 45 | - 'false' 46 | Content-Type: 47 | - application/json; charset=UTF-8 48 | Date: 49 | - Tue, 16 Jun 2015 13:23:19 GMT 50 | Content-Length: 51 | - '37' 52 | Connection: 53 | - keep-alive 54 | body: 55 | encoding: UTF-8 56 | string: '{"companyId":43178999,"deleted":true}' 57 | http_version: 58 | recorded_at: Tue, 16 Jun 2015 13:23:19 GMT 59 | - request: 60 | method: delete 61 | uri: https://api.hubapi.com/companies/v2/companies/?hapikey=demo 62 | body: 63 | encoding: US-ASCII 64 | string: '' 65 | headers: {} 66 | response: 67 | status: 68 | code: 405 69 | message: Method Not Allowed 70 | headers: 71 | Access-Control-Allow-Credentials: 72 | - 'false' 73 | Allow: 74 | - HEAD,POST,GET,OPTIONS 75 | Date: 76 | - Tue, 16 Jun 2015 13:23:20 GMT 77 | Content-Length: 78 | - '0' 79 | Connection: 80 | - keep-alive 81 | body: 82 | encoding: UTF-8 83 | string: '' 84 | http_version: 85 | recorded_at: Tue, 16 Jun 2015 13:23:20 GMT 86 | recorded_with: VCR 2.4.0 87 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_find_by_domain_with_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/companies/v2/domains/example.com/companies?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"limit":2,"requestOptions":{"properties":["name","createdate"]},"offset":{"isPrimary":true,"companyId":117004411}}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '1166' 23 | Date: 24 | - Tue, 03 Oct 2017 19:24:42 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"results":[{"portalId":62515,"companyId":117004426,"isDeleted":false,"properties":{"name":{"value":"A 30 | company name","timestamp":1458392255848,"source":"API","sourceId":null,"versions":[{"name":"name","value":"A 31 | company name","timestamp":1458392255848,"source":"API","sourceVid":[]}]},"createdate":{"value":"1458392255848","timestamp":1458392255848,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1458392255848","timestamp":1458392255848,"source":"API","sourceVid":[]}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]},{"portalId":62515,"companyId":117004551,"isDeleted":false,"properties":{"name":{"value":"A 32 | company name","timestamp":1458392971731,"source":"API","sourceId":null,"versions":[{"name":"name","value":"A 33 | company name","timestamp":1458392971731,"source":"API","sourceVid":[]}]},"createdate":{"value":"1458392971731","timestamp":1458392971731,"source":"API","sourceId":null,"versions":[{"name":"createdate","value":"1458392971731","timestamp":1458392971731,"source":"API","sourceVid":[]}]}},"additionalDomains":[],"stateChanges":[],"mergeAudits":[]}],"hasMore":true,"offset":{"companyId":117004551,"isPrimary":true}}' 34 | http_version: 35 | recorded_at: Tue, 03 Oct 2017 19:24:39 GMT 36 | recorded_with: VCR 3.0.3 37 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/create_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/properties/v1/companies/groups?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '93' 23 | Date: 24 | - Thu, 18 Aug 2016 14:05:14 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100,"hubspotDefined":false}' 30 | http_version: 31 | recorded_at: Thu, 18 Aug 2016 14:05:11 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/create_group_some_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/properties/v1/companies/groups?hapikey= 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group235","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '81' 23 | Date: 24 | - Thu, 18 Aug 2016 14:05:14 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group235","displayName":"","displayOrder":100,"hubspotDefined":false}' 30 | http_version: 31 | recorded_at: Thu, 18 Aug 2016 14:05:12 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/delete_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/companies/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 204 13 | message: No Content 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Thu, 18 Aug 2016 14:05:15 GMT 21 | Connection: 22 | - keep-alive 23 | body: 24 | encoding: UTF-8 25 | string: '' 26 | http_version: 27 | recorded_at: Thu, 18 Aug 2016 14:05:12 GMT 28 | recorded_with: VCR 2.4.0 29 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/delete_non_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/companies/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | X-Hubspot-Notfound: 20 | - 'true' 21 | Content-Length: 22 | - '191' 23 | Date: 24 | - Thu, 18 Aug 2016 14:05:15 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"status":"error","message":"Couldn''t find a Group with the given 30 | name ''ff_group1''.","correlationId":"14388da7-7714-4525-b805-067db1110072","requestId":"79e7e0b3-7d90-4af0-ac43-b5c3ae77b92d"}' 31 | http_version: 32 | recorded_at: Thu, 18 Aug 2016 14:05:13 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/delete_non_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/companies/properties/named/non-existent?hapikey= 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Date: 16 | - Wed, 12 Dec 2018 20:08:22 GMT 17 | Content-Type: 18 | - application/json;charset=utf-8 19 | Content-Length: 20 | - '90' 21 | Connection: 22 | - keep-alive 23 | Set-Cookie: 24 | - __cfduid=d590089625fa7efbb3d64d431eefa65231544645302; expires=Thu, 12-Dec-19 25 | 20:08:22 GMT; path=/; domain=.hubapi.com; HttpOnly 26 | X-Trace: 27 | - 2B27C4CEE0813171055D33701AAE5DD6881C6AEA47000000000000000000 28 | X-Hubspot-Notfound: 29 | - 'true' 30 | Vary: 31 | - Accept-Encoding 32 | Access-Control-Allow-Credentials: 33 | - 'false' 34 | Strict-Transport-Security: 35 | - max-age=31536000; includeSubDomains; preload 36 | Expect-Ct: 37 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 38 | Server: 39 | - cloudflare 40 | Cf-Ray: 41 | - 4882d2955defae32-BOS 42 | body: 43 | encoding: UTF-8 44 | string: '{"status":"error","message":"Couldn''t find a Property with the given 45 | name ''non-existent''"}' 46 | http_version: 47 | recorded_at: Wed, 12 Dec 2018 20:08:22 GMT 48 | recorded_with: VCR 4.0.0 49 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/company_properties/update_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/properties/v1/companies/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '94' 23 | Date: 24 | - Thu, 18 Aug 2016 14:05:15 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100,"hubspotDefined":false}' 30 | http_version: 31 | recorded_at: Thu, 18 Aug 2016 14:05:12 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '{"properties":[{"property":"email","value":"newcontact1361564912@hsgem.com"}]}' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - text/plain; charset=utf-8 19 | Date: 20 | - Fri, 22 Feb 2013 20:28:34 GMT 21 | Server: 22 | - Apache-Coyote/1.1 23 | Content-Length: 24 | - '1084' 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: US-ASCII 29 | string: '{"vid":154963,"portal-id":62515,"profile-token":"AO_T-mO_ghCK-Ia-VTb9_2r9z6sSvJu1gQkVT4Y0GmhKxIP-e3PyPRBHyhh4qeC-yu-5881gXoLArqPN2BvJu9MSJLXCSyJNZjyX0hkD2yvbnkrKBZtpXjS1XtQL2R8VinrL5AZAQ073","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mO_ghCK-Ia-VTb9_2r9z6sSvJu1gQkVT4Y0GmhKxIP-e3PyPRBHyhh4qeC-yu-5881gXoLArqPN2BvJu9MSJLXCSyJNZjyX0hkD2yvbnkrKBZtpXjS1XtQL2R8VinrL5AZAQ073/","properties":{"email":{"value":"newcontact1361564912@hsgem.com","versions":[{"value":"newcontact1361564912@hsgem.com","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564913945,"selected":false}]},"createdate":{"value":"1361564913945","versions":[{"value":"1361564913945","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564913945,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":154963,"identities":[{"type":"EMAIL","value":"newcontact1361564912@hsgem.com","timestamp":1361564913945},{"type":"LEAD_GUID","value":"b8c6e48e-e5b3-4322-b192-27ec5629175e","timestamp":1361564913954}]}]}' 30 | http_version: 31 | recorded_at: Fri, 22 Feb 2013 20:28:34 GMT 32 | - request: 33 | method: post 34 | uri: https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo 35 | body: 36 | encoding: UTF-8 37 | string: '{"properties":[{"property":"email","value":"newcontact1424888102@hsgem.com"}]}' 38 | headers: 39 | Content-Type: 40 | - application/json 41 | response: 42 | status: 43 | code: 405 44 | message: Method Not Allowed 45 | headers: 46 | Access-Control-Allow-Credentials: 47 | - 'false' 48 | Allow: 49 | - HEAD,GET,OPTIONS 50 | Date: 51 | - Wed, 25 Feb 2015 18:15:03 GMT 52 | Vary: 53 | - Accept-Encoding 54 | - Accept-Encoding 55 | Content-Length: 56 | - '0' 57 | Connection: 58 | - keep-alive 59 | body: 60 | encoding: UTF-8 61 | string: '' 62 | http_version: 63 | recorded_at: Wed, 25 Feb 2015 18:15:02 GMT 64 | recorded_with: VCR 2.4.0 65 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_create_existing_email.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '{"properties":[{"property":"email","value":"testingapis@hubspot.com"}]}' 9 | headers: {} 10 | response: 11 | status: 12 | code: 409 13 | message: Conflict 14 | headers: 15 | Content-Type: 16 | - application/json;charset=UTF-8 17 | Date: 18 | - Fri, 22 Feb 2013 20:28:35 GMT 19 | Server: 20 | - Apache-Coyote/1.1 21 | Content-Length: 22 | - '380' 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: US-ASCII 27 | string: '{"status":"error","message":"{\"msg\":\"Contact already existed\",\"error\":\"CONTACT_EXISTS\",\"property\":{\"vid\":82325,\"identities\":[{\"type\":\"EMAIL\",\"value\":\"testingapis@hubspot.com\",\"timestamp\":1345062449327},{\"type\":\"LEAD_GUID\",\"value\":\"c0da5c41-f289-4642-910c-9aa2b0fba245\",\"timestamp\":1345062449333}]}}","guid":"cd0e6f59-c8a3-4ae5-b897-3b3990ebda40"}' 28 | http_version: 29 | recorded_at: Fri, 22 Feb 2013 20:28:35 GMT 30 | - request: 31 | method: post 32 | uri: https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo 33 | body: 34 | encoding: UTF-8 35 | string: '{"properties":[{"property":"email","value":"testingapis@hubspot.com"}]}' 36 | headers: 37 | Content-Type: 38 | - application/json 39 | response: 40 | status: 41 | code: 405 42 | message: Method Not Allowed 43 | headers: 44 | Access-Control-Allow-Credentials: 45 | - 'false' 46 | Allow: 47 | - HEAD,GET,OPTIONS 48 | Date: 49 | - Wed, 25 Feb 2015 18:15:03 GMT 50 | Vary: 51 | - Accept-Encoding 52 | - Accept-Encoding 53 | Content-Length: 54 | - '0' 55 | Connection: 56 | - keep-alive 57 | body: 58 | encoding: UTF-8 59 | string: '' 60 | http_version: 61 | recorded_at: Wed, 25 Feb 2015 18:15:03 GMT 62 | recorded_with: VCR 2.4.0 63 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_create_invalid_email.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '{"properties":[{"property":"email","value":"not_an_email"}]}' 9 | headers: {} 10 | response: 11 | status: 12 | code: 400 13 | message: Bad Request 14 | headers: 15 | Content-Type: 16 | - application/json;charset=UTF-8 17 | Date: 18 | - Fri, 22 Feb 2013 20:28:36 GMT 19 | Server: 20 | - Apache-Coyote/1.1 21 | Content-Length: 22 | - '177' 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: US-ASCII 27 | string: '{"status":"error","message":"Invalid value for type in identity: value: 28 | \"not_an_email\"\ntype: EMAIL\ntimestamp: 1361564916579\n","guid":"74dee415-f9fd-4525-83e6-436df7c2aa56"}' 29 | http_version: 30 | recorded_at: Fri, 22 Feb 2013 20:28:36 GMT 31 | - request: 32 | method: post 33 | uri: https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo 34 | body: 35 | encoding: UTF-8 36 | string: '{"properties":[{"property":"email","value":"not_an_email"}]}' 37 | headers: 38 | Content-Type: 39 | - application/json 40 | response: 41 | status: 42 | code: 405 43 | message: Method Not Allowed 44 | headers: 45 | Access-Control-Allow-Credentials: 46 | - 'false' 47 | Allow: 48 | - HEAD,GET,OPTIONS 49 | Date: 50 | - Wed, 25 Feb 2015 18:15:04 GMT 51 | Vary: 52 | - Accept-Encoding 53 | - Accept-Encoding 54 | Content-Length: 55 | - '0' 56 | Connection: 57 | - keep-alive 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | http_version: 62 | recorded_at: Wed, 25 Feb 2015 18:15:03 GMT 63 | recorded_with: VCR 2.4.0 64 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_create_or_update_invalid_email.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/not_an_email?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"properties":[]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 400 15 | message: Bad Request 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '296' 26 | Date: 27 | - Mon, 20 Jun 2016 17:17:12 GMT 28 | Connection: 29 | - close 30 | body: 31 | encoding: UTF-8 32 | string: '{"status":"error","message":"Property values were not valid","correlationId":"96cb3fe1-c6c8-4986-86ba-b52dfdf0319e","validationResults":[{"isValid":false,"message":"Email 33 | address not_an_email is invalid","error":"INVALID_EMAIL","name":"email"}],"requestId":"7ecd0bd2-b6ec-439e-869c-83f7b1cc7bf5"}' 34 | http_version: 35 | recorded_at: Mon, 20 Jun 2016 17:17:12 GMT 36 | recorded_with: VCR 2.4.0 37 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_create_with_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '{"properties":[{"property":"firstname","value":"Hugh"},{"property":"lastname","value":"Jackman"},{"property":"email","value":"newcontact_x_1361564914@hsgem.com"}]}' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - text/plain; charset=utf-8 19 | Date: 20 | - Fri, 22 Feb 2013 20:28:35 GMT 21 | Server: 22 | - Apache-Coyote/1.1 23 | Content-Length: 24 | - '1416' 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: US-ASCII 29 | string: '{"vid":154964,"portal-id":62515,"profile-token":"AO_T-mMaMO14Jys0CrLFvkD56Xc8f7PvvFmhsvSPDDdm6-6uF2wbsFHaXFthseHCDcYvwjiWsMGmF9JSy1cdRpd2-PHwsGHsvBwWTwTDSH7cfTId6uYx7xpng_5YxQM9KauZgI_NJMKL","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mMaMO14Jys0CrLFvkD56Xc8f7PvvFmhsvSPDDdm6-6uF2wbsFHaXFthseHCDcYvwjiWsMGmF9JSy1cdRpd2-PHwsGHsvBwWTwTDSH7cfTId6uYx7xpng_5YxQM9KauZgI_NJMKL/","properties":{"email":{"value":"newcontact_x_1361564914@hsgem.com","versions":[{"value":"newcontact_x_1361564914@hsgem.com","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"createdate":{"value":"1361564915163","versions":[{"value":"1361564915163","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"lastname":{"value":"Jackman","versions":[{"value":"Jackman","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"firstname":{"value":"Hugh","versions":[{"value":"Hugh","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":154964,"identities":[{"type":"EMAIL","value":"newcontact_x_1361564914@hsgem.com","timestamp":1361564915163},{"type":"LEAD_GUID","value":"49034e6d-f3f4-4018-8b50-1baa22cdb514","timestamp":1361564915173}]}]}' 30 | http_version: 31 | recorded_at: Fri, 22 Feb 2013 20:28:35 GMT 32 | - request: 33 | method: post 34 | uri: https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo 35 | body: 36 | encoding: UTF-8 37 | string: '{"properties":[{"property":"firstname","value":"Hugh"},{"property":"lastname","value":"Jackman"},{"property":"email","value":"newcontact_x_1424888102@hsgem.com"}]}' 38 | headers: 39 | Content-Type: 40 | - application/json 41 | response: 42 | status: 43 | code: 405 44 | message: Method Not Allowed 45 | headers: 46 | Access-Control-Allow-Credentials: 47 | - 'false' 48 | Allow: 49 | - HEAD,GET,OPTIONS 50 | Date: 51 | - Wed, 25 Feb 2015 18:15:03 GMT 52 | Vary: 53 | - Accept-Encoding 54 | - Accept-Encoding 55 | Content-Length: 56 | - '0' 57 | Connection: 58 | - keep-alive 59 | body: 60 | encoding: UTF-8 61 | string: '' 62 | http_version: 63 | recorded_at: Wed, 25 Feb 2015 18:15:02 GMT 64 | recorded_with: VCR 2.4.0 65 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_find_by_id_batch_mode.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/contact/vids/batch?hapikey=demo&vid=82325 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Mon, 23 Feb 2015 01:19:44 GMT 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '2' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "{}" 31 | http_version: 32 | recorded_at: Mon, 23 Feb 2015 01:19:44 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_find_by_utk_batch_mode.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/contact/utks/batch?hapikey=demo&utk=j94344d22178501692f2610c717c2e9b 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Mon, 23 Feb 2015 02:15:02 GMT 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '2' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: "{}" 31 | http_version: 32 | recorded_at: Mon, 23 Feb 2015 02:15:02 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_list_batch_find.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/lists/batch?hapikey=demo&listId=4 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Sat, 21 Feb 2015 13:17:19 GMT 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '986' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: '{"lists":[{"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1336673990262,"lastSizeChangeAt":1418738702960,"error":"","size":4},"dynamic":false,"portalId":62515,"createdAt":1336673951299,"updatedAt":1336673951299,"listId":2,"filters":[[{"operator":"IS_NOT_EMPTY","withinTimeMode":"PAST","property":"twitterhandle"}]],"internalListId":2,"name":"HubSpot-HootSuite 31 | App"},{"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1344891893390,"lastSizeChangeAt":1422468593853,"error":"","size":5},"dynamic":false,"portalId":62515,"createdAt":1344891893390,"listType":"STATIC","updatedAt":1344891893390,"listId":3,"filters":[],"internalListId":5,"name":"staticTest"},{"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1345057450679,"lastSizeChangeAt":1421930685051,"error":"","size":2},"dynamic":false,"portalId":62515,"createdAt":1345057450679,"listType":"STATIC","updatedAt":1345057450679,"listId":4,"filters":[],"internalListId":6,"name":"Workface 32 | Leads"}]}' 33 | http_version: 34 | recorded_at: Sat, 21 Feb 2015 13:17:19 GMT 35 | - request: 36 | method: get 37 | uri: https://api.hubapi.com/contacts/v1/lists/batch?hapikey=demo&list_id=4 38 | body: 39 | encoding: US-ASCII 40 | string: '' 41 | headers: {} 42 | response: 43 | status: 44 | code: 200 45 | message: OK 46 | headers: 47 | Access-Control-Allow-Credentials: 48 | - 'false' 49 | Content-Type: 50 | - application/json; charset=UTF-8 51 | Date: 52 | - Sat, 21 Feb 2015 13:20:29 GMT 53 | Vary: 54 | - Accept-Encoding 55 | - Accept-Encoding 56 | Content-Length: 57 | - '12' 58 | Connection: 59 | - keep-alive 60 | body: 61 | encoding: UTF-8 62 | string: '{"lists":[]}' 63 | http_version: 64 | recorded_at: Sat, 21 Feb 2015 13:20:29 GMT 65 | recorded_with: VCR 2.4.0 66 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_list_destroy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"newcontactlist_1424575628","dynamic":false,"portal_id":null}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Sun, 22 Feb 2015 03:27:08 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '310' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"dynamic":false,"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1424575628874,"lastSizeChangeAt":0,"error":"","size":0},"filters":[],"listType":"STATIC","portalId":62515,"createdAt":1424575628874,"listId":97345,"updatedAt":1424575628874,"internalListId":97397,"name":"newcontactlist_1424575628"}' 33 | http_version: 34 | recorded_at: Sun, 22 Feb 2015 03:27:08 GMT 35 | - request: 36 | method: delete 37 | uri: https://api.hubapi.com/contacts/v1/lists/97345?hapikey=demo 38 | body: 39 | encoding: US-ASCII 40 | string: '' 41 | headers: {} 42 | response: 43 | status: 44 | code: 204 45 | message: No Content 46 | headers: 47 | Access-Control-Allow-Credentials: 48 | - 'false' 49 | Content-Type: 50 | - application/json; charset=UTF-8 51 | Date: 52 | - Sun, 22 Feb 2015 03:27:09 GMT 53 | Vary: 54 | - Accept-Encoding 55 | - Accept-Encoding 56 | Connection: 57 | - keep-alive 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | http_version: 62 | recorded_at: Sun, 22 Feb 2015 03:27:09 GMT 63 | recorded_with: VCR 2.4.0 64 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_list_example.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/contacts/v1/lists/1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Fri, 20 Feb 2015 18:46:55 GMT 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '382' 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: '{"dynamic":true,"metaData":{"processing":"DONE","lastSizeChangeAt":1424402567742,"lastProcessingStateChangeAt":1335448864306,"error":"","size":3355},"listType":"DYNAMIC","filters":[[{"operator":"IS_NOT_EMPTY","withinTimeMode":"PAST","property":"twitterhandle"}]],"listId":1,"portalId":62515,"createdAt":1335448813688,"updatedAt":1335448813688,"internalListId":1,"name":"twitterers"}' 31 | http_version: 32 | recorded_at: Fri, 20 Feb 2015 18:46:55 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_list_refresh.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists/1/refresh?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: "{}" 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 204 15 | message: No Content 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Sun, 22 Feb 2015 03:37:25 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Connection: 27 | - keep-alive 28 | body: 29 | encoding: UTF-8 30 | string: '' 31 | http_version: 32 | recorded_at: Sun, 22 Feb 2015 03:37:25 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_list_update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists/1?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"update list name"}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Sun, 22 Feb 2015 03:21:02 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '435' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1335448864306,"error":"","lastSizeChangeAt":1424566814058,"size":3357},"dynamic":true,"listType":"DYNAMIC","filters":[[{"type":"string","filterFamily":"PropertyValue","operator":"IS_NOT_EMPTY","withinTimeMode":"PAST","property":"twitterhandle"}]],"portalId":62515,"createdAt":1335448813688,"updatedAt":1424575262863,"listId":1,"internalListId":1,"name":"update 33 | list name"}' 34 | http_version: 35 | recorded_at: Sun, 22 Feb 2015 03:21:02 GMT 36 | recorded_with: VCR 2.4.0 37 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/create_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/properties/v1/contacts/groups?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '93' 26 | Date: 27 | - Tue, 05 Jan 2016 22:51:35 GMT 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100,"hubspotDefined":false}' 33 | http_version: 34 | recorded_at: Tue, 05 Jan 2016 22:51:35 GMT 35 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/create_group_some_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/properties/v1/contacts/groups?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group234","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '81' 26 | Date: 27 | - Tue, 05 Jan 2016 22:54:35 GMT 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"name":"ff_group234","displayName":"","displayOrder":100,"hubspotDefined":false}' 33 | http_version: 34 | recorded_at: Tue, 05 Jan 2016 22:54:35 GMT 35 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/create_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/properties/v1/contacts/properties?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"my_new_property","groupName":"contactinformation","description":"What 9 | kind of x would you like?","fieldType":"text","formField":true,"type":"string","displayOrder":0,"label":"This 10 | is my new property","options":[]}' 11 | headers: 12 | Content-Type: 13 | - application/json 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Access-Control-Allow-Credentials: 20 | - 'false' 21 | Content-Type: 22 | - application/json; charset=UTF-8 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '413' 28 | Date: 29 | - Tue, 05 Jan 2016 22:51:32 GMT 30 | Connection: 31 | - keep-alive 32 | body: 33 | encoding: UTF-8 34 | string: '{"name":"my_new_property","label":"This is my new property","description":"What 35 | kind of x would you like?","groupName":"contactinformation","type":"string","fieldType":"text","hidden":false,"options":[],"deleted":false,"displayOrder":0,"formField":true,"readOnlyValue":false,"readOnlyDefinition":false,"mutableDefinitionNotDeletable":false,"calculated":false,"externalOptions":false,"displayMode":"current_value"}' 36 | http_version: 37 | recorded_at: Tue, 05 Jan 2016 22:51:32 GMT 38 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/delete_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/contacts/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 204 13 | message: No Content 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Vary: 20 | - Accept-Encoding 21 | - Accept-Encoding 22 | Date: 23 | - Tue, 05 Jan 2016 22:51:36 GMT 24 | Connection: 25 | - keep-alive 26 | body: 27 | encoding: UTF-8 28 | string: '' 29 | http_version: 30 | recorded_at: Tue, 05 Jan 2016 22:51:36 GMT 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/delete_non_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/contacts/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Vary: 20 | - Accept-Encoding 21 | - Accept-Encoding 22 | X-Hubspot-Notfound: 23 | - 'true' 24 | Content-Length: 25 | - '191' 26 | Date: 27 | - Tue, 05 Jan 2016 22:51:36 GMT 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"status":"error","message":"Couldn''t find a Group with the given 33 | name ''ff_group1''.","correlationId":"e520d302-1378-43a0-9158-3dd7289f10e4","requestId":"6c614438-4ef3-404f-b93e-d563df3d53e6"}' 34 | http_version: 35 | recorded_at: Tue, 05 Jan 2016 22:51:36 GMT 36 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/delete_non_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/contacts/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Vary: 20 | - Accept-Encoding 21 | - Accept-Encoding 22 | X-Hubspot-Notfound: 23 | - 'true' 24 | Content-Length: 25 | - '199' 26 | Date: 27 | - Tue, 05 Jan 2016 22:51:33 GMT 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"status":"error","message":"Couldn''t find a Property with the given 33 | name ''my_new_property''","correlationId":"0f4ca9a2-b8ae-4c1d-902c-f7a64d5a7cb1","requestId":"6fc4226a-5216-46af-b31a-da880922efd3"}' 34 | http_version: 35 | recorded_at: Tue, 05 Jan 2016 22:51:33 GMT 36 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/delete_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/properties/v1/contacts/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 204 13 | message: No Content 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Vary: 20 | - Accept-Encoding 21 | - Accept-Encoding 22 | Date: 23 | - Tue, 05 Jan 2016 22:51:33 GMT 24 | Connection: 25 | - keep-alive 26 | body: 27 | encoding: UTF-8 28 | string: '' 29 | http_version: 30 | recorded_at: Tue, 05 Jan 2016 22:51:33 GMT 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/update_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/properties/v1/contacts/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Vary: 22 | - Accept-Encoding 23 | - Accept-Encoding 24 | Content-Length: 25 | - '94' 26 | Date: 27 | - Tue, 05 Jan 2016 22:51:36 GMT 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100,"hubspotDefined":false}' 33 | http_version: 34 | recorded_at: Tue, 05 Jan 2016 22:51:36 GMT 35 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_properties/update_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/properties/v1/contacts/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"my_new_property","groupName":"contactinformation","description":"What 9 | is their favorite flavor?","fieldType":"text","formField":true,"type":"string","displayOrder":0,"label":"This 10 | is my new property","options":[]}' 11 | headers: 12 | Content-Type: 13 | - application/json 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Access-Control-Allow-Credentials: 20 | - 'false' 21 | Content-Type: 22 | - application/json; charset=UTF-8 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '397' 28 | Date: 29 | - Tue, 05 Jan 2016 22:51:32 GMT 30 | Connection: 31 | - keep-alive 32 | body: 33 | encoding: UTF-8 34 | string: '{"name":"my_new_property","label":"This is my new property","description":"What 35 | is their favorite flavor?","groupName":"contactinformation","type":"string","fieldType":"text","hidden":false,"options":[],"displayOrder":0,"formField":true,"readOnlyValue":false,"readOnlyDefinition":false,"mutableDefinitionNotDeletable":false,"calculated":false,"externalOptions":false,"displayMode":"current_value"}' 36 | http_version: 37 | recorded_at: Tue, 05 Jan 2016 22:51:32 GMT 38 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/contact_update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/contact/vid/invalid/profile?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: ! '{"properties":[{"property":"firstname","value":"Steve"},{"property":"lastname","value":"Cunningham"}]}' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Content-Type: 16 | - text/html;charset=utf-8 17 | Date: 18 | - Fri, 22 Feb 2013 20:29:45 GMT 19 | Server: 20 | - Apache-Coyote/1.1 21 | Content-Length: 22 | - '979' 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: US-ASCII 27 | string: ! 'Apache Tomcat/6.0.30 - Error report

HTTP 35 | Status 404 - Not Found


type Status 36 | report

message Not Found

description The 37 | requested resource (Not Found) is not available.


Apache 38 | Tomcat/6.0.30

' 39 | http_version: 40 | recorded_at: Fri, 22 Feb 2013 20:29:46 GMT 41 | - request: 42 | method: post 43 | uri: https://api.hubapi.com/contacts/v1/contact/vid/82325/profile?hapikey=demo 44 | body: 45 | encoding: US-ASCII 46 | string: ! '{"properties":[{"property":"firstname","value":"Steve"},{"property":"lastname","value":"Cunningham"}]}' 47 | headers: {} 48 | response: 49 | status: 50 | code: 204 51 | message: No Content 52 | headers: 53 | Access-Control-Allow-Credentials: 54 | - 'false' 55 | Date: 56 | - Fri, 22 Feb 2013 20:31:03 GMT 57 | Server: 58 | - Apache-Coyote/1.1 59 | Connection: 60 | - keep-alive 61 | body: 62 | encoding: US-ASCII 63 | string: '' 64 | http_version: 65 | recorded_at: Fri, 22 Feb 2013 20:31:03 GMT 66 | recorded_with: VCR 2.4.0 67 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/create_list.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"testing list","dynamic":false,"portal_id":null}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Sun, 22 Feb 2015 02:24:20 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '297' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"metaData":{"processing":"DONE","lastProcessingStateChangeAt":1424571860081,"lastSizeChangeAt":0,"error":"","size":0},"dynamic":false,"listType":"STATIC","createdAt":1424571860081,"listId":97344,"updatedAt":1424571860081,"filters":[],"portalId":62515,"internalListId":97396,"name":"testing 33 | list"}' 34 | http_version: 35 | recorded_at: Sun, 22 Feb 2015 02:24:20 GMT 36 | recorded_with: VCR 2.4.0 37 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/create_list_with_filters.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"list with filters","filters":[[{"operator":"EQ","value":"@hubspot","property":"twitterhandle","type":"string"}]],"dynamic":false,"portal_id":null}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Wed, 25 Feb 2015 15:20:55 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '446' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"metaData":{"processing":"INITIALIZING","error":"","lastProcessingStateChangeAt":1424877655355,"lastSizeChangeAt":0,"size":0},"dynamic":false,"filters":[[{"operator":"EQ","type":"string","filterFamily":"PropertyValue","withinTimeMode":"PAST","property":"twitterhandle","value":"@hubspot"}]],"listId":97909,"portalId":62515,"createdAt":1424877655355,"updatedAt":1424877655355,"listType":"STATIC","internalListId":97963,"name":"list 33 | with filters"}' 34 | http_version: 35 | recorded_at: Wed, 25 Feb 2015 15:20:55 GMT 36 | recorded_with: VCR 2.4.0 37 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_all_groups.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/deals/v1/groups?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Content-Length: 20 | - '204' 21 | Date: 22 | - Tue, 05 Jan 2016 22:51:39 GMT 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: UTF-8 27 | string: '[{"name":"dealinformation","displayName":"Deal Information","displayOrder":0},{"name":"workflowmax","displayName":"WorkflowMAX","displayOrder":1},{"name":"ff_group23","displayName":"","displayOrder":100}]' 28 | http_version: 29 | recorded_at: Tue, 05 Jan 2016 22:51:39 GMT 30 | recorded_with: VCR 2.4.0 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/deals/v1/deal?hapikey=demo&portalId=62515 6 | body: 7 | encoding: UTF-8 8 | string: '{"portalId":62515,"associations":{"associatedCompanyIds":[8954037],"associatedVids":[27136]},"properties":[]}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Mon, 08 Dec 2014 13:10:35 GMT 23 | Content-Length: 24 | - '562' 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"portalId":62515,"dealId":1169756,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"createdate":{"value":"1418044235821","timestamp":1418044235821,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1418044235821","timestamp":1418044235821,"sourceVid":[]}]},"hs_createdate":{"value":"1418044235821","timestamp":1418044235821,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1418044235821","timestamp":1418044235821,"sourceVid":[]}]}}}' 30 | http_version: 31 | recorded_at: Mon, 08 Dec 2014 13:11:06 GMT 32 | - request: 33 | method: post 34 | uri: https://api.hubapi.com/deals/v1/deal?hapikey=demo 35 | body: 36 | encoding: UTF-8 37 | string: '{"portalId":62515,"associations":{"associatedCompanyIds":[8954037],"associatedVids":[27136]},"properties":[]}' 38 | headers: 39 | Content-Type: 40 | - application/json 41 | response: 42 | status: 43 | code: 200 44 | message: OK 45 | headers: 46 | Access-Control-Allow-Credentials: 47 | - 'false' 48 | Content-Type: 49 | - application/json; charset=UTF-8 50 | Date: 51 | - Sun, 22 Feb 2015 16:16:53 GMT 52 | Content-Length: 53 | - '562' 54 | Connection: 55 | - keep-alive 56 | body: 57 | encoding: UTF-8 58 | string: '{"portalId":62515,"dealId":2153357,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"hs_createdate":{"value":"1424621813221","timestamp":1424621813221,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1424621813221","timestamp":1424621813221,"sourceVid":[]}]},"createdate":{"value":"1424621813221","timestamp":1424621813221,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1424621813221","timestamp":1424621813221,"sourceVid":[]}]}}}' 59 | http_version: 60 | recorded_at: Sun, 22 Feb 2015 16:16:53 GMT 61 | recorded_with: VCR 2.4.0 62 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_create_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/deals/v1/groups/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '70' 23 | Date: 24 | - Tue, 05 Jan 2016 22:51:40 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group1","displayName":"Test Group One","displayOrder":100}' 30 | http_version: 31 | recorded_at: Tue, 05 Jan 2016 22:51:40 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_create_group_some_params.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/deals/v1/groups/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group234","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '58' 23 | Date: 24 | - Tue, 05 Jan 2016 22:54:35 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group234","displayName":"","displayOrder":100}' 30 | http_version: 31 | recorded_at: Tue, 05 Jan 2016 22:54:35 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_create_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/deals/v1/properties/?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"my_new_property","groupName":"dealinformation","description":"How 9 | much money do you have?","fieldType":"text","formField":true,"type":"string","displayOrder":0,"label":"This 10 | is my new property","options":[{"description":"","value":"Over $50K","label":"Over 11 | $50K","hidden":false,"displayOrder":0},{"description":"","value":"Under $50K","label":"Under 12 | $50K","hidden":false,"displayOrder":1}]}' 13 | headers: 14 | Content-Type: 15 | - application/json 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Access-Control-Allow-Credentials: 22 | - 'false' 23 | Content-Type: 24 | - application/json; charset=UTF-8 25 | Content-Length: 26 | - '658' 27 | Date: 28 | - Tue, 05 Jan 2016 22:51:38 GMT 29 | Connection: 30 | - keep-alive 31 | body: 32 | encoding: UTF-8 33 | string: '{"name":"my_new_property","label":"This is my new property","description":"How 34 | much money do you have?","groupName":"dealinformation","type":"string","fieldType":"text","options":[{"description":"","value":"Over 35 | $50K","readOnly":null,"label":"Over $50K","displayOrder":0,"hidden":false,"doubleData":null},{"description":"","value":"Under 36 | $50K","readOnly":null,"label":"Under $50K","displayOrder":1,"hidden":false,"doubleData":null}],"formField":true,"displayOrder":0,"readOnlyDefinition":false,"hidden":false,"mutableDefinitionNotDeletable":false,"displayMode":"current_value","deleted":false,"calculated":false,"readOnlyValue":false,"externalOptions":false}' 37 | http_version: 38 | recorded_at: Tue, 05 Jan 2016 22:51:38 GMT 39 | recorded_with: VCR 2.4.0 40 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_delete_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/deals/v1/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 204 13 | message: No Content 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Tue, 05 Jan 2016 22:51:41 GMT 21 | Connection: 22 | - keep-alive 23 | body: 24 | encoding: UTF-8 25 | string: '' 26 | http_version: 27 | recorded_at: Tue, 05 Jan 2016 22:51:41 GMT 28 | recorded_with: VCR 2.4.0 29 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_delete_non_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/deals/v1/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | X-Hubspot-Notfound: 20 | - 'true' 21 | X-Trace: 22 | - 1B41F22567BAE9B8C25CFB9119D6288D57041F0FFD6E9486A26FC614EA 23 | Content-Length: 24 | - '191' 25 | Date: 26 | - Tue, 05 Jan 2016 22:51:41 GMT 27 | Connection: 28 | - keep-alive 29 | body: 30 | encoding: UTF-8 31 | string: '{"status":"error","message":"Couldn''t find a Group with the given 32 | name ''ff_group1''.","correlationId":"962b3684-ab95-4aee-8c14-540437dbfa7a","requestId":"61f33c20-757b-4cdd-a86b-eab29f915e11"}' 33 | http_version: 34 | recorded_at: Tue, 05 Jan 2016 22:51:41 GMT 35 | recorded_with: VCR 2.4.0 36 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_delete_non_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/deals/v1/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 404 13 | message: Not Found 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | X-Hubspot-Notfound: 20 | - 'true' 21 | Content-Length: 22 | - '199' 23 | Date: 24 | - Tue, 05 Jan 2016 22:51:39 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"status":"error","message":"Couldn''t find a Property with the given 30 | name ''my_new_property''","correlationId":"74a854fa-b3a6-48ff-b4f4-1d8633407e0b","requestId":"1e67ba24-3f95-4dff-a57f-523f74f17c44"}' 31 | http_version: 32 | recorded_at: Tue, 05 Jan 2016 22:51:39 GMT 33 | recorded_with: VCR 2.4.0 34 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_delete_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://api.hubapi.com/deals/v1/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 204 13 | message: No Content 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Date: 20 | - Tue, 05 Jan 2016 22:51:39 GMT 21 | Connection: 22 | - keep-alive 23 | body: 24 | encoding: UTF-8 25 | string: '' 26 | http_version: 27 | recorded_at: Tue, 05 Jan 2016 22:51:39 GMT 28 | recorded_with: VCR 2.4.0 29 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_groups_example.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/deals/v1/groups?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Content-Length: 20 | - '204' 21 | Date: 22 | - Tue, 05 Jan 2016 22:51:40 GMT 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: UTF-8 27 | string: '[{"name":"dealinformation","displayName":"Deal Information","displayOrder":0},{"name":"workflowmax","displayName":"WorkflowMAX","displayOrder":1},{"name":"ff_group23","displayName":"","displayOrder":100}]' 28 | http_version: 29 | recorded_at: Tue, 05 Jan 2016 22:51:40 GMT 30 | recorded_with: VCR 2.4.0 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_groups_included.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/deals/v1/groups?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Content-Length: 20 | - '204' 21 | Date: 22 | - Tue, 05 Jan 2016 22:51:40 GMT 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: UTF-8 27 | string: '[{"name":"dealinformation","displayName":"Deal Information","displayOrder":0},{"name":"workflowmax","displayName":"WorkflowMAX","displayOrder":1},{"name":"ff_group23","displayName":"","displayOrder":100}]' 28 | http_version: 29 | recorded_at: Tue, 05 Jan 2016 22:51:40 GMT 30 | recorded_with: VCR 2.4.0 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_groups_not_excluded.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/deals/v1/groups?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Content-Length: 20 | - '204' 21 | Date: 22 | - Tue, 05 Jan 2016 22:51:40 GMT 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: UTF-8 27 | string: '[{"name":"dealinformation","displayName":"Deal Information","displayOrder":0},{"name":"workflowmax","displayName":"WorkflowMAX","displayOrder":1},{"name":"ff_group23","displayName":"","displayOrder":100}]' 28 | http_version: 29 | recorded_at: Tue, 05 Jan 2016 22:51:40 GMT 30 | recorded_with: VCR 2.4.0 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_update_group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/deals/v1/groups/named/ff_group1?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Content-Length: 22 | - '71' 23 | Date: 24 | - Tue, 05 Jan 2016 22:51:41 GMT 25 | Connection: 26 | - keep-alive 27 | body: 28 | encoding: UTF-8 29 | string: '{"name":"ff_group1","displayName":"Test Group OneA","displayOrder":100}' 30 | http_version: 31 | recorded_at: Tue, 05 Jan 2016 22:51:41 GMT 32 | recorded_with: VCR 2.4.0 33 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/deal_update_property.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: put 5 | uri: https://api.hubapi.com/deals/v1/properties/named/my_new_property?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":"my_new_property","groupName":"dealinformation","description":"What 9 | is their favorite flavor?","fieldType":"text","formField":true,"type":"string","displayOrder":0,"label":"This 10 | is my new property","options":[{"description":"","value":"Over $50K","label":"Over 11 | $50K","hidden":false,"displayOrder":0},{"description":"","value":"Under $50K","label":"Under 12 | $50K","hidden":false,"displayOrder":1}]}' 13 | headers: 14 | Content-Type: 15 | - application/json 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Access-Control-Allow-Credentials: 22 | - 'false' 23 | Content-Type: 24 | - application/json; charset=UTF-8 25 | Content-Length: 26 | - '645' 27 | Date: 28 | - Tue, 05 Jan 2016 22:51:38 GMT 29 | Connection: 30 | - keep-alive 31 | body: 32 | encoding: UTF-8 33 | string: '{"name":"my_new_property","label":"This is my new property","description":"What 34 | is their favorite flavor?","groupName":"dealinformation","type":"string","fieldType":"text","formField":true,"displayOrder":0,"readOnlyValue":false,"readOnlyDefinition":false,"hidden":false,"mutableDefinitionNotDeletable":false,"calculated":false,"externalOptions":false,"displayMode":"current_value","options":[{"description":"","label":"Over 35 | $50K","displayOrder":0,"hidden":false,"doubleData":null,"readOnly":null,"value":"Over 36 | $50K"},{"description":"","label":"Under $50K","displayOrder":1,"hidden":false,"doubleData":null,"readOnly":null,"value":"Under 37 | $50K"}]}' 38 | http_version: 39 | recorded_at: Tue, 05 Jan 2016 22:51:38 GMT 40 | recorded_with: VCR 2.4.0 41 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_associated_example.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/engagements/v1/engagements/58699206?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Access-Control-Allow-Headers: 18 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 19 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 20 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 21 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 22 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 23 | Access-Control-Allow-Methods: 24 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 25 | Content-Type: 26 | - application/json; charset=UTF-8 27 | Content-Length: 28 | - '609' 29 | Date: 30 | - Sat, 08 Oct 2016 14:14:11 GMT 31 | Connection: 32 | - keep-alive 33 | Set-Cookie: 34 | - ak_bmsc=52386C03709960182CF5EF3FD50E1C860215F0344237000033FFF857E1146A20~plQ7f00AceutrFkQzt9rRKnOurC2R4w9T1EFmBdgKHz1q3Dw6v0Pqs2+xQaAVambbVn/v6ZwhduZ2GkSs+6mT0XnyRkswTpBFzivaYSPz2ZG9bz1Yb+9lgGGSs+k9M+CNzEdlEMq1Z37jX28K84xTEc1nyTWmsLp0Ai7SJoU9/tWkrSoLiQzstoPEwk4ghXSLngjBmY8uJCWMx82ZIeUDS+U0qiEhW7bx1VsrUQQdfaMQ=; 35 | expires=Sat, 08 Oct 2016 16:14:11 GMT; max-age=7200; path=/; domain=.hubapi.com; 36 | HttpOnly 37 | body: 38 | encoding: UTF-8 39 | string: '{"engagement":{"id":58699206,"portalId":62515,"active":true,"createdAt":1459244935877,"lastUpdated":1459244935877,"createdBy":215482,"modifiedBy":215482,"ownerId":70,"type":"EMAIL","uid":"828e5c1e-e8b0-3856-a4d0-42b5e54843bf","timestamp":1459244935871},"associations":{"contactIds":[1085724],"companyIds":[184896670],"dealIds":[],"ownerIds":[],"workflowIds":[]},"metadata":{"from":{"email":"testapi@hubspot.com","firstName":"Test 40 | API","lastName":"Anwar"},"to":[{"email":"Brian Halligan (Sample Contact) "}],"cc":[],"bcc":[],"subject":"qghgh","html":"sqdgsfg","text":"sqdgsfg","status":"SENT"}}' 41 | http_version: 42 | recorded_at: Sat, 08 Oct 2016 14:14:11 GMT 43 | recorded_with: VCR 2.4.0 44 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_call_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/engagements/v1/engagements?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"engagement":{"type":"CALL"},"associations":{"contactIds":[null],"dealIds":[null],"ownerIds":[null]},"metadata":{"body":"Test 9 | call","status":"COMPLETED","durationMilliseconds":0}}' 10 | headers: 11 | Content-Type: 12 | - application/json 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Credentials: 19 | - 'false' 20 | Access-Control-Allow-Headers: 21 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 22 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 23 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 24 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 25 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 26 | Access-Control-Allow-Methods: 27 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 28 | Content-Type: 29 | - application/json; charset=UTF-8 30 | Content-Length: 31 | - '327' 32 | Date: 33 | - Thu, 15 Dec 2016 14:25:08 GMT 34 | Connection: 35 | - keep-alive 36 | body: 37 | encoding: UTF-8 38 | string: '{"engagement":{"id":185916081,"portalId":62515,"active":true,"createdAt":1481811908160,"lastUpdated":1481811908160,"type":"CALL","timestamp":1481811908160},"associations":{"contactIds":[],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"metadata":{"status":"COMPLETED","durationMilliseconds":0,"body":"Test 39 | call"}}' 40 | http_version: 41 | recorded_at: Thu, 15 Dec 2016 14:25:08 GMT 42 | recorded_with: VCR 2.4.0 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_call_example.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/engagements/v1/engagements/4709059?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Access-Control-Allow-Headers: 18 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 19 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 20 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 21 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 22 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 23 | Access-Control-Allow-Methods: 24 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 25 | Content-Type: 26 | - application/json; charset=UTF-8 27 | Content-Length: 28 | - '373' 29 | Date: 30 | - Thu, 15 Dec 2016 14:25:36 GMT 31 | Connection: 32 | - keep-alive 33 | body: 34 | encoding: UTF-8 35 | string: '{"engagement":{"id":4709059,"portalId":62515,"active":true,"createdAt":1428586724779,"lastUpdated":1479827851650,"createdBy":215482,"modifiedBy":215482,"ownerId":70,"type":"CALL","timestamp":1428565020000},"associations":{"contactIds":[],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"attachments":[],"metadata":{"durationMilliseconds":0,"body":"test 36 | call"}}' 37 | http_version: 38 | recorded_at: Thu, 15 Dec 2016 14:25:36 GMT 39 | recorded_with: VCR 2.4.0 40 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_call_find.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/engagements/v1/engagements/4709059?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Access-Control-Allow-Headers: 18 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 19 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 20 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 21 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 22 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 23 | Access-Control-Allow-Methods: 24 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 25 | Content-Type: 26 | - application/json; charset=UTF-8 27 | Content-Length: 28 | - '373' 29 | Date: 30 | - Thu, 15 Dec 2016 14:25:36 GMT 31 | Connection: 32 | - keep-alive 33 | body: 34 | encoding: UTF-8 35 | string: '{"engagement":{"id":4709059,"portalId":62515,"active":true,"createdAt":1428586724779,"lastUpdated":1479827851650,"createdBy":215482,"modifiedBy":215482,"ownerId":70,"type":"CALL","timestamp":1428565020000},"associations":{"contactIds":[],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"attachments":[],"metadata":{"durationMilliseconds":0,"body":"test 36 | call"}}' 37 | http_version: 38 | recorded_at: Thu, 15 Dec 2016 14:25:36 GMT 39 | recorded_with: VCR 2.4.0 40 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/engagements/v1/engagements?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"engagement":{"type":"NOTE"},"associations":{"contactIds":[null]},"metadata":{"body":"Test 9 | note"}}' 10 | headers: 11 | Content-Type: 12 | - application/json 13 | response: 14 | status: 15 | code: 200 16 | message: OK 17 | headers: 18 | Access-Control-Allow-Credentials: 19 | - 'false' 20 | Access-Control-Allow-Headers: 21 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 22 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 23 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 24 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 25 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 26 | Access-Control-Allow-Methods: 27 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 28 | Content-Type: 29 | - application/json; charset=UTF-8 30 | Content-Length: 31 | - '280' 32 | Date: 33 | - Wed, 29 Jun 2016 20:10:19 GMT 34 | Connection: 35 | - keep-alive 36 | body: 37 | encoding: UTF-8 38 | string: '{"engagement":{"id":74241847,"portalId":62515,"active":true,"createdAt":1467231019741,"lastUpdated":1467231019741,"type":"NOTE","timestamp":1467231019741},"associations":{"contactIds":[],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"metadata":{"body":"Test 39 | note"}}' 40 | http_version: 41 | recorded_at: Wed, 29 Jun 2016 20:10:19 GMT 42 | recorded_with: VCR 2.4.0 43 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_example.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/engagements/v1/engagements/51484873?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Access-Control-Allow-Headers: 18 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 19 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 20 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 21 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 22 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 23 | Access-Control-Allow-Methods: 24 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 25 | Content-Type: 26 | - application/json; charset=UTF-8 27 | Content-Length: 28 | - '292' 29 | Date: 30 | - Wed, 29 Jun 2016 20:04:30 GMT 31 | Connection: 32 | - keep-alive 33 | body: 34 | encoding: UTF-8 35 | string: '{"engagement":{"id":51484873,"portalId":62515,"active":true,"createdAt":1450278022053,"lastUpdated":1450278022053,"ownerId":1,"type":"NOTE","timestamp":1409172644778},"associations":{"contactIds":[],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"metadata":{"body":"note 36 | body"}}' 37 | http_version: 38 | recorded_at: Wed, 29 Jun 2016 20:04:30 GMT 39 | recorded_with: VCR 2.4.0 40 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/engagement_find_by_association.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/engagements/v1/engagements/associated/FAKE_TYPE/1/paged?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 400 13 | message: Bad Request 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Access-Control-Allow-Headers: 18 | - Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding, 19 | X-Override-Internal-Permissions, X-Properties-Source, X-Properties-SourceId, 20 | X-Properties-Flag, X-Hubspot-User-Id, X-Hubspot-Trace, X-Hubspot-Callee, X-Hubspot-Offset, 21 | X-Hubspot-No-Trace, X-HubSpot-Request-Source, X-HubSpot-Request-Reason, Subscription-Billing-Auth-Token, 22 | X-App-CSRF, X-Tools-CSRF, Online-Payment-Signing-UUID, X-Source, X-SourceId 23 | Access-Control-Allow-Methods: 24 | - GET, OPTIONS, PUT, POST, DELETE, PATCH, HEAD 25 | Content-Type: 26 | - application/json; charset=UTF-8 27 | Content-Length: 28 | - '191' 29 | Date: 30 | - Sat, 08 Oct 2016 15:10:00 GMT 31 | Connection: 32 | - keep-alive 33 | Set-Cookie: 34 | - ak_bmsc=0751F5C9A2F9C3790FFD3FD632E43F8D0215F03442370000480CF95702A59E4F~plgDE6b1I1oKjAoJE+QFjRfXO428z6sPl50gT/0knnWoQY5Muk9PmyV7bWXbMyBauYnXF2gu7gR4EYQpE6LiE23m7jlq52Lp32DTTotre/GnLDW2dTMzmp89y9Ls8U1yRTx+4NeaLcfE7HkDnJjDop5x7d8G9iGqovfQiRED88AKmTRLAj/EF2VlTAjnTPS9qZTZzbQlQkcG9eYqTnxminDKzv9Rf4GVuajevCMYIPTng=; 35 | expires=Sat, 08 Oct 2016 17:10:00 GMT; max-age=7200; path=/; domain=.hubapi.com; 36 | HttpOnly 37 | body: 38 | encoding: UTF-8 39 | string: '{"status":"error","message":"Invalid enum constant ''FAKE_TYPE'' for 40 | class ObjectType","correlationId":"583362b9-af33-403d-b2af-6e6d630a11c6","requestId":"b5fc03ad-5a7e-4500-9e3a-bd3371af2345"}' 41 | http_version: 42 | recorded_at: Sat, 08 Oct 2016 15:10:00 GMT 43 | recorded_with: VCR 2.4.0 44 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/fail_to_create_form.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/forms?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: "{}" 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 400 15 | message: Bad Request 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Mon, 23 Feb 2015 16:16:41 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '175' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"status":"error","message":"Form name is required, form guid ''e218aaae-2783-4b7f-b072-4e8f5163e44b''","type":"MISSING_NAME","requestId":"696220a7-8411-421f-8945-3c0cd370a8a5"}' 33 | http_version: 34 | recorded_at: Mon, 23 Feb 2015 16:16:41 GMT 35 | - request: 36 | method: post 37 | uri: https://api.hubapi.com/forms/v2/forms?hapikey=demo 38 | body: 39 | encoding: UTF-8 40 | string: "{}" 41 | headers: 42 | Content-Type: 43 | - application/json 44 | response: 45 | status: 46 | code: 400 47 | message: Bad Request 48 | headers: 49 | Access-Control-Allow-Credentials: 50 | - 'false' 51 | Content-Type: 52 | - application/json; charset=UTF-8 53 | Content-Length: 54 | - '230' 55 | Date: 56 | - Thu, 16 Jun 2016 22:44:10 GMT 57 | Connection: 58 | - close 59 | body: 60 | encoding: UTF-8 61 | string: '{"status":"error","message":"Form name is required, form guid ''00a537bf-1389-4e3a-af2a-b27868fd04fa''","correlationId":"b1a2939a-e18b-4594-8357-c18e11c818d1","type":"MISSING_NAME","requestId":"494cdd03-fa33-44ad-8346-d31430031769"}' 62 | http_version: 63 | recorded_at: Thu, 16 Jun 2016 22:44:10 GMT 64 | recorded_with: VCR 2.4.0 65 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/fail_to_create_list.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://api.hubapi.com/contacts/v1/lists?hapikey=demo 6 | body: 7 | encoding: UTF-8 8 | string: '{"name":null,"dynamic":false,"portal_id":null}' 9 | headers: 10 | Content-Type: 11 | - application/json 12 | response: 13 | status: 14 | code: 400 15 | message: Bad Request 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | Content-Type: 20 | - application/json; charset=UTF-8 21 | Date: 22 | - Sun, 22 Feb 2015 02:29:50 GMT 23 | Vary: 24 | - Accept-Encoding 25 | - Accept-Encoding 26 | Content-Length: 27 | - '110' 28 | Connection: 29 | - keep-alive 30 | body: 31 | encoding: UTF-8 32 | string: '{"status":"error","message":"Every list must have a name.","requestId":"dc5b8484-32b4-42a5-8422-9e1ff097ed31"}' 33 | http_version: 34 | recorded_at: Sun, 22 Feb 2015 02:29:50 GMT 35 | recorded_with: VCR 2.4.0 36 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/form_post.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://forms.hubspot.com/uploads/form/v2/62515/014c1de3-def3-4957-b708-eb00b884db73?email=funtimes@email.com 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Content-Type: 11 | - application/x-www-form-urlencoded 12 | response: 13 | status: 14 | code: 204 15 | message: No Content 16 | headers: 17 | Access-Control-Allow-Credentials: 18 | - 'false' 19 | - 'false' 20 | Date: 21 | - Sat, 02 Mar 2013 00:52:15 GMT 22 | Server: 23 | - Apache-Coyote/1.1 24 | Connection: 25 | - keep-alive 26 | body: 27 | encoding: US-ASCII 28 | string: '' 29 | http_version: 30 | recorded_at: Sat, 02 Mar 2013 00:52:17 GMT 31 | recorded_with: VCR 2.4.0 32 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/owner_find_by_email.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/owners/v2/owners?email=aaron@unbounce.com&hapikey=demo&includeInactive=false 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Content-Type: 18 | - application/json; charset=UTF-8 19 | Content-Length: 20 | - '283' 21 | Date: 22 | - Wed, 20 Jan 2016 20:14:06 GMT 23 | Connection: 24 | - keep-alive 25 | body: 26 | encoding: UTF-8 27 | string: '[{"portalId":62515,"ownerId":72,"type":"PERSON","firstName":"Aaron","lastName":"Oman","email":"aaron@unbounce.com","createdAt":1405605859739,"updatedAt":1446764930941,"remoteList":[{"id":29619,"portalId":62515,"ownerId":72,"remoteId":"254556","remoteType":"HUBSPOT","active":true}]}]' 28 | http_version: 29 | recorded_at: Wed, 20 Jan 2016 20:14:06 GMT 30 | recorded_with: VCR 2.4.0 31 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/topic_list.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/blogs/v3/topics?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Cache-Control: 18 | - No-store 19 | Content-Type: 20 | - application/json 21 | Date: 22 | - Mon, 20 Oct 2014 02:53:54 GMT 23 | P3p: 24 | - 'P3P: policyref="http://www.hubspot.com/w3c/p3p.xml", CP="CURa ADMa DEVa TAIa 25 | PSAa PSDa OUR IND DSP NON COR' 26 | Server: 27 | - gunicorn/0.17.2 28 | Vary: 29 | - Accept-Encoding 30 | X-Hs-Mc-Reqs: 31 | - Z2V0X21hbnk6MiwyO3NldDoyLDI7Z2V0OjIsMw== 32 | Content-Length: 33 | - '584' 34 | Connection: 35 | - keep-alive 36 | body: 37 | encoding: UTF-8 38 | string: '{"total_count": 3, "objects": [{"created": 1381896200000, "deleted_at": 39 | 0, "description": "", "id": 349001328, "name": "api-docs", "portal_id": 62515, 40 | "slug": "api-docs", "updated": 1381896200000}, {"created": 1389388053000, 41 | "deleted_at": 0, "description": "", "id": 447332568, "name": "Test Topic 20140110160733", 42 | "portal_id": 62515, "slug": "test-topic-20140110160733", "updated": 1389388053000}, 43 | {"created": 1389387669000, "deleted_at": 0, "description": "", "id": 450113517, 44 | "name": "Test", "portal_id": 62515, "slug": "test", "updated": 1389387669000}], 45 | "limit": 20, "offset": 0}' 46 | http_version: 47 | recorded_at: Mon, 20 Oct 2014 02:53:54 GMT 48 | recorded_with: VCR 2.4.0 49 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/topics_list.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://api.hubapi.com/blogs/v3/topics?hapikey=demo 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: {} 10 | response: 11 | status: 12 | code: 200 13 | message: OK 14 | headers: 15 | Access-Control-Allow-Credentials: 16 | - 'false' 17 | Cache-Control: 18 | - No-store 19 | Content-Type: 20 | - application/json 21 | Date: 22 | - Mon, 20 Oct 2014 02:55:54 GMT 23 | P3p: 24 | - 'P3P: policyref="http://www.hubspot.com/w3c/p3p.xml", CP="CURa ADMa DEVa TAIa 25 | PSAa PSDa OUR IND DSP NON COR' 26 | Server: 27 | - gunicorn/0.17.2 28 | Vary: 29 | - Accept-Encoding 30 | X-Hs-Mc-Reqs: 31 | - Z2V0X21hbnk6MSwyO2dldDoyLDQ= 32 | Content-Length: 33 | - '584' 34 | Connection: 35 | - keep-alive 36 | body: 37 | encoding: UTF-8 38 | string: '{"total_count": 3, "objects": [{"created": 1381896200000, "deleted_at": 39 | 0, "description": "", "id": 349001328, "name": "api-docs", "portal_id": 62515, 40 | "slug": "api-docs", "updated": 1381896200000}, {"created": 1389388053000, 41 | "deleted_at": 0, "description": "", "id": 447332568, "name": "Test Topic 20140110160733", 42 | "portal_id": 62515, "slug": "test-topic-20140110160733", "updated": 1389388053000}, 43 | {"created": 1389387669000, "deleted_at": 0, "description": "", "id": 450113517, 44 | "name": "Test", "portal_id": 62515, "slug": "test", "updated": 1389387669000}], 45 | "limit": 20, "offset": 0}' 46 | http_version: 47 | recorded_at: Mon, 20 Oct 2014 02:55:54 GMT 48 | - request: 49 | method: get 50 | uri: https://api.hubapi.com/blogs/v3/topics/349001328?hapikey=demo 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: {} 55 | response: 56 | status: 57 | code: 200 58 | message: OK 59 | headers: 60 | Access-Control-Allow-Credentials: 61 | - 'false' 62 | Cache-Control: 63 | - No-store 64 | Content-Type: 65 | - application/json 66 | Date: 67 | - Mon, 20 Oct 2014 03:37:14 GMT 68 | P3p: 69 | - 'P3P: policyref="http://www.hubspot.com/w3c/p3p.xml", CP="CURa ADMa DEVa TAIa 70 | PSAa PSDa OUR IND DSP NON COR' 71 | Server: 72 | - gunicorn/0.17.2 73 | X-Hs-Mc-Reqs: 74 | - Z2V0X21hbnk6MiwzO3NldDoxLDE7Z2V0OjIsMg== 75 | Content-Length: 76 | - '165' 77 | Connection: 78 | - keep-alive 79 | body: 80 | encoding: UTF-8 81 | string: '{"created": 1381896200000, "deleted_at": 0, "description": "", "id": 82 | 349001328, "name": "api-docs", "portal_id": 62515, "slug": "api-docs", "updated": 83 | 1381896200000}' 84 | http_version: 85 | recorded_at: Mon, 20 Oct 2014 03:37:14 GMT 86 | recorded_with: VCR 2.4.0 87 | -------------------------------------------------------------------------------- /spec/lib/hubspot-ruby_spec.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe Hubspot do 2 | describe ".configure" do 3 | it "delegates .configure to Hubspot::Config.configure" do 4 | options = { hapikey: "demo" } 5 | allow(Hubspot::Config).to receive(:configure).with(options) 6 | 7 | Hubspot.configure(options) 8 | 9 | expect(Hubspot::Config).to have_received(:configure).with(options) 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/lib/hubspot/config_spec.rb: -------------------------------------------------------------------------------- 1 | describe Hubspot::Config do 2 | describe ".configure" do 3 | it "sets the hapikey config" do 4 | hapikey = "demo" 5 | 6 | config = Hubspot::Config.configure(hapikey: hapikey) 7 | 8 | expect(config.hapikey).to eq(hapikey) 9 | end 10 | 11 | it "changes the base_url" do 12 | base_url = "https://api.hubapi.com/v2" 13 | 14 | config = Hubspot::Config.configure( 15 | hapikey: "123abc", 16 | base_url: base_url 17 | ) 18 | 19 | expect(config.base_url).to eq(base_url) 20 | end 21 | 22 | it "sets a default value for base_url" do 23 | config = Hubspot::Config.configure(hapikey: "123abc") 24 | 25 | expect(config.base_url).to eq("https://api.hubapi.com") 26 | end 27 | 28 | it "sets a value for portal_id" do 29 | portal_id = "62515" 30 | 31 | config = Hubspot::Config.configure( 32 | hapikey: "123abc", 33 | portal_id: portal_id 34 | ) 35 | 36 | expect(config.portal_id).to eq(portal_id) 37 | end 38 | 39 | it "raises when an authentication approach is not provided" do 40 | expect { 41 | Hubspot::Config.configure({}) 42 | }.to raise_error(Hubspot::ConfigurationError) 43 | end 44 | 45 | it "raises when two authentication approaches are provided" do 46 | expect { 47 | Hubspot::Config.configure({ 48 | hapikey: "123abc", 49 | access_token: "456def", 50 | }) 51 | }.to raise_error(Hubspot::ConfigurationError) 52 | end 53 | end 54 | 55 | describe ".reset!" do 56 | it "resets the config values" do 57 | Hubspot::Config.configure(hapikey: "123abc", portal_id: "456def") 58 | 59 | Hubspot::Config.reset! 60 | 61 | expect(Hubspot::Config.hapikey).to be nil 62 | expect(Hubspot::Config.portal_id).to be nil 63 | end 64 | end 65 | 66 | describe ".ensure!" do 67 | context "when a specified parameter is missing" do 68 | it "raises an error" do 69 | Hubspot::Config.configure(hapikey: "123abc") 70 | 71 | expect { 72 | Hubspot::Config.ensure!(:portal_id) 73 | }.to raise_error(Hubspot::ConfigurationError) 74 | end 75 | end 76 | 77 | context "when all specified parameters are present" do 78 | it "does not raise an error" do 79 | Hubspot::Config.configure(hapikey: "123abc", portal_id: "456def") 80 | 81 | expect { 82 | Hubspot::Config.ensure!(:portal_id) 83 | }.not_to raise_error 84 | end 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /spec/lib/hubspot/deal_pipeline_spec.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe Hubspot::DealPipeline do 2 | before do 3 | Hubspot.configure hapikey: 'demo' 4 | end 5 | 6 | describe ".find" do 7 | it "retrieves a record by id" do 8 | VCR.use_cassette("find_deal_pipeline") do 9 | deal_pipeline = Hubspot::DealPipeline.create!(label: "New Pipeline") 10 | id = deal_pipeline.pipeline_id 11 | 12 | result = Hubspot::DealPipeline.find(deal_pipeline.pipeline_id) 13 | 14 | assert_requested :get, hubspot_api_url("/deals/v1/pipelines/#{id}") 15 | expect(result).to be_a(Hubspot::DealPipeline) 16 | 17 | deal_pipeline.destroy! 18 | end 19 | end 20 | end 21 | 22 | describe ".all" do 23 | it "returns a list" do 24 | VCR.use_cassette("all_deal_pipelines") do 25 | deal_pipeline = Hubspot::DealPipeline.create!(label: "New Pipeline") 26 | 27 | results = Hubspot::DealPipeline.all 28 | 29 | assert_requested :get, hubspot_api_url("/deals/v1/pipelines") 30 | expect(results).to be_kind_of(Array) 31 | expect(results.first).to be_a(Hubspot::DealPipeline) 32 | 33 | deal_pipeline.destroy! 34 | end 35 | end 36 | end 37 | 38 | describe ".create!" do 39 | it "creates a new record" do 40 | VCR.use_cassette("create_deal_pipeline") do 41 | result = Hubspot::DealPipeline.create!(label: "New Pipeline") 42 | 43 | assert_requested :post, hubspot_api_url("/deals/v1/pipelines") 44 | expect(result).to be_a(Hubspot::DealPipeline) 45 | 46 | result.destroy! 47 | end 48 | end 49 | end 50 | 51 | describe "#destroy!" do 52 | it "deletes the record" do 53 | VCR.use_cassette("delete_deal_pipeline") do 54 | deal_pipeline = Hubspot::DealPipeline.create!(label: "New Pipeline") 55 | id = deal_pipeline.pipeline_id 56 | 57 | result = deal_pipeline.destroy! 58 | 59 | assert_requested :delete, hubspot_api_url("/deals/v1/pipelines/#{id}") 60 | expect(result).to be_a(HTTParty::Response) 61 | end 62 | end 63 | end 64 | 65 | describe "#[]" do 66 | it "returns the stage at the specified index" do 67 | data = { 68 | "stages" => [ 69 | {"active": true, "label": "New Lead"}, 70 | {"active": true, "label": "Proposal"}, 71 | ], 72 | } 73 | 74 | deal_pipeline = Hubspot::DealPipeline.new(data) 75 | 76 | result = deal_pipeline[0] 77 | 78 | expect(result).to eq(data["stages"][0]) 79 | end 80 | end 81 | 82 | def hubspot_api_url(path) 83 | URI.join(Hubspot::Config.base_url, path, "?hapikey=demo") 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /spec/lib/hubspot/deprecator_spec.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe Hubspot::Deprecator do 2 | describe ".build" do 3 | it "returns an instance of ActiveSupport::Deprecation" do 4 | deprecator = Hubspot::Deprecator.build 5 | 6 | expect(deprecator).to be_an_instance_of(ActiveSupport::Deprecation) 7 | end 8 | 9 | it "uses the correct gem name" do 10 | deprecator = Hubspot::Deprecator.build 11 | 12 | expect(deprecator.gem_name).to eq("hubspot-ruby") 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/lib/hubspot/owner_spec.rb: -------------------------------------------------------------------------------- 1 | describe Hubspot::Owner do 2 | let(:example_owners) do 3 | VCR.use_cassette('owner_example') do 4 | HTTParty.get('https://api.hubapi.com/owners/v2/owners?hapikey=demo&portalId=62515').parsed_response 5 | end 6 | end 7 | 8 | before { Hubspot.configure(hapikey: 'demo') } 9 | 10 | describe '.all' do 11 | cassette 'owner_all' 12 | 13 | it 'should find all owners' do 14 | owners = Hubspot::Owner.all 15 | 16 | expect(owners.blank?).to be false 17 | compare_owners(owners, example_owners) 18 | end 19 | end 20 | 21 | describe '.find_by_email' do 22 | cassette 'owner_find_by_email' 23 | 24 | let(:sample) { example_owners.first } 25 | let(:email) { sample['email'] } 26 | 27 | it 'should find a user via their email address' do 28 | owner = Hubspot::Owner.find_by_email(email) 29 | sample.map do |key, val| 30 | expect(owner[key]).to eq(val) 31 | end 32 | end 33 | end 34 | 35 | describe '.find_by_emails' do 36 | cassette 'owner_find_by_emails' 37 | 38 | let(:samples) { example_owners[0..[example_owners.count, 3].min] } 39 | let(:emails) { samples.map { |s| s['email'] } } 40 | 41 | it 'should find users via their email address' do 42 | owners = Hubspot::Owner.find_by_emails(emails) 43 | compare_owners(owners, samples) 44 | end 45 | end 46 | end 47 | 48 | def compare_owners(owners, examples) 49 | owners.each do |owner| 50 | example = examples.detect { |o| o['email'] == owner.email } 51 | expect(example.blank?).to be false 52 | example.each do |key, val| 53 | expect(owner[key]).to eq(val) 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /spec/lib/hubspot/properties_spec.rb: -------------------------------------------------------------------------------- 1 | module Hubspot 2 | describe Properties do 3 | let(:params) { { 'name' => 'amount_of_new_money_lined_up', 4 | 'label' => 'New Money Lined Up (Over $50K or Under $50K)', 5 | 'description' => '', 6 | 'groupName' => 'onboarding_questionnaire', 7 | 'type' => 'enumeration', 8 | 'fieldType' => 'select', 9 | 'options' => [{ 'description' => '', 'value' => 'option0', 'readOnly' => false, 'label' => 'Under $50K', 'displayOrder' => 0, 'hidden' => false, 'doubleData' => 0.0 }, 10 | { 'description' => '', 'value' => 'option1', 'readOnly' => false, 'label' => '$50K and above', 'displayOrder' => 1, 'hidden' => false, 'doubleData' => 0.0 }, 11 | { 'description' => nil, 'value' => 'option2', 'readOnly' => nil, 'label' => 'Not applicable', 'displayOrder' => 2, 'hidden' => false, 'doubleData' => nil }], 12 | 'formField' => true, 13 | 'displayOrder' => 0, 14 | 'readOnlyDefinition' => false, 15 | 'hidden' => false, 16 | 'mutableDefinitionNotDeletable' => false, 17 | 'displayMode' => 'current_value', 18 | 'deleted' => false, 19 | 'createdUserId' => 2334900, 20 | 'calculated' => false, 21 | 'readOnlyValue' => false, 22 | 'externalOptions' => false, 23 | 'updatedUserId' => 2225340 } } 24 | let(:valid_params) { { 'name' => 'amount_of_new_money_lined_up', 25 | 'groupName' => 'onboarding_questionnaire', 26 | 'description' => '', 27 | 'fieldType' => 'select', 28 | 'formField' => true, 29 | 'type' => 'enumeration', 30 | 'displayOrder' => 0, 31 | 'label' => 'New Money Lined Up (Over $50K or Under $50K)', 32 | 'options' => [{ 'description' => '', 'value' => 'option0', 'label' => 'Under $50K', 'hidden' => false, 'displayOrder' => 0 }, 33 | { 'description' => '', 'value' => 'option1', 'label' => '$50K and above', 'hidden' => false, 'displayOrder' => 1 }, 34 | { 'description' => nil, 'value' => 'option2', 'label' => 'Not applicable', 'hidden' => false, 'displayOrder' => 2 }] 35 | } } 36 | 37 | context '.valid_params' do 38 | it 'should strip out extra keys and their values' do 39 | result = Hubspot::Properties.valid_params(params) 40 | expect(Properties.same?(result, valid_params)) 41 | end 42 | end 43 | 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/lib/hubspot/resource_spec.rb: -------------------------------------------------------------------------------- 1 | 2 | RSpec.describe Hubspot::Resource do 3 | describe '#new' do 4 | context 'when specifying an ID' do 5 | let(:id) { 1 } 6 | subject { described_class.new(id) } 7 | 8 | it 'sets the id property' do 9 | expect(subject.id).to eq id 10 | end 11 | 12 | it "isn't persisted" do 13 | pending "rework of pending flag" 14 | expect(subject).not_to be_persisted 15 | end 16 | 17 | it 'has no changes' do 18 | expect(subject).not_to be_changed 19 | end 20 | end 21 | 22 | context 'when specifying properties' do 23 | let(:name) { Faker::Company.name } 24 | let(:properties) { { name: name } } 25 | subject { described_class.new properties } 26 | 27 | it 'has no id' do 28 | expect(subject.id).to be_nil 29 | end 30 | 31 | it 'has the property set' do 32 | expect(subject[:name]).to eq name 33 | expect(subject["name"]).to eq name 34 | expect(subject.name).to eq name 35 | end 36 | 37 | it 'has changes' do 38 | expect(subject.changes).not_to be_empty 39 | end 40 | end 41 | 42 | context 'with no arguments' do 43 | subject { described_class.new } 44 | 45 | it 'has no id' do 46 | expect(subject.id).to be_nil 47 | end 48 | 49 | it 'has no changes' do 50 | expect(subject).not_to be_changed 51 | end 52 | end 53 | end 54 | end -------------------------------------------------------------------------------- /spec/lib/hubspot/topic_spec.rb: -------------------------------------------------------------------------------- 1 | describe Hubspot::Topic do 2 | before do 3 | Hubspot.configure(hapikey: "demo") 4 | end 5 | 6 | describe ".list" do 7 | cassette "topics_list" 8 | let(:topics) { Hubspot::Topic.list } 9 | 10 | it "should have a list of topics" do 11 | topics.count.should be(3) 12 | end 13 | end 14 | 15 | describe ".find_by_topic_id" do 16 | cassette "topics_list" 17 | 18 | it "should find a specific topic" do 19 | topic = Hubspot::Topic.find_by_topic_id(349001328) 20 | topic['id'].should eq(349001328) 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/shared_examples/saveable_resource.rb: -------------------------------------------------------------------------------- 1 | RSpec.shared_examples_for "a saveable resource" do |factory_name| 2 | describe '#save' do 3 | context 'with a new resource' do 4 | cassette 5 | let(:resource) { build factory_name } 6 | subject { resource.save } 7 | 8 | it 'succeeds' do 9 | expect(subject).to be_truthy 10 | end 11 | 12 | it 'sets the ID' do 13 | expect { 14 | subject 15 | }.to change { resource.id }.from(nil) 16 | end 17 | 18 | it 'clears the changes' do 19 | expect { 20 | subject 21 | }.to change { resource.changed? }.from(true).to(false) 22 | end 23 | end 24 | 25 | context 'with an existing resource' do 26 | cassette 27 | let(:resource) { create factory_name } 28 | subject { resource.save } 29 | 30 | before(:each) do 31 | set_property(resource) 32 | end 33 | 34 | it 'succeeds' do 35 | expect(subject).to be_truthy 36 | end 37 | 38 | it 'clears the changes' do 39 | expect { 40 | subject 41 | }.to change { resource.changed? }.from(true).to(false) 42 | end 43 | end 44 | end 45 | end -------------------------------------------------------------------------------- /spec/shared_examples/updateable_resource.rb: -------------------------------------------------------------------------------- 1 | RSpec.shared_examples_for "an updateable resource" do |factory_name| 2 | describe '.update' do 3 | context 'with an existing resource' do 4 | cassette 5 | let(:resource) { create factory_name } 6 | subject { described_class.update(resource.id, changed_properties) } 7 | 8 | it 'succeeds' do 9 | expect(subject).to be_truthy 10 | end 11 | end 12 | 13 | context 'with an invalid resource' do 14 | cassette 15 | subject { described_class.update(0, changed_properties) } 16 | 17 | it 'fails' do 18 | expect(subject).to be_falsey 19 | end 20 | end 21 | end 22 | 23 | describe '.update!' do 24 | context 'with an existing resource' do 25 | cassette 26 | let(:resource) { create factory_name } 27 | subject { described_class.update!(resource.id, changed_properties) } 28 | 29 | it 'succeeds' do 30 | expect(subject).to be_truthy 31 | end 32 | end 33 | 34 | context 'with an invalid resource' do 35 | cassette 36 | subject { described_class.update!(0, changed_properties) } 37 | 38 | it 'fails with an error' do 39 | expect { 40 | subject 41 | }.to raise_error Hubspot::RequestError 42 | end 43 | end 44 | end 45 | 46 | describe '#update' do 47 | context 'with no changes' do 48 | cassette 49 | let(:resource) { create factory_name } 50 | subject { resource.update(changed_properties) } 51 | 52 | it 'succeeds' do 53 | expect(subject).to be_truthy 54 | end 55 | 56 | it 'updates the properties' do 57 | subject 58 | changed_properties.each do |property, value| 59 | expect(resource.send(property.to_sym)).to eq value 60 | end 61 | end 62 | end 63 | 64 | context 'with overlapping changes' do 65 | cassette 66 | let(:resource) { create factory_name} 67 | subject { resource.update(changed_properties) } 68 | 69 | before(:each) do 70 | overlapping_properties.each do |property, value| 71 | resource.send("#{property}=".to_sym, value) 72 | end 73 | end 74 | 75 | it 'succeeds' do 76 | expect(subject).to be_truthy 77 | end 78 | 79 | it 'merges and updates the properties' do 80 | subject 81 | overlapping_properties.merge(changed_properties).each do |property, value| 82 | expect(resource.send(property.to_sym)).to eq value 83 | end 84 | end 85 | end 86 | end 87 | end -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) 2 | $LOAD_PATH.unshift(File.dirname(__FILE__)) 3 | RSPEC_ROOT = File.dirname(__FILE__) 4 | GEM_ROOT = File.expand_path("..", RSPEC_ROOT) 5 | 6 | require 'simplecov' 7 | SimpleCov.root GEM_ROOT 8 | SimpleCov.start do 9 | add_filter "/spec/" 10 | add_filter "/.bundle/" 11 | end 12 | 13 | require 'dotenv/load' 14 | require 'rspec' 15 | require 'rspec/its' 16 | require 'webmock/rspec' 17 | require 'factory_bot' 18 | require 'faker' 19 | require 'byebug' 20 | require 'hubspot-ruby' 21 | 22 | # Requires supporting files with custom matchers and macros, etc, 23 | # in ./support/ and its subdirectories. 24 | Dir["#{RSPEC_ROOT}/support/**/*.rb"].each {|f| require f} 25 | 26 | # Require shared examples 27 | Dir["#{RSPEC_ROOT}/shared_examples/**/*.rb"].each {|f| require f} 28 | 29 | RSpec.configure do |config| 30 | config.after(:each) do 31 | Hubspot::Config.reset! 32 | end 33 | 34 | config.filter_run_when_matching :focus 35 | 36 | # Setup FactoryBot 37 | config.include FactoryBot::Syntax::Methods 38 | config.before(:suite) do 39 | FactoryBot.find_definitions 40 | end 41 | 42 | config.extend CassetteHelper 43 | config.extend TestsHelper 44 | end 45 | -------------------------------------------------------------------------------- /spec/support/capture_output.rb: -------------------------------------------------------------------------------- 1 | module CaptureOutput 2 | def capture_stderr 3 | previous, $stderr = $stderr, StringIO.new 4 | yield 5 | $stderr.string 6 | ensure 7 | $stderr = previous 8 | end 9 | 10 | def capture_stdout 11 | previous, $stdout = $stdout, StringIO.new 12 | yield 13 | $stdout.string 14 | ensure 15 | $stdout = previous 16 | end 17 | end 18 | 19 | RSpec.configure do |config| 20 | config.include CaptureOutput 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/cassette_helper.rb: -------------------------------------------------------------------------------- 1 | module CassetteHelper 2 | def self.extended(base) 3 | base.around do |spec| 4 | VCR.insert_cassette(_cassette, _cassette_options) if defined?(_cassette) && _cassette 5 | spec.run 6 | VCR.eject_cassette if defined?(_cassette) && _cassette 7 | end 8 | end 9 | 10 | def cassette(*args) 11 | options = args.extract_options! 12 | 13 | let(:_cassette) do |example| 14 | args.first || example.full_description 15 | end 16 | 17 | let(:_cassette_options) { options } 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/support/hubspot_api_helpers.rb: -------------------------------------------------------------------------------- 1 | module HubspotApiHelpers 2 | def hubspot_api_url(path) 3 | URI.join(Hubspot::Config.base_url, path) 4 | end 5 | 6 | def assert_hubspot_api_request(method, path, options = {}) 7 | assert_requested(method, /#{hubspot_api_url(path)}/, options) 8 | end 9 | end 10 | 11 | RSpec.configure do |c| 12 | c.include HubspotApiHelpers 13 | end 14 | -------------------------------------------------------------------------------- /spec/support/rake.rb: -------------------------------------------------------------------------------- 1 | require "rake" 2 | 3 | module RakeHelpers 4 | def invoke_rake_task(name, args = []) 5 | RakeTask.new(name).invoke(*args) 6 | end 7 | end 8 | 9 | class RakeTask 10 | def initialize(name) 11 | @task_name = name 12 | prep_environment 13 | end 14 | 15 | delegate :invoke, to: :task 16 | 17 | private 18 | 19 | attr_reader :task_name 20 | 21 | def prep_environment 22 | Rake.application = rake 23 | Rake.load_rakefile(full_task_path) 24 | Rake::Task.define_task(:environment) 25 | end 26 | 27 | def full_task_path 28 | "#{root_path}/lib/tasks/#{task_name.split(':').first}.rake" 29 | end 30 | 31 | def root_path 32 | File.expand_path('../..', __dir__) 33 | end 34 | 35 | def task 36 | rake[task_name] 37 | end 38 | 39 | def rake 40 | @_rake ||= Rake::Application.new 41 | end 42 | end 43 | 44 | RSpec.configure do |config| 45 | config.include RakeHelpers, type: :rake 46 | end 47 | -------------------------------------------------------------------------------- /spec/support/tests_helper.rb: -------------------------------------------------------------------------------- 1 | module TestsHelper 2 | def expect_count_and_offset(&block) 3 | it 'returns only the number of objects specified by count' do 4 | result = block.call(count: 2) 5 | expect(result.size).to eql 2 6 | 7 | result = block.call(count: 4) 8 | expect(result.size).to eql 4 9 | end 10 | 11 | it 'returns objects by a specified offset' do 12 | non_offset_objects = block.call(count: 2) 13 | objects_with_offset = block.call(count: 2, offset: 2) 14 | expect(non_offset_objects).to_not eql objects_with_offset 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/support/vcr.rb: -------------------------------------------------------------------------------- 1 | require "vcr" 2 | 3 | def vcr_record_mode 4 | if ENV["VCR_RECORD"] == "1" 5 | :new_episodes 6 | else 7 | :none 8 | end 9 | end 10 | 11 | VCR.configure do |c| 12 | c.cassette_library_dir = "#{RSPEC_ROOT}/fixtures/vcr_cassettes" 13 | c.hook_into :webmock 14 | c.default_cassette_options = { record: vcr_record_mode } 15 | c.filter_sensitive_data("") { ENV.fetch("HUBSPOT_HAPI_KEY", "demo") } 16 | end 17 | --------------------------------------------------------------------------------