hubspot-api-client 11.1.1 → 11.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +8 -2
- data/README.md +21 -0
- data/hubspot-api-client.gemspec +1 -0
- data/lib/hubspot/client.rb +51 -0
- data/lib/hubspot/discovery/automation/actions/api/callbacks_api.rb +13 -0
- data/lib/hubspot/discovery/automation/actions/api/definitions_api.rb +13 -0
- data/lib/hubspot/discovery/automation/actions/api/functions_api.rb +13 -0
- data/lib/hubspot/discovery/automation/actions/api/revisions_api.rb +13 -0
- data/lib/hubspot/discovery/automation/actions/client.rb +22 -0
- data/lib/hubspot/discovery/automation/client.rb +17 -0
- data/lib/hubspot/discovery/base_api_client.rb +70 -0
- data/lib/hubspot/discovery/base_module_client.rb +55 -0
- data/lib/hubspot/discovery/cms/audit_logs/api/audit_logs_api.rb +13 -0
- data/lib/hubspot/discovery/cms/audit_logs/client.rb +19 -0
- data/lib/hubspot/discovery/cms/blogs/authors/api/author_api.rb +15 -0
- data/lib/hubspot/discovery/cms/blogs/authors/client.rb +21 -0
- data/lib/hubspot/discovery/cms/blogs/blog_posts/api/blog_post_api.rb +15 -0
- data/lib/hubspot/discovery/cms/blogs/blog_posts/client.rb +21 -0
- data/lib/hubspot/discovery/cms/blogs/client.rb +21 -0
- data/lib/hubspot/discovery/cms/blogs/tags/api/tag_api.rb +15 -0
- data/lib/hubspot/discovery/cms/blogs/tags/client.rb +21 -0
- data/lib/hubspot/discovery/cms/client.rb +23 -0
- data/lib/hubspot/discovery/cms/domains/api/domains_api.rb +13 -0
- data/lib/hubspot/discovery/cms/domains/client.rb +19 -0
- data/lib/hubspot/discovery/cms/hubdb/api/rows_api.rb +13 -0
- data/lib/hubspot/discovery/cms/hubdb/api/rows_batch_api.rb +13 -0
- data/lib/hubspot/discovery/cms/hubdb/api/tables_api.rb +13 -0
- data/lib/hubspot/discovery/cms/hubdb/client.rb +21 -0
- data/lib/hubspot/discovery/cms/performance/api/public_performance_api.rb +13 -0
- data/lib/hubspot/discovery/cms/performance/client.rb +19 -0
- data/lib/hubspot/discovery/cms/site_search/api/public_api.rb +13 -0
- data/lib/hubspot/discovery/cms/site_search/client.rb +19 -0
- data/lib/hubspot/discovery/cms/url_redirects/api/redirects_api.rb +13 -0
- data/lib/hubspot/discovery/cms/url_redirects/client.rb +19 -0
- data/lib/hubspot/discovery/communication_preferences/api/definition_api.rb +11 -0
- data/lib/hubspot/discovery/communication_preferences/api/status_api.rb +11 -0
- data/lib/hubspot/discovery/communication_preferences/client.rb +18 -0
- data/lib/hubspot/discovery/conversations/client.rb +17 -0
- data/lib/hubspot/discovery/conversations/visitor_identification/api/generate_api.rb +13 -0
- data/lib/hubspot/discovery/conversations/visitor_identification/client.rb +19 -0
- data/lib/hubspot/discovery/crm/associations/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/associations/api/types_api.rb +13 -0
- data/lib/hubspot/discovery/crm/associations/client.rb +20 -0
- data/lib/hubspot/discovery/crm/client.rb +32 -0
- data/lib/hubspot/discovery/crm/companies/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/companies/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/companies/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/companies/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/companies/client.rb +22 -0
- data/lib/hubspot/discovery/crm/contacts/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/contacts/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/contacts/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/contacts/api/gdpr_api.rb +13 -0
- data/lib/hubspot/discovery/crm/contacts/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/contacts/client.rb +23 -0
- data/lib/hubspot/discovery/crm/deals/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/deals/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/deals/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/deals/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/deals/client.rb +22 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/api/callbacks_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/api/invoice_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/api/settings_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/api/sync_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/api/user_accounts_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/accounting/client.rb +25 -0
- data/lib/hubspot/discovery/crm/extensions/calling/api/settings_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/calling/client.rb +21 -0
- data/lib/hubspot/discovery/crm/extensions/cards/api/cards_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/cards/api/sample_response_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/cards/client.rb +22 -0
- data/lib/hubspot/discovery/crm/extensions/client.rb +22 -0
- data/lib/hubspot/discovery/crm/extensions/videoconferencing/api/settings_api.rb +15 -0
- data/lib/hubspot/discovery/crm/extensions/videoconferencing/client.rb +21 -0
- data/lib/hubspot/discovery/crm/imports/api/core_api.rb +13 -0
- data/lib/hubspot/discovery/crm/imports/api/public_imports_api.rb +13 -0
- data/lib/hubspot/discovery/crm/imports/client.rb +20 -0
- data/lib/hubspot/discovery/crm/line_items/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/line_items/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/line_items/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/line_items/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/line_items/client.rb +22 -0
- data/lib/hubspot/discovery/crm/objects/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/objects/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/objects/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/objects/api/gdpr_api.rb +13 -0
- data/lib/hubspot/discovery/crm/objects/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/objects/client.rb +29 -0
- data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/associations_api.rb +15 -0
- data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/basic_api.rb +15 -0
- data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/batch_api.rb +15 -0
- data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/search_api.rb +15 -0
- data/lib/hubspot/discovery/crm/objects/feedback_submissions/client.rb +24 -0
- data/lib/hubspot/discovery/crm/owners/api/owners_api.rb +13 -0
- data/lib/hubspot/discovery/crm/owners/client.rb +19 -0
- data/lib/hubspot/discovery/crm/pipelines/api/pipeline_stages_api.rb +13 -0
- data/lib/hubspot/discovery/crm/pipelines/api/pipelines_api.rb +13 -0
- data/lib/hubspot/discovery/crm/pipelines/client.rb +20 -0
- data/lib/hubspot/discovery/crm/products/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/products/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/products/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/products/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/products/client.rb +22 -0
- data/lib/hubspot/discovery/crm/properties/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/properties/api/core_api.rb +13 -0
- data/lib/hubspot/discovery/crm/properties/api/groups_api.rb +13 -0
- data/lib/hubspot/discovery/crm/properties/client.rb +21 -0
- data/lib/hubspot/discovery/crm/quotes/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/quotes/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/quotes/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/quotes/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/quotes/client.rb +22 -0
- data/lib/hubspot/discovery/crm/schemas/api/core_api.rb +13 -0
- data/lib/hubspot/discovery/crm/schemas/api/public_object_schemas_api.rb +13 -0
- data/lib/hubspot/discovery/crm/schemas/client.rb +20 -0
- data/lib/hubspot/discovery/crm/tickets/api/associations_api.rb +13 -0
- data/lib/hubspot/discovery/crm/tickets/api/basic_api.rb +13 -0
- data/lib/hubspot/discovery/crm/tickets/api/batch_api.rb +13 -0
- data/lib/hubspot/discovery/crm/tickets/api/search_api.rb +13 -0
- data/lib/hubspot/discovery/crm/tickets/client.rb +22 -0
- data/lib/hubspot/discovery/crm/timeline/api/events_api.rb +13 -0
- data/lib/hubspot/discovery/crm/timeline/api/templates_api.rb +13 -0
- data/lib/hubspot/discovery/crm/timeline/api/tokens_api.rb +13 -0
- data/lib/hubspot/discovery/crm/timeline/client.rb +21 -0
- data/lib/hubspot/discovery/events/api/events_api.rb +11 -0
- data/lib/hubspot/discovery/events/client.rb +17 -0
- data/lib/hubspot/discovery/files/client.rb +17 -0
- data/lib/hubspot/discovery/files/files/api/files_api.rb +13 -0
- data/lib/hubspot/discovery/files/files/api/folders_api.rb +13 -0
- data/lib/hubspot/discovery/files/files/client.rb +20 -0
- data/lib/hubspot/discovery/marketing/client.rb +17 -0
- data/lib/hubspot/discovery/marketing/transactional/api/public_smtp_tokens_api.rb +13 -0
- data/lib/hubspot/discovery/marketing/transactional/api/single_send_api.rb +13 -0
- data/lib/hubspot/discovery/marketing/transactional/client.rb +20 -0
- data/lib/hubspot/discovery/oauth/api/access_tokens_api.rb +11 -0
- data/lib/hubspot/discovery/oauth/api/refresh_tokens_api.rb +11 -0
- data/lib/hubspot/discovery/oauth/api/tokens_api.rb +11 -0
- data/lib/hubspot/discovery/oauth/client.rb +19 -0
- data/lib/hubspot/discovery/webhooks/api/settings_api.rb +11 -0
- data/lib/hubspot/discovery/webhooks/api/subscriptions_api.rb +11 -0
- data/lib/hubspot/discovery/webhooks/client.rb +18 -0
- data/lib/hubspot/helpers/camel_case.rb +9 -0
- data/lib/hubspot/helpers/snake_case.rb +13 -0
- data/lib/hubspot/version.rb +1 -1
- data/lib/hubspot-api-client.rb +1 -0
- data/spec/discovery/automation/actions/callbacks_api_spec.rb +8 -0
- data/spec/discovery/automation/actions/definitions_api_spec.rb +11 -0
- data/spec/discovery/automation/actions/functions_api_spec.rb +13 -0
- data/spec/discovery/automation/actions/revisions_api_spec.rb +8 -0
- data/spec/discovery/base_api_client_spec.rb +69 -0
- data/spec/discovery/base_module_client_spec.rb +28 -0
- data/spec/discovery/client_spec.rb +16 -0
- data/spec/discovery/cms/audit-logs/audit_logs_api_spec.rb +7 -0
- data/spec/discovery/cms/blogs/authors/author_api_spec.rb +15 -0
- data/spec/discovery/cms/blogs/blog-posts/blog_post_api_spec.rb +25 -0
- data/spec/discovery/cms/blogs/tags/tag_api_spec.rb +15 -0
- data/spec/discovery/cms/domains/domains_api_spec.rb +8 -0
- data/spec/discovery/cms/hubdb/rows_api_spec.rb +15 -0
- data/spec/discovery/cms/hubdb/rows_batch_api_spec.rb +13 -0
- data/spec/discovery/cms/hubdb/tables_api_spec.rb +20 -0
- data/spec/discovery/cms/performance/public_performance_api_spec.rb +8 -0
- data/spec/discovery/cms/site-search/public_api_spec.rb +8 -0
- data/spec/discovery/cms/url-redirects/redirects_api_spec.rb +11 -0
- data/spec/discovery/communication_preferences/definition_api_spec.rb +7 -0
- data/spec/discovery/communication_preferences/status_api_spec.rb +9 -0
- data/spec/discovery/conversations/visitor-identification/generate_api_spec.rb +7 -0
- data/spec/discovery/crm/associations/batch_api_spec.rb +9 -0
- data/spec/discovery/crm/associations/types_api_spec.rb +7 -0
- data/spec/discovery/crm/companies/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/companies/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/companies/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/companies/search_api_spec.rb +7 -0
- data/spec/discovery/crm/contacts/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/contacts/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/contacts/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/contacts/gdpr_api_spec.rb +8 -0
- data/spec/discovery/crm/contacts/search_api_spec.rb +7 -0
- data/spec/discovery/crm/deals/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/deals/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/deals/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/deals/search_api_spec.rb +7 -0
- data/spec/discovery/crm/extensions/accounting/callbacks_api_spec.rb +16 -0
- data/spec/discovery/crm/extensions/accounting/invoice_api_spec.rb +9 -0
- data/spec/discovery/crm/extensions/accounting/settings_api_spec.rb +8 -0
- data/spec/discovery/crm/extensions/accounting/sync_api_spec.rb +8 -0
- data/spec/discovery/crm/extensions/accounting/user_accounts_api_spec.rb +8 -0
- data/spec/discovery/crm/extensions/calling/settings_api_spec.rb +10 -0
- data/spec/discovery/crm/extensions/cards/cards_api_spec.rb +11 -0
- data/spec/discovery/crm/extensions/cards/sample_response_api_spec.rb +7 -0
- data/spec/discovery/crm/extensions/videoconferencing/settings_api_spec.rb +9 -0
- data/spec/discovery/crm/imports/core_api_spec.rb +10 -0
- data/spec/discovery/crm/imports/public_imports_api_spec.rb +7 -0
- data/spec/discovery/crm/line_items/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/line_items/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/line_items/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/line_items/search_api_spec.rb +7 -0
- data/spec/discovery/crm/objects/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/objects/basic_api_spec.rb +12 -0
- data/spec/discovery/crm/objects/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/objects/feedback_submissions/associations_api_spec.rb +7 -0
- data/spec/discovery/crm/objects/feedback_submissions/basic_api_spec.rb +8 -0
- data/spec/discovery/crm/objects/feedback_submissions/batch_api_spec.rb +7 -0
- data/spec/discovery/crm/objects/feedback_submissions/search_api_spec.rb +7 -0
- data/spec/discovery/crm/objects/gdpr_api_spec.rb +8 -0
- data/spec/discovery/crm/objects/search_api_spec.rb +7 -0
- data/spec/discovery/crm/owners/owners_api_spec.rb +8 -0
- data/spec/discovery/crm/pipelines/pipeline_stages_api_spec.rb +12 -0
- data/spec/discovery/crm/pipelines/pipelines_api_spec.rb +12 -0
- data/spec/discovery/crm/products/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/products/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/products/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/products/search_api_spec.rb +7 -0
- data/spec/discovery/crm/properties/batch_api_spec.rb +9 -0
- data/spec/discovery/crm/properties/core_api_spec.rb +11 -0
- data/spec/discovery/crm/properties/groups_api_spec.rb +11 -0
- data/spec/discovery/crm/quotes/associations_api_spec.rb +7 -0
- data/spec/discovery/crm/quotes/basic_api_spec.rb +8 -0
- data/spec/discovery/crm/quotes/batch_api_spec.rb +7 -0
- data/spec/discovery/crm/quotes/search_api_spec.rb +7 -0
- data/spec/discovery/crm/schemas/core_api_spec.rb +13 -0
- data/spec/discovery/crm/schemas/public_object_schemas_api_spec.rb +7 -0
- data/spec/discovery/crm/tickets/associations_api_spec.rb +9 -0
- data/spec/discovery/crm/tickets/basic_api_spec.rb +11 -0
- data/spec/discovery/crm/tickets/batch_api_spec.rb +10 -0
- data/spec/discovery/crm/tickets/search_api_spec.rb +7 -0
- data/spec/discovery/crm/timeline/events_api_spec.rb +11 -0
- data/spec/discovery/crm/timeline/templates_api_spec.rb +11 -0
- data/spec/discovery/crm/timeline/tokens_api_spec.rb +9 -0
- data/spec/discovery/events/events_api_spec.rb +7 -0
- data/spec/discovery/files/files/files_api_spec.rb +16 -0
- data/spec/discovery/files/files/folders_api_spec.rb +14 -0
- data/spec/discovery/marketing/transactional/public_smtp_tokens_api_spec.rb +11 -0
- data/spec/discovery/marketing/transactional/single_send_api_spec.rb +7 -0
- data/spec/discovery/oauth/access_tokens_api_spec.rb +7 -0
- data/spec/discovery/oauth/refresh_tokens_api_spec.rb +8 -0
- data/spec/discovery/oauth/tokens_api_spec.rb +7 -0
- data/spec/discovery/webhooks/settings_api_spec.rb +9 -0
- data/spec/discovery/webhooks/subscriptions_api_spec.rb +12 -0
- data/spec/features/cms/audit-logs/audit_logs_api_spec.rb +1 -1
- data/spec/features/cms/blogs/authors/author_api_spec.rb +9 -9
- data/spec/features/cms/{perfomance/public_perfomance_api_spec.rb → performance/public_performance_api_spec.rb} +0 -0
- data/spec/features/crm/imports/public_imports_api_spec.rb +7 -0
- metadata +346 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49773ca87604753beeba481bb492056259454f16f9a984ef165c9a1d4d87556f
|
4
|
+
data.tar.gz: 5802046f01305f5d0c4580cc832b2fa31f3b5e5c01a0429dc45e1583b28220b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd1127831b253716776f3c88a7a5a0e48984ab4f13f266f51a568612e6c3cd154818f80d0b0c023e91cf0612266fed19467b1337509a0cd1424ceb1d1be79115
|
7
|
+
data.tar.gz: 0eb281a32a8746602b7e3c905b4672bcd8708e35aef144f23fcb04deda01657d42429f00c73635565d5db06a80c28d2ccf57446a9928a699d207b481a59efd81
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [11.2.0] - 2022-05-12
|
9
|
+
|
10
|
+
- added discovery classes
|
11
|
+
|
8
12
|
## [11.1.1] - 2021-11-10
|
9
13
|
|
10
14
|
- fixed type for the file collection response
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hubspot-api-client (11.
|
4
|
+
hubspot-api-client (11.2.0)
|
5
5
|
json (~> 2.1, >= 2.1.0)
|
6
6
|
require_all (~> 3.0.0)
|
7
7
|
typhoeus (~> 1.4.0)
|
@@ -16,13 +16,18 @@ GEM
|
|
16
16
|
ZenTest (>= 4.4.1)
|
17
17
|
autotest-growl (0.2.16)
|
18
18
|
autotest-rails-pure (4.1.2)
|
19
|
+
coderay (1.1.3)
|
19
20
|
crack (0.4.4)
|
20
21
|
diff-lcs (1.4.4)
|
21
22
|
ethon (0.15.0)
|
22
23
|
ffi (>= 1.15.0)
|
23
|
-
ffi (1.15.
|
24
|
+
ffi (1.15.5)
|
24
25
|
hashdiff (1.0.1)
|
25
26
|
json (2.6.1)
|
27
|
+
method_source (1.0.0)
|
28
|
+
pry (0.14.1)
|
29
|
+
coderay (~> 1.1)
|
30
|
+
method_source (~> 1.0)
|
26
31
|
public_suffix (4.0.6)
|
27
32
|
rake (12.3.3)
|
28
33
|
rake-release (1.2.1)
|
@@ -57,6 +62,7 @@ DEPENDENCIES
|
|
57
62
|
autotest-growl (~> 0.2, >= 0.2.16)
|
58
63
|
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
59
64
|
hubspot-api-client!
|
65
|
+
pry
|
60
66
|
rake (~> 12.3.3)
|
61
67
|
rake-release
|
62
68
|
rspec (~> 3.6, >= 3.6.0)
|
data/README.md
CHANGED
@@ -36,6 +36,20 @@ basic_api.get_page(auth_names: 'hapikey')
|
|
36
36
|
|
37
37
|
```
|
38
38
|
|
39
|
+
for new discovery classes since version 11.2
|
40
|
+
```ruby
|
41
|
+
# Load the gem
|
42
|
+
require 'hubspot-api-client'
|
43
|
+
|
44
|
+
# Setup client with hapikey authorization
|
45
|
+
client = Hubspot::Client.new(api_key: 'demo')
|
46
|
+
|
47
|
+
# Get contacts
|
48
|
+
basic_api = client.crm.contacts.basic_api
|
49
|
+
basic_api.get_page
|
50
|
+
|
51
|
+
```
|
52
|
+
|
39
53
|
### Usage
|
40
54
|
|
41
55
|
### Get all:
|
@@ -45,6 +59,13 @@ get_all method is available for all major objects (Companies, Contacts, Deals, L
|
|
45
59
|
basic_api = Hubspot::Crm::Contacts::BasicApi.new
|
46
60
|
all_contacts = basic_api.get_all(auth_names: 'oauth2')
|
47
61
|
```
|
62
|
+
|
63
|
+
for new discovery classes since version 11.2
|
64
|
+
```ruby
|
65
|
+
client = Hubspot::Client(access_token: 'your_oauth2_access_token')
|
66
|
+
all_contacts = client.crm.contacts.basic_api.get_all
|
67
|
+
```
|
68
|
+
|
48
69
|
Please note that pagination is used under the hood to get all results.
|
49
70
|
|
50
71
|
|
data/hubspot-api-client.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
|
25
25
|
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
26
26
|
s.add_development_dependency 'rake-release'
|
27
|
+
s.add_development_dependency 'pry'
|
27
28
|
|
28
29
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
29
30
|
f.match(%r{^(sample-apps)/})
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_rel 'discovery'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
class Client
|
5
|
+
attr_reader :api_key, :access_token
|
6
|
+
|
7
|
+
def self.api_modules
|
8
|
+
%i[
|
9
|
+
automation
|
10
|
+
cms
|
11
|
+
communication_preferences
|
12
|
+
conversations
|
13
|
+
crm
|
14
|
+
events
|
15
|
+
files
|
16
|
+
marketing
|
17
|
+
o_auth
|
18
|
+
webhooks
|
19
|
+
].freeze
|
20
|
+
end
|
21
|
+
|
22
|
+
include Hubspot::Discovery::BaseModuleClient
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.base_module
|
27
|
+
'Hubspot::Discovery'
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure_api_key
|
31
|
+
Hubspot.configure do |config|
|
32
|
+
config.api_key['hapikey'] = api_key
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def configure_access_token
|
37
|
+
Hubspot.configure do |config|
|
38
|
+
config.access_token = access_token
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(params)
|
43
|
+
raise 'Please, pass :api_key or :access_token' if params[:api_key].nil? && params[:developer_api_key].nil? && params[:access_token].nil?
|
44
|
+
@api_key = params[:api_key] || params[:developer_api_key]
|
45
|
+
@access_token = params[:access_token]
|
46
|
+
@params = params
|
47
|
+
configure_api_key if @api_key
|
48
|
+
configure_access_token if @access_token
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_rel '../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Automation
|
6
|
+
module Actions
|
7
|
+
class Client
|
8
|
+
def self.api_classes
|
9
|
+
%i[
|
10
|
+
callbacks
|
11
|
+
definitions
|
12
|
+
functions
|
13
|
+
revisions
|
14
|
+
].freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
include Hubspot::Discovery::BaseModuleClient
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Hubspot
|
2
|
+
module Discovery
|
3
|
+
module BaseApiClient
|
4
|
+
attr_reader :base_params
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@base_params = params
|
8
|
+
define_methods
|
9
|
+
end
|
10
|
+
|
11
|
+
def api_methods
|
12
|
+
api.methods.grep(/with_http_info/).map {|elem| elem.to_s.gsub('_with_http_info', '').to_sym }
|
13
|
+
end
|
14
|
+
|
15
|
+
def api_client
|
16
|
+
api&.api_client
|
17
|
+
end
|
18
|
+
|
19
|
+
def api
|
20
|
+
@api ||= Kernel.const_get(codegen_api_class).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_all(params = {})
|
24
|
+
api.get_all(params)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def codegen_api_class
|
30
|
+
self.class.name.gsub('Discovery::', '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def define_methods
|
34
|
+
define_api_methods
|
35
|
+
end
|
36
|
+
|
37
|
+
def define_api_methods
|
38
|
+
api_methods.each do |api_method|
|
39
|
+
self.class.define_method(api_method) do |params = {}|
|
40
|
+
params_with_defaults = params
|
41
|
+
params_with_defaults[:opts] ||= {}
|
42
|
+
params_with_defaults[:opts][:auth_names] = if base_params[:access_token]
|
43
|
+
'oauth2'
|
44
|
+
elsif base_params[:api_key]
|
45
|
+
'hapikey'
|
46
|
+
elsif base_params[:developer_api_key]
|
47
|
+
'developer_hapikey'
|
48
|
+
else
|
49
|
+
raise 'Unauthorized. Please, provide access_token, api_key or developer_api_key'
|
50
|
+
end
|
51
|
+
|
52
|
+
signature_params = api.method(api_method).parameters
|
53
|
+
|
54
|
+
signature_param_names = signature_params.map { |_, param| param }
|
55
|
+
params_with_defaults.each do |param_name, param_value|
|
56
|
+
params_with_defaults[:opts][param_name] = param_value unless signature_param_names.include?(param_name)
|
57
|
+
end
|
58
|
+
|
59
|
+
params_to_pass = signature_params.map do |req, param|
|
60
|
+
raise "Param #{param} is required for #{api.class}\##{api_method} method" if req == :req && params_with_defaults[param].nil?
|
61
|
+
params_with_defaults[param]
|
62
|
+
end
|
63
|
+
|
64
|
+
api.public_send(api_method, *params_to_pass)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require_rel '../helpers/camel_case'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module BaseModuleClient
|
6
|
+
module ClassMethods
|
7
|
+
def base_module
|
8
|
+
modules = name.split('::')
|
9
|
+
modules.pop
|
10
|
+
modules.join('::')
|
11
|
+
end
|
12
|
+
|
13
|
+
def api_modules
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
|
17
|
+
def api_classes
|
18
|
+
[]
|
19
|
+
end
|
20
|
+
|
21
|
+
def define_methods
|
22
|
+
define_modules_methods
|
23
|
+
define_classes_methods
|
24
|
+
end
|
25
|
+
|
26
|
+
def define_modules_methods
|
27
|
+
api_modules.each do |api_module|
|
28
|
+
define_method(api_module) do
|
29
|
+
Kernel.const_get("#{self.class.base_module}::#{Hubspot::Helpers::CamelCase.new.format(__method__.to_s)}::Client").new(params)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def define_classes_methods
|
35
|
+
api_classes.each do |api_class|
|
36
|
+
define_method("#{api_class}_api") do
|
37
|
+
Kernel.const_get("#{self.class.base_module}::#{Hubspot::Helpers::CamelCase.new.format(__method__.to_s)}").new(params)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
attr_reader :params
|
44
|
+
|
45
|
+
def initialize(params)
|
46
|
+
@params = params
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.included(base)
|
50
|
+
base.extend(ClassMethods)
|
51
|
+
base.class_eval { define_methods }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_rel '../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module AuditLogs
|
7
|
+
class Client
|
8
|
+
def self.api_classes
|
9
|
+
%i[
|
10
|
+
audit_logs
|
11
|
+
].freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
include Hubspot::Discovery::BaseModuleClient
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_rel '../../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Blogs
|
7
|
+
module Authors
|
8
|
+
class Client
|
9
|
+
def self.api_classes
|
10
|
+
%i[
|
11
|
+
author
|
12
|
+
].freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
include Hubspot::Discovery::BaseModuleClient
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_rel '../../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Blogs
|
7
|
+
module BlogPosts
|
8
|
+
class Client
|
9
|
+
def self.api_classes
|
10
|
+
%i[
|
11
|
+
blog_post
|
12
|
+
].freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
include Hubspot::Discovery::BaseModuleClient
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_rel '../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Blogs
|
7
|
+
class Client
|
8
|
+
def self.api_modules
|
9
|
+
%i[
|
10
|
+
authors
|
11
|
+
blog_posts
|
12
|
+
tags
|
13
|
+
].freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
include Hubspot::Discovery::BaseModuleClient
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_rel '../../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Blogs
|
7
|
+
module Tags
|
8
|
+
class Client
|
9
|
+
def self.api_classes
|
10
|
+
%i[
|
11
|
+
tag
|
12
|
+
].freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
include Hubspot::Discovery::BaseModuleClient
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_rel '../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
class Client
|
7
|
+
def self.api_modules
|
8
|
+
%i[
|
9
|
+
audit_logs
|
10
|
+
blogs
|
11
|
+
domains
|
12
|
+
hubdb
|
13
|
+
performance
|
14
|
+
site_search
|
15
|
+
url_redirects
|
16
|
+
].freeze
|
17
|
+
end
|
18
|
+
|
19
|
+
include Hubspot::Discovery::BaseModuleClient
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_rel '../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Domains
|
7
|
+
class Client
|
8
|
+
def self.api_classes
|
9
|
+
%i[
|
10
|
+
domains
|
11
|
+
].freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
include Hubspot::Discovery::BaseModuleClient
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_rel '../../base_module_client'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
module Discovery
|
5
|
+
module Cms
|
6
|
+
module Hubdb
|
7
|
+
class Client
|
8
|
+
def self.api_classes
|
9
|
+
%i[
|
10
|
+
rows
|
11
|
+
rows_batch
|
12
|
+
tables
|
13
|
+
].freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
include Hubspot::Discovery::BaseModuleClient
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|