Class: GustoEmbedded::Client

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/gusto_embedded/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: nil, retry_config: nil, timeout_ms: nil, security: nil, security_source: nil, server: nil, server_url: nil, url_params: nil) ⇒ Client

Returns a new instance of Client.

Raises:

  • (StandardError)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/gusto_embedded/client.rb', line 43

def initialize(client: nil, retry_config: nil, timeout_ms: nil, security: nil, security_source: nil, server: nil, server_url: nil, url_params: nil)

  connection_options = {
    request: {
      params_encoder: Faraday::FlatParamsEncoder
    }
  }
  connection_options[:request][:timeout] = (timeout_ms.to_f / 1000) unless timeout_ms.nil?

  client ||= Faraday.new(**connection_options) do |f|
    f.request :multipart, {}
    # f.response :logger, nil, { headers: true, bodies: true, errors: true }
  end
  
  if !server_url.nil?
    if !url_params.nil?
      server_url = Utils.template_url(server_url, url_params)
    end
  end

  raise StandardError, "Invalid server \"#{server}\"" if !server.nil? && !SERVERS.key?(server)
  hooks = SDKHooks::Hooks.new
  @sdk_configuration = SDKConfiguration.new(
    client,
    hooks,
    retry_config,
    timeout_ms,
    security,
    security_source,
    server_url,
    server
  )
  @sdk_configuration = hooks.sdk_init(config: @sdk_configuration)
  init_sdks
end

Instance Attribute Details

#ach_transactionsObject

Returns the value of attribute ach_transactions.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def ach_transactions
  @ach_transactions
end

#bank_accountsObject

Returns the value of attribute bank_accounts.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def bank_accounts
  @bank_accounts
end

#companiesObject

Returns the value of attribute companies.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def companies
  @companies
end

#company_attachmentObject

Returns the value of attribute company_attachment.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def company_attachment
  @company_attachment
end

#company_attachmentsObject

Returns the value of attribute company_attachments.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def company_attachments
  @company_attachments
end

#company_benefitsObject

Returns the value of attribute company_benefits.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def company_benefits
  @company_benefits
end

#company_formsObject

Returns the value of attribute company_forms.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def company_forms
  @company_forms
end

#contractor_documentsObject

Returns the value of attribute contractor_documents.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_documents
  @contractor_documents
end

#contractor_formsObject

Returns the value of attribute contractor_forms.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_forms
  @contractor_forms
end

#contractor_payment_groupsObject

Returns the value of attribute contractor_payment_groups.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_payment_groups
  @contractor_payment_groups
end

#contractor_payment_methodObject

Returns the value of attribute contractor_payment_method.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_payment_method
  @contractor_payment_method
end

#contractor_payment_methodsObject

Returns the value of attribute contractor_payment_methods.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_payment_methods
  @contractor_payment_methods
end

#contractor_paymentsObject

Returns the value of attribute contractor_payments.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractor_payments
  @contractor_payments
end

#contractorsObject

Returns the value of attribute contractors.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def contractors
  @contractors
end

#departmentsObject

Returns the value of attribute departments.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def departments
  @departments
end

#earning_typesObject

Returns the value of attribute earning_types.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def earning_types
  @earning_types
end

#employee_addressesObject

Returns the value of attribute employee_addresses.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_addresses
  @employee_addresses
end

#employee_benefitsObject

Returns the value of attribute employee_benefits.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_benefits
  @employee_benefits
end

#employee_employmentsObject

Returns the value of attribute employee_employments.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_employments
  @employee_employments
end

#employee_formsObject

Returns the value of attribute employee_forms.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_forms
  @employee_forms
end

#employee_payment_methodObject

Returns the value of attribute employee_payment_method.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_payment_method
  @employee_payment_method
end

#employee_payment_methodsObject

Returns the value of attribute employee_payment_methods.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_payment_methods
  @employee_payment_methods
end

#employee_tax_setupObject

Returns the value of attribute employee_tax_setup.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employee_tax_setup
  @employee_tax_setup
end

#employeesObject

Returns the value of attribute employees.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def employees
  @employees
end

#eventsObject

Returns the value of attribute events.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def events
  @events
end

#external_payrollsObject

Returns the value of attribute external_payrolls.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def external_payrolls
  @external_payrolls
end

#federal_tax_detailsObject

Returns the value of attribute federal_tax_details.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def federal_tax_details
  @federal_tax_details
end

#flowsObject

Returns the value of attribute flows.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def flows
  @flows
end

#garnishmentsObject

Returns the value of attribute garnishments.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def garnishments
  @garnishments
end

#generated_documentsObject

Returns the value of attribute generated_documents.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def generated_documents
  @generated_documents
end

#historical_employeesObject

Returns the value of attribute historical_employees.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def historical_employees
  @historical_employees
end

#holiday_pay_policiesObject

Returns the value of attribute holiday_pay_policies.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def holiday_pay_policies
  @holiday_pay_policies
end

#i9_verificationObject

Returns the value of attribute i9_verification.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def i9_verification
  @i9_verification
end

#industry_selectionObject

Returns the value of attribute industry_selection.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def industry_selection
  @industry_selection
end

#information_requestsObject

Returns the value of attribute information_requests.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def information_requests
  @information_requests
end

#introspectionObject

Returns the value of attribute introspection.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def introspection
  @introspection
end

#invoicesObject

Returns the value of attribute invoices.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def invoices
  @invoices
end

#jobs_and_compensationsObject

Returns the value of attribute jobs_and_compensations.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def jobs_and_compensations
  @jobs_and_compensations
end

#locationsObject

Returns the value of attribute locations.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def locations
  @locations
end

#notificationsObject

Returns the value of attribute notifications.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def notifications
  @notifications
end

#pay_schedulesObject

Returns the value of attribute pay_schedules.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def pay_schedules
  @pay_schedules
end

#payment_configsObject

Returns the value of attribute payment_configs.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def payment_configs
  @payment_configs
end

#payroll_digestsObject

Returns the value of attribute payroll_digests.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def payroll_digests
  @payroll_digests
end

#payrollsObject

Returns the value of attribute payrolls.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def payrolls
  @payrolls
end

#people_batchesObject

Returns the value of attribute people_batches.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def people_batches
  @people_batches
end

#recovery_casesObject

Returns the value of attribute recovery_cases.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def recovery_cases
  @recovery_cases
end

#reimbursementsObject

Returns the value of attribute reimbursements.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def reimbursements
  @reimbursements
end

#reportsObject

Returns the value of attribute reports.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def reports
  @reports
end

#salary_estimatesObject

Returns the value of attribute salary_estimates.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def salary_estimates
  @salary_estimates
end

#signatoriesObject

Returns the value of attribute signatories.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def signatories
  @signatories
end

#tax_requirementsObject

Returns the value of attribute tax_requirements.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def tax_requirements
  @tax_requirements
end

#time_off_policiesObject

Returns the value of attribute time_off_policies.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def time_off_policies
  @time_off_policies
end

#time_off_requestsObject

Returns the value of attribute time_off_requests.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def time_off_requests
  @time_off_requests
end

#webhooksObject

Returns the value of attribute webhooks.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def webhooks
  @webhooks
end

#wire_in_requestsObject

Returns the value of attribute wire_in_requests.



19
20
21
# File 'lib/gusto_embedded/client.rb', line 19

def wire_in_requests
  @wire_in_requests
end

Instance Method Details

#get_url(base_url:, url_variables: nil) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/gusto_embedded/client.rb', line 139

def get_url(base_url:, url_variables: nil)
  sd_base_url, sd_options = @sdk_configuration.get_server_details

  if base_url.nil?
    base_url = sd_base_url
  end

  if url_variables.nil?
    url_variables = sd_options
  end

  return Utils.template_url base_url, url_variables
end

#init_sdksObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/gusto_embedded/client.rb', line 80

def init_sdks
  @introspection = Introspection.new(@sdk_configuration)
  @companies = Companies.new(@sdk_configuration)
  @invoices = Invoices.new(@sdk_configuration)
  @company_attachments = CompanyAttachments.new(@sdk_configuration)
  @company_attachment = CompanyAttachment.new(@sdk_configuration)
  @federal_tax_details = FederalTaxDetails.new(@sdk_configuration)
  @industry_selection = IndustrySelection.new(@sdk_configuration)
  @signatories = Signatories.new(@sdk_configuration)
  @flows = Flows.new(@sdk_configuration)
  @locations = Locations.new(@sdk_configuration)
  @bank_accounts = BankAccounts.new(@sdk_configuration)
  @external_payrolls = ExternalPayrolls.new(@sdk_configuration)
  @payment_configs = PaymentConfigs.new(@sdk_configuration)
  @pay_schedules = PaySchedules.new(@sdk_configuration)
  @employees = Employees.new(@sdk_configuration)
  @historical_employees = HistoricalEmployees.new(@sdk_configuration)
  @departments = Departments.new(@sdk_configuration)
  @employee_employments = EmployeeEmployments.new(@sdk_configuration)
  @employee_addresses = EmployeeAddresses.new(@sdk_configuration)
  @employee_tax_setup = EmployeeTaxSetup.new(@sdk_configuration)
  @employee_payment_methods = EmployeePaymentMethods.new(@sdk_configuration)
  @employee_payment_method = EmployeePaymentMethod.new(@sdk_configuration)
  @jobs_and_compensations = JobsAndCompensations.new(@sdk_configuration)
  @earning_types = EarningTypes.new(@sdk_configuration)
  @contractors = Contractors.new(@sdk_configuration)
  @contractor_payment_method = ContractorPaymentMethod.new(@sdk_configuration)
  @contractor_payment_methods = ContractorPaymentMethods.new(@sdk_configuration)
  @webhooks = Webhooks.new(@sdk_configuration)
  @contractor_forms = ContractorForms.new(@sdk_configuration)
  @contractor_documents = ContractorDocuments.new(@sdk_configuration)
  @employee_forms = EmployeeForms.new(@sdk_configuration)
  @payrolls = Payrolls.new(@sdk_configuration)
  @time_off_policies = TimeOffPolicies.new(@sdk_configuration)
  @contractor_payments = ContractorPayments.new(@sdk_configuration)
  @contractor_payment_groups = ContractorPaymentGroups.new(@sdk_configuration)
  @company_forms = CompanyForms.new(@sdk_configuration)
  @generated_documents = GeneratedDocuments.new(@sdk_configuration)
  @reports = Reports.new(@sdk_configuration)
  @company_benefits = CompanyBenefits.new(@sdk_configuration)
  @employee_benefits = EmployeeBenefits.new(@sdk_configuration)
  @garnishments = Garnishments.new(@sdk_configuration)
  @i9_verification = I9Verification.new(@sdk_configuration)
  @tax_requirements = TaxRequirements.new(@sdk_configuration)
  @holiday_pay_policies = HolidayPayPolicies.new(@sdk_configuration)
  @notifications = Notifications.new(@sdk_configuration)
  @events = Events.new(@sdk_configuration)
  @information_requests = InformationRequests.new(@sdk_configuration)
  @recovery_cases = RecoveryCases.new(@sdk_configuration)
  @ach_transactions = AchTransactions.new(@sdk_configuration)
  @wire_in_requests = WireInRequests.new(@sdk_configuration)
  @salary_estimates = SalaryEstimates.new(@sdk_configuration)
  @reimbursements = Reimbursements.new(@sdk_configuration)
  @people_batches = PeopleBatches.new(@sdk_configuration)
  @time_off_requests = TimeOffRequests.new(@sdk_configuration)
  @payroll_digests = PayrollDigests.new(@sdk_configuration)
end