Class: Gusto::Payroll::EarningTypesClient
- Inherits:
-
Object
- Object
- Gusto::Payroll::EarningTypesClient
- Defined in:
- lib/fern_gusto/payroll/earning_types/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(company_id:, name:, request_options: nil) ⇒ Object
api.payroll.earning_types.create(company_id: “company_id”, name: “Gym Membership Stipend”).
-
#delete(company_id:, earning_type_uuid:, request_options: nil) ⇒ Object
api.payroll.earning_types.delete(company_id: “company_id”, earning_type_uuid: “earning_type_uuid”).
-
#get(company_id:, request_options: nil) ⇒ Object
api.payroll.earning_types.get(company_id: “company_id”).
- #initialize(request_client:) ⇒ Gusto::Payroll::EarningTypesClient constructor
-
#update(company_id:, earning_type_uuid:, name: nil, request_options: nil) ⇒ Object
).
Constructor Details
#initialize(request_client:) ⇒ Gusto::Payroll::EarningTypesClient
20 21 22 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 20 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::RequestClient (readonly)
15 16 17 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 15 def request_client @request_client end |
Instance Method Details
#create(company_id:, name:, request_options: nil) ⇒ Object
api.payroll.earning_types.create(company_id: “company_id”, name: “Gym Membership Stipend”)
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 82 def create(company_id:, name:, request_options: nil) 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 || {}), name: name }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_id}/earning_types" end Gusto::EarningTypes::EarningType.from_json(json_object: response.body) end |
#delete(company_id:, earning_type_uuid:, request_options: nil) ⇒ Object
api.payroll.earning_types.delete(company_id: “company_id”, earning_type_uuid: “earning_type_uuid”)
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 155 def delete(company_id:, earning_type_uuid:, request_options: nil) response = @request_client.conn.delete 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_id}/earning_types/#{earning_type_uuid}" end end |
#get(company_id:, request_options: nil) ⇒ Object
api.payroll.earning_types.get(company_id: “company_id”)
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 44 def get(company_id:, request_options: nil) 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_id}/earning_types" end Gusto::Payroll::EarningTypes::EarningTypesGetResponse.from_json(json_object: response.body) end |
#update(company_id:, earning_type_uuid:, name: nil, request_options: nil) ⇒ Object
)
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/fern_gusto/payroll/earning_types/client.rb', line 121 def update(company_id:, earning_type_uuid:, name: nil, request_options: nil) response = @request_client.conn.put 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 || {}), name: name }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_id}/earning_types/#{earning_type_uuid}" end Gusto::EarningTypes::EarningType.from_json(json_object: response.body) end |