README.md in hubspot-api-client-1.0.1 vs README.md in hubspot-api-client-2.0.0
- old
+ new
@@ -50,38 +50,31 @@
require 'hubspot-api-client'
# Setup authorization
Hubspot.configure do |config|
# Configure API key authorization: hapikey
- config.api_key['hapikey'] = 'YOUR API KEY'
- # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
- #config.api_key_prefix['hapikey'] = 'Bearer'
-
- # Configure OAuth2 access token for authorization: oauth2
- config.access_token = 'YOUR ACCESS TOKEN'
+ config.api_key['hapikey'] = 'demo'
end
-api_instance = Hubspot::Client::Crm::Objects::Api::AssociationsApi.new
+# Get contacts
+basic_api = Hubspot::Crm::Contacts::BasicApi.new
+basic_api.get_page(auth_names: 'hapikey')
-object_type = 'object_type_example' # String |
+```
-object_id = 'object_id_example' # String |
+### Usage
-associated_object_type = 'associated_object_type_example' # String |
+### Get all:
+get_all method is available for all major objects (Companies, Contacts, Deals, LineItems, Products, Quotes & Tickets) and works like
-to_object_id = 'to_object_id_example' # String |
-
-
-begin
- #Remove an association between two objects
- api_instance.archive_association(object_type, object_id, associated_object_type, to_object_id)
-rescue Hubspot::Client::Crm::Objects::ApiError => e
- puts "Exception when calling AssociationsApi->archive_association: #{e}"
-end
-
+```ruby
+basic_api = Hubspot::Crm::Contacts::BasicApi.new
+all_contacts = basic_api.get_all(auth_names: 'oauth2')
```
+Please note that pagination is used under the hood to get all results.
+
### Error handling
#### You can set number of retry attempts and delay in seconds before retry on specific status code of response.
Available params:
@@ -89,21 +82,21 @@
- seconds_delay (pause in seconds between retries)
- retry_block (block that is executed after every retry)
```ruby
-config = ::Hubspot::Client::Crm::Companies::Configuration.new do |config|
+config = ::Hubspot::Crm::Companies::Configuration.new do |config|
config.access_token = 'YOUR ACCESS TOKEN'
# Set handlers of statuses you want to handle
config.error_handler = {
[429, 430, 442] => { max_retries: 5, seconds_delay: 1 },
(500..530).to_a => { max_retries: 2, seconds_delay: 2 },
400 => { max_retries: 3, seconds_delay: 3 },
}
end
-api_client = ::Hubspot::Client::Crm::Companies::ApiClient.new(config)
-basic_api = ::Hubspot::Client::Crm::Companies::Api::BasicApi.new(api_client)
+api_client = ::Hubspot::Crm::Companies::ApiClient.new(config)
+basic_api = ::Hubspot::Crm::Companies::BasicApi.new(api_client)
end
```