lib/hubspot/discovery/base_api_client.rb in hubspot-api-client-14.1.0 vs lib/hubspot/discovery/base_api_client.rb in hubspot-api-client-14.2.0

- old
+ new

@@ -10,22 +10,34 @@ def api_methods api.methods.grep(/with_http_info/).map {|elem| elem.to_s.gsub('_with_http_info', '').to_sym } end + def config + @config ||= new_config + end + def api_client - api&.api_client + @api_client ||= Kernel.const_get("#{self.class.name.gsub('Discovery::', '').gsub(/(.*)::.*/, '\1')}::ApiClient").new(config) end def api - @api ||= Kernel.const_get(codegen_api_class).new + @api ||= Kernel.const_get(codegen_api_class).new(api_client) end def get_all(params = {}) api.get_all(params) end private + + def new_config + config = Kernel.const_get("#{self.class.name.gsub('Discovery::', '').gsub(/(.*)::.*/, '\1')}::Configuration").new + config.access_token = base_params[:access_token] if base_params[:access_token] + config.api_key['hapikey'] = base_params[:api_key] if base_params[:api_key] + config.api_key['hapikey'] = base_params[:developer_api_key] if base_params[:developer_api_key] + config + end def codegen_api_class self.class.name.gsub('Discovery::', '') end