hubspot-api-client 11.1.1 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +8 -2
  4. data/README.md +21 -0
  5. data/hubspot-api-client.gemspec +1 -0
  6. data/lib/hubspot/client.rb +51 -0
  7. data/lib/hubspot/discovery/automation/actions/api/callbacks_api.rb +13 -0
  8. data/lib/hubspot/discovery/automation/actions/api/definitions_api.rb +13 -0
  9. data/lib/hubspot/discovery/automation/actions/api/functions_api.rb +13 -0
  10. data/lib/hubspot/discovery/automation/actions/api/revisions_api.rb +13 -0
  11. data/lib/hubspot/discovery/automation/actions/client.rb +22 -0
  12. data/lib/hubspot/discovery/automation/client.rb +17 -0
  13. data/lib/hubspot/discovery/base_api_client.rb +70 -0
  14. data/lib/hubspot/discovery/base_module_client.rb +55 -0
  15. data/lib/hubspot/discovery/cms/audit_logs/api/audit_logs_api.rb +13 -0
  16. data/lib/hubspot/discovery/cms/audit_logs/client.rb +19 -0
  17. data/lib/hubspot/discovery/cms/blogs/authors/api/author_api.rb +15 -0
  18. data/lib/hubspot/discovery/cms/blogs/authors/client.rb +21 -0
  19. data/lib/hubspot/discovery/cms/blogs/blog_posts/api/blog_post_api.rb +15 -0
  20. data/lib/hubspot/discovery/cms/blogs/blog_posts/client.rb +21 -0
  21. data/lib/hubspot/discovery/cms/blogs/client.rb +21 -0
  22. data/lib/hubspot/discovery/cms/blogs/tags/api/tag_api.rb +15 -0
  23. data/lib/hubspot/discovery/cms/blogs/tags/client.rb +21 -0
  24. data/lib/hubspot/discovery/cms/client.rb +23 -0
  25. data/lib/hubspot/discovery/cms/domains/api/domains_api.rb +13 -0
  26. data/lib/hubspot/discovery/cms/domains/client.rb +19 -0
  27. data/lib/hubspot/discovery/cms/hubdb/api/rows_api.rb +13 -0
  28. data/lib/hubspot/discovery/cms/hubdb/api/rows_batch_api.rb +13 -0
  29. data/lib/hubspot/discovery/cms/hubdb/api/tables_api.rb +13 -0
  30. data/lib/hubspot/discovery/cms/hubdb/client.rb +21 -0
  31. data/lib/hubspot/discovery/cms/performance/api/public_performance_api.rb +13 -0
  32. data/lib/hubspot/discovery/cms/performance/client.rb +19 -0
  33. data/lib/hubspot/discovery/cms/site_search/api/public_api.rb +13 -0
  34. data/lib/hubspot/discovery/cms/site_search/client.rb +19 -0
  35. data/lib/hubspot/discovery/cms/url_redirects/api/redirects_api.rb +13 -0
  36. data/lib/hubspot/discovery/cms/url_redirects/client.rb +19 -0
  37. data/lib/hubspot/discovery/communication_preferences/api/definition_api.rb +11 -0
  38. data/lib/hubspot/discovery/communication_preferences/api/status_api.rb +11 -0
  39. data/lib/hubspot/discovery/communication_preferences/client.rb +18 -0
  40. data/lib/hubspot/discovery/conversations/client.rb +17 -0
  41. data/lib/hubspot/discovery/conversations/visitor_identification/api/generate_api.rb +13 -0
  42. data/lib/hubspot/discovery/conversations/visitor_identification/client.rb +19 -0
  43. data/lib/hubspot/discovery/crm/associations/api/batch_api.rb +13 -0
  44. data/lib/hubspot/discovery/crm/associations/api/types_api.rb +13 -0
  45. data/lib/hubspot/discovery/crm/associations/client.rb +20 -0
  46. data/lib/hubspot/discovery/crm/client.rb +32 -0
  47. data/lib/hubspot/discovery/crm/companies/api/associations_api.rb +13 -0
  48. data/lib/hubspot/discovery/crm/companies/api/basic_api.rb +13 -0
  49. data/lib/hubspot/discovery/crm/companies/api/batch_api.rb +13 -0
  50. data/lib/hubspot/discovery/crm/companies/api/search_api.rb +13 -0
  51. data/lib/hubspot/discovery/crm/companies/client.rb +22 -0
  52. data/lib/hubspot/discovery/crm/contacts/api/associations_api.rb +13 -0
  53. data/lib/hubspot/discovery/crm/contacts/api/basic_api.rb +13 -0
  54. data/lib/hubspot/discovery/crm/contacts/api/batch_api.rb +13 -0
  55. data/lib/hubspot/discovery/crm/contacts/api/gdpr_api.rb +13 -0
  56. data/lib/hubspot/discovery/crm/contacts/api/search_api.rb +13 -0
  57. data/lib/hubspot/discovery/crm/contacts/client.rb +23 -0
  58. data/lib/hubspot/discovery/crm/deals/api/associations_api.rb +13 -0
  59. data/lib/hubspot/discovery/crm/deals/api/basic_api.rb +13 -0
  60. data/lib/hubspot/discovery/crm/deals/api/batch_api.rb +13 -0
  61. data/lib/hubspot/discovery/crm/deals/api/search_api.rb +13 -0
  62. data/lib/hubspot/discovery/crm/deals/client.rb +22 -0
  63. data/lib/hubspot/discovery/crm/extensions/accounting/api/callbacks_api.rb +15 -0
  64. data/lib/hubspot/discovery/crm/extensions/accounting/api/invoice_api.rb +15 -0
  65. data/lib/hubspot/discovery/crm/extensions/accounting/api/settings_api.rb +15 -0
  66. data/lib/hubspot/discovery/crm/extensions/accounting/api/sync_api.rb +15 -0
  67. data/lib/hubspot/discovery/crm/extensions/accounting/api/user_accounts_api.rb +15 -0
  68. data/lib/hubspot/discovery/crm/extensions/accounting/client.rb +25 -0
  69. data/lib/hubspot/discovery/crm/extensions/calling/api/settings_api.rb +15 -0
  70. data/lib/hubspot/discovery/crm/extensions/calling/client.rb +21 -0
  71. data/lib/hubspot/discovery/crm/extensions/cards/api/cards_api.rb +15 -0
  72. data/lib/hubspot/discovery/crm/extensions/cards/api/sample_response_api.rb +15 -0
  73. data/lib/hubspot/discovery/crm/extensions/cards/client.rb +22 -0
  74. data/lib/hubspot/discovery/crm/extensions/client.rb +22 -0
  75. data/lib/hubspot/discovery/crm/extensions/videoconferencing/api/settings_api.rb +15 -0
  76. data/lib/hubspot/discovery/crm/extensions/videoconferencing/client.rb +21 -0
  77. data/lib/hubspot/discovery/crm/imports/api/core_api.rb +13 -0
  78. data/lib/hubspot/discovery/crm/imports/api/public_imports_api.rb +13 -0
  79. data/lib/hubspot/discovery/crm/imports/client.rb +20 -0
  80. data/lib/hubspot/discovery/crm/line_items/api/associations_api.rb +13 -0
  81. data/lib/hubspot/discovery/crm/line_items/api/basic_api.rb +13 -0
  82. data/lib/hubspot/discovery/crm/line_items/api/batch_api.rb +13 -0
  83. data/lib/hubspot/discovery/crm/line_items/api/search_api.rb +13 -0
  84. data/lib/hubspot/discovery/crm/line_items/client.rb +22 -0
  85. data/lib/hubspot/discovery/crm/objects/api/associations_api.rb +13 -0
  86. data/lib/hubspot/discovery/crm/objects/api/basic_api.rb +13 -0
  87. data/lib/hubspot/discovery/crm/objects/api/batch_api.rb +13 -0
  88. data/lib/hubspot/discovery/crm/objects/api/gdpr_api.rb +13 -0
  89. data/lib/hubspot/discovery/crm/objects/api/search_api.rb +13 -0
  90. data/lib/hubspot/discovery/crm/objects/client.rb +29 -0
  91. data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/associations_api.rb +15 -0
  92. data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/basic_api.rb +15 -0
  93. data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/batch_api.rb +15 -0
  94. data/lib/hubspot/discovery/crm/objects/feedback_submissions/api/search_api.rb +15 -0
  95. data/lib/hubspot/discovery/crm/objects/feedback_submissions/client.rb +24 -0
  96. data/lib/hubspot/discovery/crm/owners/api/owners_api.rb +13 -0
  97. data/lib/hubspot/discovery/crm/owners/client.rb +19 -0
  98. data/lib/hubspot/discovery/crm/pipelines/api/pipeline_stages_api.rb +13 -0
  99. data/lib/hubspot/discovery/crm/pipelines/api/pipelines_api.rb +13 -0
  100. data/lib/hubspot/discovery/crm/pipelines/client.rb +20 -0
  101. data/lib/hubspot/discovery/crm/products/api/associations_api.rb +13 -0
  102. data/lib/hubspot/discovery/crm/products/api/basic_api.rb +13 -0
  103. data/lib/hubspot/discovery/crm/products/api/batch_api.rb +13 -0
  104. data/lib/hubspot/discovery/crm/products/api/search_api.rb +13 -0
  105. data/lib/hubspot/discovery/crm/products/client.rb +22 -0
  106. data/lib/hubspot/discovery/crm/properties/api/batch_api.rb +13 -0
  107. data/lib/hubspot/discovery/crm/properties/api/core_api.rb +13 -0
  108. data/lib/hubspot/discovery/crm/properties/api/groups_api.rb +13 -0
  109. data/lib/hubspot/discovery/crm/properties/client.rb +21 -0
  110. data/lib/hubspot/discovery/crm/quotes/api/associations_api.rb +13 -0
  111. data/lib/hubspot/discovery/crm/quotes/api/basic_api.rb +13 -0
  112. data/lib/hubspot/discovery/crm/quotes/api/batch_api.rb +13 -0
  113. data/lib/hubspot/discovery/crm/quotes/api/search_api.rb +13 -0
  114. data/lib/hubspot/discovery/crm/quotes/client.rb +22 -0
  115. data/lib/hubspot/discovery/crm/schemas/api/core_api.rb +13 -0
  116. data/lib/hubspot/discovery/crm/schemas/api/public_object_schemas_api.rb +13 -0
  117. data/lib/hubspot/discovery/crm/schemas/client.rb +20 -0
  118. data/lib/hubspot/discovery/crm/tickets/api/associations_api.rb +13 -0
  119. data/lib/hubspot/discovery/crm/tickets/api/basic_api.rb +13 -0
  120. data/lib/hubspot/discovery/crm/tickets/api/batch_api.rb +13 -0
  121. data/lib/hubspot/discovery/crm/tickets/api/search_api.rb +13 -0
  122. data/lib/hubspot/discovery/crm/tickets/client.rb +22 -0
  123. data/lib/hubspot/discovery/crm/timeline/api/events_api.rb +13 -0
  124. data/lib/hubspot/discovery/crm/timeline/api/templates_api.rb +13 -0
  125. data/lib/hubspot/discovery/crm/timeline/api/tokens_api.rb +13 -0
  126. data/lib/hubspot/discovery/crm/timeline/client.rb +21 -0
  127. data/lib/hubspot/discovery/events/api/events_api.rb +11 -0
  128. data/lib/hubspot/discovery/events/client.rb +17 -0
  129. data/lib/hubspot/discovery/files/client.rb +17 -0
  130. data/lib/hubspot/discovery/files/files/api/files_api.rb +13 -0
  131. data/lib/hubspot/discovery/files/files/api/folders_api.rb +13 -0
  132. data/lib/hubspot/discovery/files/files/client.rb +20 -0
  133. data/lib/hubspot/discovery/marketing/client.rb +17 -0
  134. data/lib/hubspot/discovery/marketing/transactional/api/public_smtp_tokens_api.rb +13 -0
  135. data/lib/hubspot/discovery/marketing/transactional/api/single_send_api.rb +13 -0
  136. data/lib/hubspot/discovery/marketing/transactional/client.rb +20 -0
  137. data/lib/hubspot/discovery/oauth/api/access_tokens_api.rb +11 -0
  138. data/lib/hubspot/discovery/oauth/api/refresh_tokens_api.rb +11 -0
  139. data/lib/hubspot/discovery/oauth/api/tokens_api.rb +11 -0
  140. data/lib/hubspot/discovery/oauth/client.rb +19 -0
  141. data/lib/hubspot/discovery/webhooks/api/settings_api.rb +11 -0
  142. data/lib/hubspot/discovery/webhooks/api/subscriptions_api.rb +11 -0
  143. data/lib/hubspot/discovery/webhooks/client.rb +18 -0
  144. data/lib/hubspot/helpers/camel_case.rb +9 -0
  145. data/lib/hubspot/helpers/snake_case.rb +13 -0
  146. data/lib/hubspot/version.rb +1 -1
  147. data/lib/hubspot-api-client.rb +1 -0
  148. data/spec/discovery/automation/actions/callbacks_api_spec.rb +8 -0
  149. data/spec/discovery/automation/actions/definitions_api_spec.rb +11 -0
  150. data/spec/discovery/automation/actions/functions_api_spec.rb +13 -0
  151. data/spec/discovery/automation/actions/revisions_api_spec.rb +8 -0
  152. data/spec/discovery/base_api_client_spec.rb +69 -0
  153. data/spec/discovery/base_module_client_spec.rb +28 -0
  154. data/spec/discovery/client_spec.rb +16 -0
  155. data/spec/discovery/cms/audit-logs/audit_logs_api_spec.rb +7 -0
  156. data/spec/discovery/cms/blogs/authors/author_api_spec.rb +15 -0
  157. data/spec/discovery/cms/blogs/blog-posts/blog_post_api_spec.rb +25 -0
  158. data/spec/discovery/cms/blogs/tags/tag_api_spec.rb +15 -0
  159. data/spec/discovery/cms/domains/domains_api_spec.rb +8 -0
  160. data/spec/discovery/cms/hubdb/rows_api_spec.rb +15 -0
  161. data/spec/discovery/cms/hubdb/rows_batch_api_spec.rb +13 -0
  162. data/spec/discovery/cms/hubdb/tables_api_spec.rb +20 -0
  163. data/spec/discovery/cms/performance/public_performance_api_spec.rb +8 -0
  164. data/spec/discovery/cms/site-search/public_api_spec.rb +8 -0
  165. data/spec/discovery/cms/url-redirects/redirects_api_spec.rb +11 -0
  166. data/spec/discovery/communication_preferences/definition_api_spec.rb +7 -0
  167. data/spec/discovery/communication_preferences/status_api_spec.rb +9 -0
  168. data/spec/discovery/conversations/visitor-identification/generate_api_spec.rb +7 -0
  169. data/spec/discovery/crm/associations/batch_api_spec.rb +9 -0
  170. data/spec/discovery/crm/associations/types_api_spec.rb +7 -0
  171. data/spec/discovery/crm/companies/associations_api_spec.rb +9 -0
  172. data/spec/discovery/crm/companies/basic_api_spec.rb +11 -0
  173. data/spec/discovery/crm/companies/batch_api_spec.rb +10 -0
  174. data/spec/discovery/crm/companies/search_api_spec.rb +7 -0
  175. data/spec/discovery/crm/contacts/associations_api_spec.rb +9 -0
  176. data/spec/discovery/crm/contacts/basic_api_spec.rb +11 -0
  177. data/spec/discovery/crm/contacts/batch_api_spec.rb +10 -0
  178. data/spec/discovery/crm/contacts/gdpr_api_spec.rb +8 -0
  179. data/spec/discovery/crm/contacts/search_api_spec.rb +7 -0
  180. data/spec/discovery/crm/deals/associations_api_spec.rb +9 -0
  181. data/spec/discovery/crm/deals/basic_api_spec.rb +11 -0
  182. data/spec/discovery/crm/deals/batch_api_spec.rb +10 -0
  183. data/spec/discovery/crm/deals/search_api_spec.rb +7 -0
  184. data/spec/discovery/crm/extensions/accounting/callbacks_api_spec.rb +16 -0
  185. data/spec/discovery/crm/extensions/accounting/invoice_api_spec.rb +9 -0
  186. data/spec/discovery/crm/extensions/accounting/settings_api_spec.rb +8 -0
  187. data/spec/discovery/crm/extensions/accounting/sync_api_spec.rb +8 -0
  188. data/spec/discovery/crm/extensions/accounting/user_accounts_api_spec.rb +8 -0
  189. data/spec/discovery/crm/extensions/calling/settings_api_spec.rb +10 -0
  190. data/spec/discovery/crm/extensions/cards/cards_api_spec.rb +11 -0
  191. data/spec/discovery/crm/extensions/cards/sample_response_api_spec.rb +7 -0
  192. data/spec/discovery/crm/extensions/videoconferencing/settings_api_spec.rb +9 -0
  193. data/spec/discovery/crm/imports/core_api_spec.rb +10 -0
  194. data/spec/discovery/crm/imports/public_imports_api_spec.rb +7 -0
  195. data/spec/discovery/crm/line_items/associations_api_spec.rb +9 -0
  196. data/spec/discovery/crm/line_items/basic_api_spec.rb +11 -0
  197. data/spec/discovery/crm/line_items/batch_api_spec.rb +10 -0
  198. data/spec/discovery/crm/line_items/search_api_spec.rb +7 -0
  199. data/spec/discovery/crm/objects/associations_api_spec.rb +9 -0
  200. data/spec/discovery/crm/objects/basic_api_spec.rb +12 -0
  201. data/spec/discovery/crm/objects/batch_api_spec.rb +10 -0
  202. data/spec/discovery/crm/objects/feedback_submissions/associations_api_spec.rb +7 -0
  203. data/spec/discovery/crm/objects/feedback_submissions/basic_api_spec.rb +8 -0
  204. data/spec/discovery/crm/objects/feedback_submissions/batch_api_spec.rb +7 -0
  205. data/spec/discovery/crm/objects/feedback_submissions/search_api_spec.rb +7 -0
  206. data/spec/discovery/crm/objects/gdpr_api_spec.rb +8 -0
  207. data/spec/discovery/crm/objects/search_api_spec.rb +7 -0
  208. data/spec/discovery/crm/owners/owners_api_spec.rb +8 -0
  209. data/spec/discovery/crm/pipelines/pipeline_stages_api_spec.rb +12 -0
  210. data/spec/discovery/crm/pipelines/pipelines_api_spec.rb +12 -0
  211. data/spec/discovery/crm/products/associations_api_spec.rb +9 -0
  212. data/spec/discovery/crm/products/basic_api_spec.rb +11 -0
  213. data/spec/discovery/crm/products/batch_api_spec.rb +10 -0
  214. data/spec/discovery/crm/products/search_api_spec.rb +7 -0
  215. data/spec/discovery/crm/properties/batch_api_spec.rb +9 -0
  216. data/spec/discovery/crm/properties/core_api_spec.rb +11 -0
  217. data/spec/discovery/crm/properties/groups_api_spec.rb +11 -0
  218. data/spec/discovery/crm/quotes/associations_api_spec.rb +7 -0
  219. data/spec/discovery/crm/quotes/basic_api_spec.rb +8 -0
  220. data/spec/discovery/crm/quotes/batch_api_spec.rb +7 -0
  221. data/spec/discovery/crm/quotes/search_api_spec.rb +7 -0
  222. data/spec/discovery/crm/schemas/core_api_spec.rb +13 -0
  223. data/spec/discovery/crm/schemas/public_object_schemas_api_spec.rb +7 -0
  224. data/spec/discovery/crm/tickets/associations_api_spec.rb +9 -0
  225. data/spec/discovery/crm/tickets/basic_api_spec.rb +11 -0
  226. data/spec/discovery/crm/tickets/batch_api_spec.rb +10 -0
  227. data/spec/discovery/crm/tickets/search_api_spec.rb +7 -0
  228. data/spec/discovery/crm/timeline/events_api_spec.rb +11 -0
  229. data/spec/discovery/crm/timeline/templates_api_spec.rb +11 -0
  230. data/spec/discovery/crm/timeline/tokens_api_spec.rb +9 -0
  231. data/spec/discovery/events/events_api_spec.rb +7 -0
  232. data/spec/discovery/files/files/files_api_spec.rb +16 -0
  233. data/spec/discovery/files/files/folders_api_spec.rb +14 -0
  234. data/spec/discovery/marketing/transactional/public_smtp_tokens_api_spec.rb +11 -0
  235. data/spec/discovery/marketing/transactional/single_send_api_spec.rb +7 -0
  236. data/spec/discovery/oauth/access_tokens_api_spec.rb +7 -0
  237. data/spec/discovery/oauth/refresh_tokens_api_spec.rb +8 -0
  238. data/spec/discovery/oauth/tokens_api_spec.rb +7 -0
  239. data/spec/discovery/webhooks/settings_api_spec.rb +9 -0
  240. data/spec/discovery/webhooks/subscriptions_api_spec.rb +12 -0
  241. data/spec/features/cms/audit-logs/audit_logs_api_spec.rb +1 -1
  242. data/spec/features/cms/blogs/authors/author_api_spec.rb +9 -9
  243. data/spec/features/cms/{perfomance/public_perfomance_api_spec.rb → performance/public_performance_api_spec.rb} +0 -0
  244. data/spec/features/crm/imports/public_imports_api_spec.rb +7 -0
  245. metadata +346 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd888658c9c0cc15a649689283777ae7549822cc23aae28f1bbf0c0bc34e3c22
4
- data.tar.gz: 57daa809842df882bbcf2665f53220f54377e565ae3d5753848a15cc21752590
3
+ metadata.gz: 49773ca87604753beeba481bb492056259454f16f9a984ef165c9a1d4d87556f
4
+ data.tar.gz: 5802046f01305f5d0c4580cc832b2fa31f3b5e5c01a0429dc45e1583b28220b5
5
5
  SHA512:
6
- metadata.gz: ccfac78fee61915505f85c358efc1bb99ccd32e3250477c2c6d3f1e6e81308efb6a9dfceee83c392fb099d259cbe091bec05b00e66d722d45105647d346eb94a
7
- data.tar.gz: '08390b483ca63ca77597992930faf3924f579466cd0ef0ce468864bd7f5b361c82a88d7bccffcff8eb709285450bcd8dba4e1f03e4780b7cfc762a43d04d9af4'
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.1.1)
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.4)
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
 
@@ -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,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Automation
6
+ module Actions
7
+ class CallbacksApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Automation
6
+ module Actions
7
+ class DefinitionsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Automation
6
+ module Actions
7
+ class FunctionsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Automation
6
+ module Actions
7
+ class RevisionsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ 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,17 @@
1
+ require_rel '../base_module_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Automation
6
+ class Client
7
+ def self.api_modules
8
+ %i[
9
+ actions
10
+ ].freeze
11
+ end
12
+
13
+ include Hubspot::Discovery::BaseModuleClient
14
+ end
15
+ end
16
+ end
17
+ 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,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module AuditLogs
7
+ class AuditLogsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ 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,15 @@
1
+ require_rel '../../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Blogs
7
+ module Authors
8
+ class AuthorApi
9
+ include Hubspot::Discovery::BaseApiClient
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ 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,15 @@
1
+ require_rel '../../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Blogs
7
+ module BlogPosts
8
+ class BlogPostApi
9
+ include Hubspot::Discovery::BaseApiClient
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ 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,15 @@
1
+ require_rel '../../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Blogs
7
+ module Tags
8
+ class TagApi
9
+ include Hubspot::Discovery::BaseApiClient
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ 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,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Domains
7
+ class DomainsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ 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,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Hubdb
7
+ class RowsApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Hubdb
7
+ class RowsBatchApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require_rel '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Cms
6
+ module Hubdb
7
+ class TablesApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ 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