hubspot-api-client 15.0.0 → 15.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e5d57460bdda8cbf2fc666059e9395762d26202a84f30e056dbde2117f28724
4
- data.tar.gz: 7850afe9111512e550dc7ceb610e67f2cc9ce8615efef94fab894c98bfa2fb5a
3
+ metadata.gz: a4e2a40b9546a8237be6d5ad839b82641882db1e52c432de3266df0faead2314
4
+ data.tar.gz: 70e8a203d740012fdf15be014f1acbe0cb7c3e3d7f4fc51bbb90833d4b471744
5
5
  SHA512:
6
- metadata.gz: 9e5adbb09e055024a83f888ddc2b3e5f9eab6d57d301297cf5b1c7a55833ba7a513af0fe9bc2da85637edb4fe3fad382484571c619c302a01a4874a175ddfa66
7
- data.tar.gz: bff167e47d455162d09a78883d866644cad52b00193150668177e32da752108ee532f520bf0781c5fb8af950e2093886a124cbb272c86c8065a1cd517d5e6e86
6
+ metadata.gz: 9a19797f24e9cf9ebe7d8c1c462211a7128be75222ea66ffb5f8b7767e8b946f635d6d4f2bf66a5b52373f5905cf4c73b62592702523ccd0b2660264ccfeface
7
+ data.tar.gz: 32a4bbbd501d66b2a2be7e5214c9c99cdd37ad4483e809ca74fb88a2490cec71eb871d6198dd6b07f7e931b5c79ad1af7ce36be750c457bfaf28b8b38895f6a7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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
+ ## [15.0.2] - 2022-11-04
9
+ ### Fixed
10
+
11
+ - pass params with snake case
12
+
13
+ ## [15.0.1] - 2022-10-17
14
+ ### Fixed
15
+
16
+ - codegen path mapping for requiring models
17
+
8
18
  ## [15.0.0] - 2022-10-12
9
19
  ### Changed
10
20
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubspot-api-client (15.0.0)
4
+ hubspot-api-client (15.0.2)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.4.0)
7
7
 
@@ -33,19 +33,19 @@ GEM
33
33
  rake-release (1.3.0)
34
34
  bundler (>= 1.11, < 3)
35
35
  rexml (3.2.5)
36
- rspec (3.11.0)
37
- rspec-core (~> 3.11.0)
38
- rspec-expectations (~> 3.11.0)
39
- rspec-mocks (~> 3.11.0)
40
- rspec-core (3.11.0)
41
- rspec-support (~> 3.11.0)
42
- rspec-expectations (3.11.1)
36
+ rspec (3.12.0)
37
+ rspec-core (~> 3.12.0)
38
+ rspec-expectations (~> 3.12.0)
39
+ rspec-mocks (~> 3.12.0)
40
+ rspec-core (3.12.0)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-expectations (3.12.0)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.11.0)
45
- rspec-mocks (3.11.1)
44
+ rspec-support (~> 3.12.0)
45
+ rspec-mocks (3.12.0)
46
46
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.11.0)
48
- rspec-support (3.11.1)
47
+ rspec-support (~> 3.12.0)
48
+ rspec-support (3.12.0)
49
49
  typhoeus (1.4.0)
50
50
  ethon (>= 0.9.0)
51
51
  vcr (3.0.3)
@@ -23,14 +23,14 @@ module Hubspot
23
23
  end
24
24
 
25
25
  def api_client
26
- require_with_mapping "#{codegen_module_path}/api_client"
26
+ require_codegen "#{codegen_module_path}/api_client"
27
27
  require_api_error
28
28
  @api_client ||= Kernel.const_get( "#{codegen_module_name}::ApiClient").new(config)
29
29
  end
30
30
 
31
31
  def api
32
32
  class_name = codegen_api_path.gsub(/(.*)\/(.*)/, '\2')
33
- require_with_mapping codegen_api_path.gsub(class_name, "api/#{class_name}")
33
+ require_codegen codegen_api_path.gsub(class_name, "api/#{class_name}")
34
34
  require_api_models
35
35
  @api ||= Kernel.const_get(codegen_api_class).new(api_client)
36
36
  end
@@ -42,7 +42,7 @@ module Hubspot
42
42
  private
43
43
 
44
44
  def new_config
45
- require_with_mapping "#{codegen_module_path}/configuration"
45
+ require_codegen "#{codegen_module_path}/configuration"
46
46
  config = Kernel.const_get("#{codegen_module_name}::Configuration").new
47
47
  config.access_token = base_params[:access_token] if base_params[:access_token]
48
48
  config.api_key['hapikey'] = base_params[:api_key] if base_params[:api_key]
@@ -50,8 +50,8 @@ module Hubspot
50
50
  config
51
51
  end
52
52
 
53
- def require_with_mapping(path)
54
- Hubspot::Helpers::Path.new.require_with_mapping(path)
53
+ def require_codegen(path)
54
+ Hubspot::Helpers::Path.new.require_with_codegen_mapping(path)
55
55
  end
56
56
 
57
57
  def require_api_models
@@ -59,7 +59,7 @@ module Hubspot
59
59
  require 'hubspot/helpers/path'
60
60
  codegen_module_path = Hubspot::Helpers::Path.new.format(self.name).gsub('hubspot/', 'hubspot/codegen/')
61
61
  codegen_model = Hubspot::Helpers::Path.new.format(const)
62
- Hubspot::Helpers::Path.new.require_with_mapping("#{codegen_module_path}/models/#{codegen_model}")
62
+ Hubspot::Helpers::Path.new.require_with_codegen_mapping("#{codegen_module_path}/models/#{codegen_model}")
63
63
  super
64
64
  rescue LoadError
65
65
  super
@@ -67,7 +67,7 @@ module Hubspot
67
67
  end
68
68
 
69
69
  def require_api_error
70
- require_with_mapping "#{codegen_module_path}/api_error"
70
+ require_codegen "#{codegen_module_path}/api_error"
71
71
  end
72
72
 
73
73
  def codegen_api_class
@@ -124,6 +124,19 @@ module Hubspot
124
124
  end
125
125
  end
126
126
 
127
+ def convert_body(body)
128
+ converted_body = {}
129
+ body.each do |key, value|
130
+ camel_case_key = Hubspot::Helpers::CamelCase.new.format(key.to_s)
131
+ camel_case_key = camel_case_key[0, 1].downcase + camel_case_key[1..-1]
132
+ converted_value = value
133
+ converted_value = convert_body(value) if value.is_a?(Hash)
134
+ converted_value = value.map { |elem| elem.is_a?(Hash) ? convert_body(elem) : elem } if value.is_a?(Array)
135
+ converted_body[camel_case_key.to_sym] = converted_value
136
+ end
137
+ converted_body
138
+ end
139
+
127
140
  def define_methods
128
141
  define_api_methods
129
142
  end
@@ -153,8 +166,9 @@ module Hubspot
153
166
  params_to_pass = signature_params.map do |req, param|
154
167
  if params_with_defaults[param].nil?
155
168
  model_name = Hubspot::Helpers::CamelCase.new.format(param.to_s)
156
- require_with_mapping "#{codegen_module_path}/models/#{param.to_s}"
157
- Kernel.const_get("#{codegen_module_name}::#{model_name}").build_from_hash(params_with_defaults[:body])
169
+ require_codegen "#{codegen_module_path}/models/#{param.to_s}"
170
+ converted_body = convert_body(params_with_defaults[:body])
171
+ Kernel.const_get("#{codegen_module_name}::#{model_name}").build_from_hash(converted_body)
158
172
  else
159
173
  params_with_defaults[param]
160
174
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module AuditLogs
7
7
  class AuditLogsApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('audit_logs/', 'audit-logs/')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -7,10 +7,6 @@ module Hubspot
7
7
  module BlogPosts
8
8
  class BlogPostsApi
9
9
  include Hubspot::Discovery::BaseApiClient
10
-
11
- def codegen_api_path
12
- super.gsub('blog_posts/', 'blog-posts/')
13
- end
14
10
  end
15
11
  end
16
12
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SiteSearch
7
7
  class PublicApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('site_search', 'site-search')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SourceCode
7
7
  class ContentApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('source_code', 'source-code')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SourceCode
7
7
  class ExtractApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('source_code', 'source-code')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SourceCode
7
7
  class MetadataApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('source_code', 'source-code')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SourceCode
7
7
  class SourceCodeExtractApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('source_code/', 'source-code/')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module SourceCode
7
7
  class ValidationApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('source_code', 'source-code')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module UrlRedirects
7
7
  class RedirectsApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('url_redirects', 'url-redirects')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -6,10 +6,6 @@ module Hubspot
6
6
  module VisitorIdentification
7
7
  class GenerateApi
8
8
  include Hubspot::Discovery::BaseApiClient
9
-
10
- def codegen_api_path
11
- super.gsub('visitor_identification', 'visitor-identification')
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -10,6 +10,17 @@ module Hubspot
10
10
  def require_with_mapping(path)
11
11
  require path.gsub('o_auth', 'oauth')
12
12
  end
13
+
14
+ def require_with_codegen_mapping(path)
15
+ require path
16
+ .gsub('o_auth', 'oauth')
17
+ .gsub('audit_logs/', 'audit-logs/')
18
+ .gsub('blog_posts/', 'blog-posts/')
19
+ .gsub('site_search', 'site-search')
20
+ .gsub('source_code/', 'source-code/')
21
+ .gsub('url_redirects', 'url-redirects')
22
+ .gsub('visitor_identification', 'visitor-identification')
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -1,3 +1,3 @@
1
1
  module Hubspot
2
- VERSION = '15.0.0'
2
+ VERSION = '15.0.2'
3
3
  end
@@ -6,7 +6,7 @@ describe 'Hubspot::Discovery::BaseApiClient' do
6
6
  class Hubspot::Discovery::SomeApiClass
7
7
  include Hubspot::Discovery::BaseApiClient
8
8
 
9
- def require_with_mapping(path)
9
+ def require_codegen(path)
10
10
  path
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubspot-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.0.0
4
+ version: 15.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - HubSpot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus