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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +5 -5
- data/lib/hubspot/client.rb +0 -18
- data/lib/hubspot/discovery/base_api_client.rb +14 -2
- data/lib/hubspot/version.rb +1 -1
- data/spec/discovery/base_api_client_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4cf7152f7d94654ae7efaef840fc2232392091973642e5b6a877358d665c687
|
4
|
+
data.tar.gz: 7f9b630bc30d894300a8317f170583c1179684f3915f50055821e63fe892bcb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
14
|
-
public_suffix (>= 2.0.2, <
|
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 (
|
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.
|
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)
|
data/lib/hubspot/client.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/hubspot/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|