hubspot-api-client 14.1.0 → 14.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 258c55c06d2bb92967ba618919065c527f886d5066f771fae9cd40bde1f7999e
4
- data.tar.gz: deb1a80f49da296b0ea65e5bbdd8736f8568167808974db91dbfbbb4b62f8e5e
3
+ metadata.gz: a4cf7152f7d94654ae7efaef840fc2232392091973642e5b6a877358d665c687
4
+ data.tar.gz: 7f9b630bc30d894300a8317f170583c1179684f3915f50055821e63fe892bcb4
5
5
  SHA512:
6
- metadata.gz: 1551a766599640bfef6efc93bb4709c9c0af1d96949787e539b02c130aa744cf4c03d09600668faccc6da656faa324eb5422f5deb71dc5d97f71a5de143cfab6
7
- data.tar.gz: c111b2335a6e5b938d3ca0844f4185d2c1637c9b36856ee49e42bb2d6131521e758ecaf2ffac6e91232f692cb540e21a86579f4c57fbc5d161d4623ee5621238
6
+ metadata.gz: 4a22483996355e355ca0efe55b88d83a66f704936920a64287c05e175a9348a1039acdf6652f3811a380a31c6aceda9be648768b25e9e807035e3e051b1699ba
7
+ data.tar.gz: 4ba24e78d4f838a817c96a8bd8b3681809d50a2a886dab6b078090423239421794917b79de0eb17e8bfe91b735ac4bfa42a3e66633bef5dfeebb760d98c02cc0
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ 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
+ ## [14.2.0] - 2022-08-25
9
+ ### Changed
10
+
11
+ - using new separate configurations for Hubspot::Client
12
+
8
13
  ## [14.1.0] - 2022-08-23
9
14
  ### Changed
10
15
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubspot-api-client (14.1.0)
4
+ hubspot-api-client (14.2.0)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  require_all (~> 3.0.0)
7
7
  typhoeus (~> 1.4.0)
@@ -10,8 +10,8 @@ GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  ZenTest (4.12.1)
13
- addressable (2.8.0)
14
- public_suffix (>= 2.0.2, < 5.0)
13
+ addressable (2.8.1)
14
+ public_suffix (>= 2.0.2, < 6.0)
15
15
  autotest (4.4.6)
16
16
  ZenTest (>= 4.4.1)
17
17
  autotest-growl (0.2.16)
@@ -29,7 +29,7 @@ GEM
29
29
  pry (0.14.1)
30
30
  coderay (~> 1.1)
31
31
  method_source (~> 1.0)
32
- public_suffix (4.0.7)
32
+ public_suffix (5.0.0)
33
33
  rake (12.3.3)
34
34
  rake-release (1.3.0)
35
35
  bundler (>= 1.11, < 3)
@@ -51,7 +51,7 @@ GEM
51
51
  typhoeus (1.4.0)
52
52
  ethon (>= 0.9.0)
53
53
  vcr (3.0.3)
54
- webmock (3.17.1)
54
+ webmock (3.18.1)
55
55
  addressable (>= 2.8.0)
56
56
  crack (>= 0.3.2)
57
57
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -2,8 +2,6 @@ require_rel 'discovery'
2
2
 
3
3
  module Hubspot
4
4
  class Client
5
- attr_reader :api_key, :access_token
6
-
7
5
  def self.api_modules
8
6
  %i[
9
7
  automation
@@ -28,25 +26,9 @@ module Hubspot
28
26
  'Hubspot::Discovery'
29
27
  end
30
28
 
31
- def configure_api_key
32
- Hubspot.configure do |config|
33
- config.api_key['hapikey'] = api_key
34
- end
35
- end
36
-
37
- def configure_access_token
38
- Hubspot.configure do |config|
39
- config.access_token = access_token
40
- end
41
- end
42
-
43
29
  def initialize(params)
44
30
  raise 'Please, pass :api_key or :access_token' if params[:api_key].nil? && params[:developer_api_key].nil? && params[:access_token].nil?
45
- @api_key = params[:api_key] || params[:developer_api_key]
46
- @access_token = params[:access_token]
47
31
  @params = params
48
- configure_api_key if @api_key
49
- configure_access_token if @access_token
50
32
  end
51
33
  end
52
34
  end
@@ -12,12 +12,16 @@ module Hubspot
12
12
  api.methods.grep(/with_http_info/).map {|elem| elem.to_s.gsub('_with_http_info', '').to_sym }
13
13
  end
14
14
 
15
+ def config
16
+ @config ||= new_config
17
+ end
18
+
15
19
  def api_client
16
- api&.api_client
20
+ @api_client ||= Kernel.const_get("#{self.class.name.gsub('Discovery::', '').gsub(/(.*)::.*/, '\1')}::ApiClient").new(config)
17
21
  end
18
22
 
19
23
  def api
20
- @api ||= Kernel.const_get(codegen_api_class).new
24
+ @api ||= Kernel.const_get(codegen_api_class).new(api_client)
21
25
  end
22
26
 
23
27
  def get_all(params = {})
@@ -26,6 +30,14 @@ module Hubspot
26
30
 
27
31
  private
28
32
 
33
+ def new_config
34
+ config = Kernel.const_get("#{self.class.name.gsub('Discovery::', '').gsub(/(.*)::.*/, '\1')}::Configuration").new
35
+ config.access_token = base_params[:access_token] if base_params[:access_token]
36
+ config.api_key['hapikey'] = base_params[:api_key] if base_params[:api_key]
37
+ config.api_key['hapikey'] = base_params[:developer_api_key] if base_params[:developer_api_key]
38
+ config
39
+ end
40
+
29
41
  def codegen_api_class
30
42
  self.class.name.gsub('Discovery::', '')
31
43
  end
@@ -1,3 +1,3 @@
1
1
  module Hubspot
2
- VERSION = '14.1.0'
2
+ VERSION = '14.2.0'
3
3
  end
@@ -6,6 +6,9 @@ describe 'Hubspot::Discovery::BaseApiClient' do
6
6
  end
7
7
 
8
8
  class Hubspot::SomeApiClass
9
+ def initialize(api_client)
10
+ end
11
+
9
12
  def get(test_id, opts = {})
10
13
  "got test_id: #{test_id}, opts: #{opts}"
11
14
  end
@@ -21,6 +24,11 @@ describe 'Hubspot::Discovery::BaseApiClient' do
21
24
  end
22
25
  end
23
26
 
27
+ class Hubspot::ApiClient
28
+ def initialize(config)
29
+ end
30
+ end
31
+
24
32
  subject(:client) { Hubspot::Discovery::SomeApiClass.new(access_token: 'test') }
25
33
  let(:api) { client.api }
26
34
 
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: 14.1.0
4
+ version: 14.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HubSpot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus