Class: Gusto::AsyncReportsClient
- Inherits:
-
Object
- Object
- Gusto::AsyncReportsClient
- Defined in:
- lib/fern_gusto/reports/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(company_uuid:, columns:, groupings:, custom_name: nil, file_type:, with_totals: nil, start_date: nil, end_date: nil, dismissed_start_date: nil, dismissed_end_date: nil, payment_method: nil, employment_type: nil, employment_status: nil, employee_uuids: nil, department_uuids: nil, work_address_uuids: nil, request_options: nil) ⇒ Object
).
-
#get(report_uuid:, request_options: nil) ⇒ Object
api.reports.get(report_uuid: “report_uuid”).
-
#get_template(company_uuid:, report_type:, request_options: nil) ⇒ Object
api.reports.get_template(company_uuid: “company_uuid”, report_type: “report_type”).
- #initialize(request_client:) ⇒ Gusto::AsyncReportsClient constructor
Constructor Details
#initialize(request_client:) ⇒ Gusto::AsyncReportsClient
166 167 168 |
# File 'lib/fern_gusto/reports/client.rb', line 166 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::AsyncRequestClient (readonly)
161 162 163 |
# File 'lib/fern_gusto/reports/client.rb', line 161 def request_client @request_client end |
Instance Method Details
#create(company_uuid:, columns:, groupings:, custom_name: nil, file_type:, with_totals: nil, start_date: nil, end_date: nil, dismissed_start_date: nil, dismissed_end_date: nil, payment_method: nil, employment_type: nil, employment_status: nil, employee_uuids: nil, department_uuids: nil, work_address_uuids: nil, request_options: nil) ⇒ Object
)
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/fern_gusto/reports/client.rb', line 205 def create(company_uuid:, columns:, groupings:, custom_name: nil, file_type:, with_totals: nil, start_date: nil, end_date: nil, dismissed_start_date: nil, dismissed_end_date: nil, payment_method: nil, employment_type: nil, employment_status: nil, employee_uuids: nil, department_uuids: nil, work_address_uuids: nil, request_options: nil) Async do response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), columns: columns, groupings: groupings, custom_name: custom_name, file_type: file_type, with_totals: with_totals, start_date: start_date, end_date: end_date, dismissed_start_date: dismissed_start_date, dismissed_end_date: dismissed_end_date, payment_method: payment_method, employment_type: employment_type, employment_status: employment_status, employee_uuids: employee_uuids, department_uuids: department_uuids, work_address_uuids: work_address_uuids }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_uuid}/reports" end Gusto::CreateReport.from_json(json_object: response.body) end end |
#get(report_uuid:, request_options: nil) ⇒ Object
api.reports.get(report_uuid: “report_uuid”)
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/fern_gusto/reports/client.rb', line 241 def get(report_uuid:, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/reports/#{report_uuid}" end Gusto::Report.from_json(json_object: response.body) end end |
#get_template(company_uuid:, report_type:, request_options: nil) ⇒ Object
api.reports.get_template(company_uuid: “company_uuid”, report_type: “report_type”)
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/fern_gusto/reports/client.rb', line 281 def get_template(company_uuid:, report_type:, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_uuid}/report_templates/#{report_type}" end Gusto::ReportTemplate.from_json(json_object: response.body) end end |