finch-api 0.1.0.pre.alpha.16 → 0.1.0.pre.alpha.18
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 +4 -4
- data/CHANGELOG.md +43 -0
- data/README.md +92 -53
- data/lib/finch_api/client.rb +4 -4
- data/lib/finch_api/errors.rb +1 -1
- data/lib/finch_api/internal/transport/base_client.rb +77 -5
- data/lib/finch_api/internal/transport/pooled_net_requester.rb +17 -1
- data/lib/finch_api/internal/type/array_of.rb +1 -1
- data/lib/finch_api/internal/type/base_model.rb +70 -30
- data/lib/finch_api/internal/type/converter.rb +18 -0
- data/lib/finch_api/internal/type/enum.rb +1 -0
- data/lib/finch_api/internal/type/hash_of.rb +1 -1
- data/lib/finch_api/internal/type/union.rb +1 -0
- data/lib/finch_api/internal/util.rb +56 -0
- data/lib/finch_api/internal.rb +6 -0
- data/lib/finch_api/models/hris/document_retreive_response.rb +4 -0
- data/lib/finch_api/models/hris/employment_data.rb +19 -9
- data/lib/finch_api/models/hris/individual.rb +6 -0
- data/lib/finch_api/models/hris/pay_statement.rb +1 -0
- data/lib/finch_api/models/sandbox/payment_create_params.rb +1 -0
- data/lib/finch_api/models/webhook_event.rb +15 -0
- data/lib/finch_api/models.rb +27 -0
- data/lib/finch_api/request_options.rb +4 -0
- data/lib/finch_api/version.rb +1 -1
- data/lib/finch_api.rb +2 -0
- data/rbi/finch_api/internal/transport/base_client.rbi +31 -16
- data/rbi/finch_api/internal/transport/pooled_net_requester.rbi +10 -5
- data/rbi/finch_api/internal/type/base_model.rbi +33 -15
- data/rbi/finch_api/internal/type/base_page.rbi +1 -2
- data/rbi/finch_api/internal/type/converter.rbi +2 -0
- data/rbi/finch_api/internal/type/enum.rbi +1 -0
- data/rbi/finch_api/internal/type/union.rbi +1 -0
- data/rbi/finch_api/internal/util.rbi +28 -5
- data/rbi/finch_api/internal.rbi +2 -0
- data/rbi/finch_api/models/access_token_create_params.rbi +4 -1
- data/rbi/finch_api/models/account_disconnect_params.rbi +4 -1
- data/rbi/finch_api/models/account_introspect_params.rbi +4 -1
- data/rbi/finch_api/models/account_update_event.rbi +156 -34
- data/rbi/finch_api/models/base_webhook_event.rbi +4 -1
- data/rbi/finch_api/models/company_event.rbi +4 -1
- data/rbi/finch_api/models/connect/session_new_params.rbi +12 -2
- data/rbi/finch_api/models/connect/session_new_response.rbi +6 -1
- data/rbi/finch_api/models/connect/session_reauthenticate_params.rbi +6 -1
- data/rbi/finch_api/models/connect/session_reauthenticate_response.rbi +6 -1
- data/rbi/finch_api/models/create_access_token_response.rbi +7 -1
- data/rbi/finch_api/models/directory_event.rbi +7 -2
- data/rbi/finch_api/models/disconnect_response.rbi +4 -1
- data/rbi/finch_api/models/employment_event.rbi +7 -2
- data/rbi/finch_api/models/hris/benefit_contribution.rbi +6 -1
- data/rbi/finch_api/models/hris/benefit_create_params.rbi +18 -3
- data/rbi/finch_api/models/hris/benefit_features_and_operations.rbi +12 -2
- data/rbi/finch_api/models/hris/benefit_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefit_list_supported_benefits_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefit_list_supported_benefits_response.rbi +6 -1
- data/rbi/finch_api/models/hris/benefit_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefit_update_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/enrolled_individual_benefit_response.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/individual_benefit.rbi +12 -2
- data/rbi/finch_api/models/hris/benefits/individual_enroll_many_params.rbi +26 -5
- data/rbi/finch_api/models/hris/benefits/individual_enrolled_ids_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/individual_enrolled_ids_response.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/individual_retrieve_many_benefits_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/individual_unenroll_many_params.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits/unenrolled_individual_benefit_response.rbi +6 -1
- data/rbi/finch_api/models/hris/benefits_support.rbi +3 -1
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_create_params.rbi +18 -3
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_create_response.rbi +18 -3
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_delete_params.rbi +6 -1
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_delete_response.rbi +18 -3
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_list_response.rbi +18 -3
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_update_params.rbi +6 -1
- data/rbi/finch_api/models/hris/company/pay_statement_item/rule_update_response.rbi +18 -3
- data/rbi/finch_api/models/hris/company/pay_statement_item_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/company/pay_statement_item_list_response.rbi +12 -2
- data/rbi/finch_api/models/hris/company.rbi +27 -5
- data/rbi/finch_api/models/hris/company_benefit.rbi +15 -3
- data/rbi/finch_api/models/hris/company_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/hris/create_company_benefits_response.rbi +6 -1
- data/rbi/finch_api/models/hris/directory_list_individuals_params.rbi +6 -1
- data/rbi/finch_api/models/hris/directory_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/document_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/document_list_response.rbi +6 -1
- data/rbi/finch_api/models/hris/document_response.rbi +3 -1
- data/rbi/finch_api/models/hris/document_retreive_params.rbi +6 -1
- data/rbi/finch_api/models/hris/employment_data.rbi +48 -17
- data/rbi/finch_api/models/hris/employment_data_response.rbi +6 -1
- data/rbi/finch_api/models/hris/employment_retrieve_many_params.rbi +12 -2
- data/rbi/finch_api/models/hris/individual.rbi +24 -4
- data/rbi/finch_api/models/hris/individual_in_directory.rbi +18 -3
- data/rbi/finch_api/models/hris/individual_response.rbi +6 -1
- data/rbi/finch_api/models/hris/individual_retrieve_many_params.rbi +18 -3
- data/rbi/finch_api/models/hris/pay_statement.rbi +80 -13
- data/rbi/finch_api/models/hris/pay_statement_response.rbi +6 -1
- data/rbi/finch_api/models/hris/pay_statement_response_body.rbi +6 -1
- data/rbi/finch_api/models/hris/pay_statement_retrieve_many_params.rbi +12 -2
- data/rbi/finch_api/models/hris/payment.rbi +9 -2
- data/rbi/finch_api/models/hris/payment_list_params.rbi +6 -1
- data/rbi/finch_api/models/hris/support_per_benefit_type.rbi +6 -1
- data/rbi/finch_api/models/hris/supported_benefit.rbi +3 -1
- data/rbi/finch_api/models/hris/update_company_benefit_response.rbi +6 -1
- data/rbi/finch_api/models/hris/w42005.rbi +6 -2
- data/rbi/finch_api/models/hris/w42020.rbi +6 -2
- data/rbi/finch_api/models/income.rbi +2 -1
- data/rbi/finch_api/models/individual_event.rbi +7 -2
- data/rbi/finch_api/models/introspection.rbi +22 -4
- data/rbi/finch_api/models/job_completion_event.rbi +10 -2
- data/rbi/finch_api/models/jobs/automated_async_job.rbi +12 -2
- data/rbi/finch_api/models/jobs/automated_create_params.rbi +12 -2
- data/rbi/finch_api/models/jobs/automated_create_response.rbi +6 -1
- data/rbi/finch_api/models/jobs/automated_list_params.rbi +6 -1
- data/rbi/finch_api/models/jobs/automated_list_response.rbi +24 -4
- data/rbi/finch_api/models/jobs/automated_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/jobs/manual_async_job.rbi +3 -1
- data/rbi/finch_api/models/jobs/manual_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/location.rbi +2 -1
- data/rbi/finch_api/models/money.rbi +2 -1
- data/rbi/finch_api/models/operation_support_matrix.rbi +4 -1
- data/rbi/finch_api/models/paging.rbi +2 -1
- data/rbi/finch_api/models/pay_statement_event.rbi +10 -2
- data/rbi/finch_api/models/payment_event.rbi +7 -2
- data/rbi/finch_api/models/payroll/pay_group_list_params.rbi +6 -1
- data/rbi/finch_api/models/payroll/pay_group_list_response.rbi +6 -1
- data/rbi/finch_api/models/payroll/pay_group_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/payroll/pay_group_retrieve_response.rbi +6 -1
- data/rbi/finch_api/models/provider.rbi +182 -33
- data/rbi/finch_api/models/provider_list_params.rbi +4 -1
- data/rbi/finch_api/models/request_forwarding_forward_params.rbi +7 -1
- data/rbi/finch_api/models/request_forwarding_forward_response.rbi +13 -2
- data/rbi/finch_api/models/sandbox/company_update_params.rbi +30 -5
- data/rbi/finch_api/models/sandbox/company_update_response.rbi +30 -5
- data/rbi/finch_api/models/sandbox/connection_create_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/connection_create_response.rbi +6 -1
- data/rbi/finch_api/models/sandbox/connections/account_create_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/connections/account_create_response.rbi +6 -1
- data/rbi/finch_api/models/sandbox/connections/account_update_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/connections/account_update_response.rbi +6 -1
- data/rbi/finch_api/models/sandbox/directory_create_params.rbi +48 -8
- data/rbi/finch_api/models/sandbox/employment_update_params.rbi +30 -5
- data/rbi/finch_api/models/sandbox/employment_update_response.rbi +30 -5
- data/rbi/finch_api/models/sandbox/individual_update_params.rbi +18 -3
- data/rbi/finch_api/models/sandbox/individual_update_response.rbi +18 -3
- data/rbi/finch_api/models/sandbox/job_create_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/job_create_response.rbi +6 -1
- data/rbi/finch_api/models/sandbox/jobs/configuration_retrieve_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/jobs/configuration_update_params.rbi +6 -1
- data/rbi/finch_api/models/sandbox/jobs/sandbox_job_configuration.rbi +6 -1
- data/rbi/finch_api/models/sandbox/payment_create_params.rbi +81 -14
- data/rbi/finch_api/models/sandbox/payment_create_response.rbi +6 -1
- data/rbi/finch_api/request_options.rbi +4 -1
- data/sig/finch_api/internal/single_page.rbs +1 -1
- data/sig/finch_api/internal/transport/base_client.rbs +16 -1
- data/sig/finch_api/internal/transport/pooled_net_requester.rbs +4 -0
- data/sig/finch_api/internal/type/base_model.rbs +11 -5
- data/sig/finch_api/internal/type/base_page.rbs +1 -1
- data/sig/finch_api/internal/type/converter.rbs +2 -0
- data/sig/finch_api/internal/type/enum.rbs +1 -0
- data/sig/finch_api/internal/type/union.rbs +1 -0
- data/sig/finch_api/internal/util.rbs +13 -0
- data/sig/finch_api/internal.rbs +2 -0
- data/sig/finch_api/models/hris/employment_data.rbs +6 -6
- data/sig/finch_api/models/hris/pay_statement.rbs +2 -1
- data/sig/finch_api/models/sandbox/payment_create_params.rbs +2 -1
- metadata +2 -2
@@ -5,6 +5,8 @@ module FinchAPI
|
|
5
5
|
module Type
|
6
6
|
# @api private
|
7
7
|
module Converter
|
8
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
9
|
+
|
8
10
|
# rubocop:disable Lint/UnusedMethodArgument
|
9
11
|
|
10
12
|
# @api private
|
@@ -268,6 +270,22 @@ module FinchAPI
|
|
268
270
|
end
|
269
271
|
end
|
270
272
|
end
|
273
|
+
|
274
|
+
define_sorbet_constant!(:Input) do
|
275
|
+
T.type_alias { T.any(FinchAPI::Internal::Type::Converter, T::Class[T.anything]) }
|
276
|
+
end
|
277
|
+
define_sorbet_constant!(:CoerceState) do
|
278
|
+
T.type_alias do
|
279
|
+
{
|
280
|
+
strictness: T.any(T::Boolean, Symbol),
|
281
|
+
exactness: {yes: Integer, no: Integer, maybe: Integer},
|
282
|
+
branched: Integer
|
283
|
+
}
|
284
|
+
end
|
285
|
+
end
|
286
|
+
define_sorbet_constant!(:DumpState) do
|
287
|
+
T.type_alias { {can_retry: T::Boolean} }
|
288
|
+
end
|
271
289
|
end
|
272
290
|
end
|
273
291
|
end
|
@@ -801,6 +801,62 @@ module FinchAPI
|
|
801
801
|
end
|
802
802
|
end
|
803
803
|
end
|
804
|
+
|
805
|
+
# @api private
|
806
|
+
module SorbetRuntimeSupport
|
807
|
+
class MissingSorbetRuntimeError < ::RuntimeError
|
808
|
+
end
|
809
|
+
|
810
|
+
# @api private
|
811
|
+
#
|
812
|
+
# @return [Hash{Symbol=>Object}]
|
813
|
+
private def sorbet_runtime_constants = @sorbet_runtime_constants ||= {}
|
814
|
+
|
815
|
+
# @api private
|
816
|
+
#
|
817
|
+
# @param name [Symbol]
|
818
|
+
def const_missing(name)
|
819
|
+
super unless sorbet_runtime_constants.key?(name)
|
820
|
+
|
821
|
+
unless Object.const_defined?(:T)
|
822
|
+
message = "Trying to access a Sorbet constant #{name.inspect} without `sorbet-runtime`."
|
823
|
+
raise MissingSorbetRuntimeError.new(message)
|
824
|
+
end
|
825
|
+
|
826
|
+
sorbet_runtime_constants.fetch(name).call
|
827
|
+
end
|
828
|
+
|
829
|
+
# @api private
|
830
|
+
#
|
831
|
+
# @param name [Symbol]
|
832
|
+
# @param blk [Proc]
|
833
|
+
def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk)
|
834
|
+
end
|
835
|
+
|
836
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
837
|
+
|
838
|
+
define_sorbet_constant!(:ParsedUri) do
|
839
|
+
T.type_alias do
|
840
|
+
{
|
841
|
+
scheme: T.nilable(String),
|
842
|
+
host: T.nilable(String),
|
843
|
+
port: T.nilable(Integer),
|
844
|
+
path: T.nilable(String),
|
845
|
+
query: T::Hash[String, T::Array[String]]
|
846
|
+
}
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
define_sorbet_constant!(:ServerSentEvent) do
|
851
|
+
T.type_alias do
|
852
|
+
{
|
853
|
+
event: T.nilable(String),
|
854
|
+
data: T.nilable(String),
|
855
|
+
id: T.nilable(String),
|
856
|
+
retry: T.nilable(Integer)
|
857
|
+
}
|
858
|
+
end
|
859
|
+
end
|
804
860
|
end
|
805
861
|
end
|
806
862
|
end
|
data/lib/finch_api/internal.rb
CHANGED
@@ -2,10 +2,16 @@
|
|
2
2
|
|
3
3
|
module FinchAPI
|
4
4
|
module Internal
|
5
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
6
|
+
|
5
7
|
OMIT =
|
6
8
|
Object.new.tap do
|
7
9
|
_1.define_singleton_method(:inspect) { "#<#{FinchAPI::Internal}::OMIT>" }
|
8
10
|
end
|
9
11
|
.freeze
|
12
|
+
|
13
|
+
define_sorbet_constant!(:AnyHash) do
|
14
|
+
T.type_alias { T::Hash[Symbol, T.anything] }
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
@@ -20,6 +20,10 @@ module FinchAPI
|
|
20
20
|
|
21
21
|
# @!method self.variants
|
22
22
|
# @return [Array(FinchAPI::HRIS::W42020, FinchAPI::HRIS::W42005)]
|
23
|
+
|
24
|
+
define_sorbet_constant!(:Variants) do
|
25
|
+
T.type_alias { T.any(FinchAPI::HRIS::W42020, FinchAPI::HRIS::W42005) }
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -100,12 +100,6 @@ module FinchAPI
|
|
100
100
|
# @return [String, nil]
|
101
101
|
required :middle_name, String, nil?: true
|
102
102
|
|
103
|
-
# @!attribute source_id
|
104
|
-
# The source system's unique employment identifier for this individual
|
105
|
-
#
|
106
|
-
# @return [String, nil]
|
107
|
-
required :source_id, String, nil?: true
|
108
|
-
|
109
103
|
# @!attribute start_date
|
110
104
|
#
|
111
105
|
# @return [String, nil]
|
@@ -141,7 +135,13 @@ module FinchAPI
|
|
141
135
|
-> { FinchAPI::Internal::Type::ArrayOf[FinchAPI::Income, nil?: true] },
|
142
136
|
nil?: true
|
143
137
|
|
144
|
-
# @!
|
138
|
+
# @!attribute source_id
|
139
|
+
# The source system's unique employment identifier for this individual
|
140
|
+
#
|
141
|
+
# @return [String, nil]
|
142
|
+
optional :source_id, String, nil?: true
|
143
|
+
|
144
|
+
# @!method initialize(id:, class_code:, custom_fields:, department:, employment:, employment_status:, end_date:, first_name:, is_active:, last_name:, latest_rehire_date:, location:, manager:, middle_name:, start_date:, title:, work_id:, income: nil, income_history: nil, source_id: nil)
|
145
145
|
# Some parameter documentations has been truncated, see
|
146
146
|
# {FinchAPI::HRIS::EmploymentData::UnionMember0} for more details.
|
147
147
|
#
|
@@ -173,8 +173,6 @@ module FinchAPI
|
|
173
173
|
#
|
174
174
|
# @param middle_name [String, nil] The legal middle name of the individual.
|
175
175
|
#
|
176
|
-
# @param source_id [String, nil] The source system's unique employment identifier for this individual
|
177
|
-
#
|
178
176
|
# @param start_date [String, nil]
|
179
177
|
#
|
180
178
|
# @param title [String, nil] The current title of the individual.
|
@@ -184,6 +182,8 @@ module FinchAPI
|
|
184
182
|
# @param income [FinchAPI::Income, nil] The employee's income as reported by the provider. This may not always be annual
|
185
183
|
#
|
186
184
|
# @param income_history [Array<FinchAPI::Income, nil>, nil] The array of income history.
|
185
|
+
#
|
186
|
+
# @param source_id [String, nil] The source system's unique employment identifier for this individual
|
187
187
|
|
188
188
|
class CustomField < FinchAPI::Internal::Type::BaseModel
|
189
189
|
# @!attribute name
|
@@ -221,6 +221,10 @@ module FinchAPI
|
|
221
221
|
# @!method self.variants
|
222
222
|
# @return [Array(String, Array<Object>, Object, Float, Boolean)]
|
223
223
|
|
224
|
+
define_sorbet_constant!(:Variants) do
|
225
|
+
T.type_alias { T.any(String, T::Array[T.anything], T.anything, Float, T::Boolean) }
|
226
|
+
end
|
227
|
+
|
224
228
|
# @type [FinchAPI::Internal::Type::Converter]
|
225
229
|
UnionMember1Array = FinchAPI::Internal::Type::ArrayOf[FinchAPI::Internal::Type::Unknown]
|
226
230
|
end
|
@@ -367,6 +371,12 @@ module FinchAPI
|
|
367
371
|
|
368
372
|
# @!method self.variants
|
369
373
|
# @return [Array(FinchAPI::HRIS::EmploymentData::UnionMember0, FinchAPI::HRIS::EmploymentData::BatchError)]
|
374
|
+
|
375
|
+
define_sorbet_constant!(:Variants) do
|
376
|
+
T.type_alias do
|
377
|
+
T.any(FinchAPI::HRIS::EmploymentData::UnionMember0, FinchAPI::HRIS::EmploymentData::BatchError)
|
378
|
+
end
|
379
|
+
end
|
370
380
|
end
|
371
381
|
end
|
372
382
|
end
|
@@ -250,6 +250,12 @@ module FinchAPI
|
|
250
250
|
|
251
251
|
# @!method self.variants
|
252
252
|
# @return [Array(FinchAPI::HRIS::Individual::UnionMember0, FinchAPI::HRIS::Individual::BatchError)]
|
253
|
+
|
254
|
+
define_sorbet_constant!(:Variants) do
|
255
|
+
T.type_alias do
|
256
|
+
T.any(FinchAPI::HRIS::Individual::UnionMember0, FinchAPI::HRIS::Individual::BatchError)
|
257
|
+
end
|
258
|
+
end
|
253
259
|
end
|
254
260
|
end
|
255
261
|
end
|
@@ -25,6 +25,21 @@ module FinchAPI
|
|
25
25
|
|
26
26
|
# @!method self.variants
|
27
27
|
# @return [Array(FinchAPI::AccountUpdateEvent, FinchAPI::CompanyEvent, FinchAPI::JobCompletionEvent, FinchAPI::DirectoryEvent, FinchAPI::EmploymentEvent, FinchAPI::IndividualEvent, FinchAPI::PaymentEvent, FinchAPI::PayStatementEvent)]
|
28
|
+
|
29
|
+
define_sorbet_constant!(:Variants) do
|
30
|
+
T.type_alias do
|
31
|
+
T.any(
|
32
|
+
FinchAPI::AccountUpdateEvent,
|
33
|
+
FinchAPI::CompanyEvent,
|
34
|
+
FinchAPI::JobCompletionEvent,
|
35
|
+
FinchAPI::DirectoryEvent,
|
36
|
+
FinchAPI::EmploymentEvent,
|
37
|
+
FinchAPI::IndividualEvent,
|
38
|
+
FinchAPI::PaymentEvent,
|
39
|
+
FinchAPI::PayStatementEvent
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
28
43
|
end
|
29
44
|
end
|
30
45
|
end
|
data/lib/finch_api/models.rb
CHANGED
@@ -1,6 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module FinchAPI
|
4
|
+
[FinchAPI::Internal::Type::BaseModel, *FinchAPI::Internal::Type::BaseModel.subclasses].each do |cls|
|
5
|
+
cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, FinchAPI::Internal::AnyHash) } }
|
6
|
+
end
|
7
|
+
|
8
|
+
[
|
9
|
+
*FinchAPI::Internal::Type::Enum.included_modules,
|
10
|
+
*FinchAPI::Internal::Type::Union.included_modules
|
11
|
+
].each do |cls|
|
12
|
+
cls.constants.each do |name|
|
13
|
+
case cls.const_get(name)
|
14
|
+
in true | false
|
15
|
+
cls.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, cls) } }
|
16
|
+
cls.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
17
|
+
in Integer
|
18
|
+
cls.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, cls) } }
|
19
|
+
cls.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
20
|
+
in Float
|
21
|
+
cls.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, cls) } }
|
22
|
+
cls.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
23
|
+
in Symbol
|
24
|
+
cls.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, cls) } }
|
25
|
+
cls.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
26
|
+
else
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
4
31
|
AccessTokenCreateParams = FinchAPI::Models::AccessTokenCreateParams
|
5
32
|
|
6
33
|
AccountDisconnectParams = FinchAPI::Models::AccountDisconnectParams
|
data/lib/finch_api/version.rb
CHANGED
data/lib/finch_api.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Standard libraries.
|
4
|
+
# rubocop:disable Lint/RedundantRequireStatement
|
4
5
|
require "English"
|
5
6
|
require "cgi"
|
6
7
|
require "date"
|
@@ -15,6 +16,7 @@ require "set"
|
|
15
16
|
require "stringio"
|
16
17
|
require "time"
|
17
18
|
require "uri"
|
19
|
+
# rubocop:enable Lint/RedundantRequireStatement
|
18
20
|
|
19
21
|
# We already ship the preferred sorbet manifests in the package itself.
|
20
22
|
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
@@ -5,9 +5,11 @@ module FinchAPI
|
|
5
5
|
module Transport
|
6
6
|
# @api private
|
7
7
|
class BaseClient
|
8
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
9
|
+
|
8
10
|
abstract!
|
9
11
|
|
10
|
-
|
12
|
+
RequestComponents =
|
11
13
|
T.type_alias do
|
12
14
|
{
|
13
15
|
method: Symbol,
|
@@ -53,7 +55,7 @@ module FinchAPI
|
|
53
55
|
}
|
54
56
|
end
|
55
57
|
|
56
|
-
|
58
|
+
RequestInput =
|
57
59
|
T.type_alias do
|
58
60
|
{
|
59
61
|
method: Symbol,
|
@@ -74,8 +76,7 @@ module FinchAPI
|
|
74
76
|
# @api private
|
75
77
|
sig do
|
76
78
|
params(
|
77
|
-
req:
|
78
|
-
FinchAPI::Internal::Transport::BaseClient::RequestComponentsShape
|
79
|
+
req: FinchAPI::Internal::Transport::BaseClient::RequestComponents
|
79
80
|
).void
|
80
81
|
end
|
81
82
|
def validate!(req)
|
@@ -94,13 +95,10 @@ module FinchAPI
|
|
94
95
|
# @api private
|
95
96
|
sig do
|
96
97
|
params(
|
97
|
-
request:
|
98
|
-
FinchAPI::Internal::Transport::BaseClient::RequestInputShape,
|
98
|
+
request: FinchAPI::Internal::Transport::BaseClient::RequestInput,
|
99
99
|
status: Integer,
|
100
100
|
response_headers: T.any(T::Hash[String, String], Net::HTTPHeader)
|
101
|
-
).returns(
|
102
|
-
FinchAPI::Internal::Transport::BaseClient::RequestInputShape
|
103
|
-
)
|
101
|
+
).returns(FinchAPI::Internal::Transport::BaseClient::RequestInput)
|
104
102
|
end
|
105
103
|
def follow_redirect(request, status:, response_headers:)
|
106
104
|
end
|
@@ -116,6 +114,27 @@ module FinchAPI
|
|
116
114
|
end
|
117
115
|
end
|
118
116
|
|
117
|
+
sig { returns(URI::Generic) }
|
118
|
+
attr_reader :base_url
|
119
|
+
|
120
|
+
sig { returns(Float) }
|
121
|
+
attr_reader :timeout
|
122
|
+
|
123
|
+
sig { returns(Integer) }
|
124
|
+
attr_reader :max_retries
|
125
|
+
|
126
|
+
sig { returns(Float) }
|
127
|
+
attr_reader :initial_retry_delay
|
128
|
+
|
129
|
+
sig { returns(Float) }
|
130
|
+
attr_reader :max_retry_delay
|
131
|
+
|
132
|
+
sig { returns(T::Hash[String, String]) }
|
133
|
+
attr_reader :headers
|
134
|
+
|
135
|
+
sig { returns(T.nilable(String)) }
|
136
|
+
attr_reader :idempotency_header
|
137
|
+
|
119
138
|
# @api private
|
120
139
|
sig { returns(FinchAPI::Internal::Transport::PooledNetRequester) }
|
121
140
|
attr_reader :requester
|
@@ -167,13 +186,10 @@ module FinchAPI
|
|
167
186
|
sig do
|
168
187
|
overridable
|
169
188
|
.params(
|
170
|
-
req:
|
171
|
-
FinchAPI::Internal::Transport::BaseClient::RequestComponentsShape,
|
189
|
+
req: FinchAPI::Internal::Transport::BaseClient::RequestComponents,
|
172
190
|
opts: FinchAPI::Internal::AnyHash
|
173
191
|
)
|
174
|
-
.returns(
|
175
|
-
FinchAPI::Internal::Transport::BaseClient::RequestInputShape
|
176
|
-
)
|
192
|
+
.returns(FinchAPI::Internal::Transport::BaseClient::RequestInput)
|
177
193
|
end
|
178
194
|
private def build_request(req, opts)
|
179
195
|
end
|
@@ -191,8 +207,7 @@ module FinchAPI
|
|
191
207
|
# @api private
|
192
208
|
sig do
|
193
209
|
params(
|
194
|
-
request:
|
195
|
-
FinchAPI::Internal::Transport::BaseClient::RequestInputShape,
|
210
|
+
request: FinchAPI::Internal::Transport::BaseClient::RequestInput,
|
196
211
|
redirect_count: Integer,
|
197
212
|
retry_count: Integer,
|
198
213
|
send_retry_header: T::Boolean
|
@@ -5,7 +5,9 @@ module FinchAPI
|
|
5
5
|
module Transport
|
6
6
|
# @api private
|
7
7
|
class PooledNetRequester
|
8
|
-
|
8
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
9
|
+
|
10
|
+
Request =
|
9
11
|
T.type_alias do
|
10
12
|
{
|
11
13
|
method: Symbol,
|
@@ -20,6 +22,8 @@ module FinchAPI
|
|
20
22
|
# https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49
|
21
23
|
KEEP_ALIVE_TIMEOUT = 30
|
22
24
|
|
25
|
+
DEFAULT_MAX_CONNECTIONS = T.let(T.unsafe(nil), Integer)
|
26
|
+
|
23
27
|
class << self
|
24
28
|
# @api private
|
25
29
|
sig { params(url: URI::Generic).returns(Net::HTTP) }
|
@@ -35,7 +39,7 @@ module FinchAPI
|
|
35
39
|
sig do
|
36
40
|
params(
|
37
41
|
request:
|
38
|
-
FinchAPI::Internal::Transport::PooledNetRequester::
|
42
|
+
FinchAPI::Internal::Transport::PooledNetRequester::Request,
|
39
43
|
blk: T.proc.params(arg0: String).void
|
40
44
|
).returns([Net::HTTPGenericRequest, T.proc.void])
|
41
45
|
end
|
@@ -57,8 +61,7 @@ module FinchAPI
|
|
57
61
|
# @api private
|
58
62
|
sig do
|
59
63
|
params(
|
60
|
-
request:
|
61
|
-
FinchAPI::Internal::Transport::PooledNetRequester::RequestShape
|
64
|
+
request: FinchAPI::Internal::Transport::PooledNetRequester::Request
|
62
65
|
).returns([Integer, Net::HTTPResponse, T::Enumerable[String]])
|
63
66
|
end
|
64
67
|
def execute(request)
|
@@ -66,7 +69,9 @@ module FinchAPI
|
|
66
69
|
|
67
70
|
# @api private
|
68
71
|
sig { params(size: Integer).returns(T.attached_class) }
|
69
|
-
def self.new(
|
72
|
+
def self.new(
|
73
|
+
size: FinchAPI::Internal::Transport::PooledNetRequester::DEFAULT_MAX_CONNECTIONS
|
74
|
+
)
|
70
75
|
end
|
71
76
|
end
|
72
77
|
end
|
@@ -5,10 +5,11 @@ module FinchAPI
|
|
5
5
|
module Type
|
6
6
|
class BaseModel
|
7
7
|
extend FinchAPI::Internal::Type::Converter
|
8
|
+
extend FinchAPI::Internal::Util::SorbetRuntimeSupport
|
8
9
|
|
9
10
|
abstract!
|
10
11
|
|
11
|
-
|
12
|
+
KnownField =
|
12
13
|
T.type_alias do
|
13
14
|
{
|
14
15
|
mode: T.nilable(Symbol),
|
@@ -18,19 +19,29 @@ module FinchAPI
|
|
18
19
|
end
|
19
20
|
|
20
21
|
OrHash =
|
21
|
-
T.type_alias
|
22
|
+
T.type_alias do
|
23
|
+
T.any(
|
24
|
+
FinchAPI::Internal::Type::BaseModel,
|
25
|
+
FinchAPI::Internal::AnyHash
|
26
|
+
)
|
27
|
+
end
|
22
28
|
|
23
29
|
class << self
|
24
30
|
# @api private
|
25
31
|
#
|
26
32
|
# Assumes superclass fields are totally defined before fields are accessed /
|
27
33
|
# defined on subclasses.
|
34
|
+
sig { params(child: T.self_type).void }
|
35
|
+
def inherited(child)
|
36
|
+
end
|
37
|
+
|
38
|
+
# @api private
|
28
39
|
sig do
|
29
40
|
returns(
|
30
41
|
T::Hash[
|
31
42
|
Symbol,
|
32
43
|
T.all(
|
33
|
-
FinchAPI::Internal::Type::BaseModel::
|
44
|
+
FinchAPI::Internal::Type::BaseModel::KnownField,
|
34
45
|
{
|
35
46
|
type_fn:
|
36
47
|
T.proc.returns(FinchAPI::Internal::Type::Converter::Input)
|
@@ -48,7 +59,7 @@ module FinchAPI
|
|
48
59
|
T::Hash[
|
49
60
|
Symbol,
|
50
61
|
T.all(
|
51
|
-
FinchAPI::Internal::Type::BaseModel::
|
62
|
+
FinchAPI::Internal::Type::BaseModel::KnownField,
|
52
63
|
{ type: FinchAPI::Internal::Type::Converter::Input }
|
53
64
|
)
|
54
65
|
]
|
@@ -188,6 +199,18 @@ module FinchAPI
|
|
188
199
|
end
|
189
200
|
end
|
190
201
|
|
202
|
+
class << self
|
203
|
+
# @api private
|
204
|
+
sig do
|
205
|
+
params(
|
206
|
+
model: FinchAPI::Internal::Type::BaseModel,
|
207
|
+
convert: T::Boolean
|
208
|
+
).returns(FinchAPI::Internal::AnyHash)
|
209
|
+
end
|
210
|
+
def recursively_to_h(model, convert:)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
191
214
|
# Returns the raw value associated with the given key, if found. Otherwise, nil is
|
192
215
|
# returned.
|
193
216
|
#
|
@@ -222,6 +245,12 @@ module FinchAPI
|
|
222
245
|
def to_hash
|
223
246
|
end
|
224
247
|
|
248
|
+
# In addition to the behaviour of `#to_h`, this method will recursively call
|
249
|
+
# `#to_h` on nested models.
|
250
|
+
sig { overridable.returns(FinchAPI::Internal::AnyHash) }
|
251
|
+
def deep_to_h
|
252
|
+
end
|
253
|
+
|
225
254
|
sig do
|
226
255
|
params(keys: T.nilable(T::Array[Symbol])).returns(
|
227
256
|
FinchAPI::Internal::AnyHash
|
@@ -230,17 +259,6 @@ module FinchAPI
|
|
230
259
|
def deconstruct_keys(keys)
|
231
260
|
end
|
232
261
|
|
233
|
-
class << self
|
234
|
-
# @api private
|
235
|
-
sig do
|
236
|
-
params(model: FinchAPI::Internal::Type::BaseModel).returns(
|
237
|
-
FinchAPI::Internal::AnyHash
|
238
|
-
)
|
239
|
-
end
|
240
|
-
def walk(model)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
262
|
sig { params(a: T.anything).returns(String) }
|
245
263
|
def to_json(*a)
|
246
264
|
end
|
@@ -29,8 +29,7 @@ module FinchAPI
|
|
29
29
|
sig do
|
30
30
|
params(
|
31
31
|
client: FinchAPI::Internal::Transport::BaseClient,
|
32
|
-
req:
|
33
|
-
FinchAPI::Internal::Transport::BaseClient::RequestComponentsShape,
|
32
|
+
req: FinchAPI::Internal::Transport::BaseClient::RequestComponents,
|
34
33
|
headers: T.any(T::Hash[String, String], Net::HTTPHeader),
|
35
34
|
page_data: T.anything
|
36
35
|
).void
|