From 23389d3d89c3b44757e4089ccc5b0a1ab1943efc Mon Sep 17 00:00:00 2001 From: serknight Date: Fri, 26 Feb 2021 10:36:41 -0700 Subject: [PATCH 1/2] no Rails dependency --- lib/xero-ruby/api_client.rb | 3 ++- lib/xero-ruby/models/payroll_uk/earnings_rate.rb | 11 +++++++++-- lib/xero-ruby/version.rb | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/xero-ruby/api_client.rb b/lib/xero-ruby/api_client.rb index e74d2965..8de7045f 100644 --- a/lib/xero-ruby/api_client.rb +++ b/lib/xero-ruby/api_client.rb @@ -15,6 +15,7 @@ require 'tempfile' require 'find' require 'faraday' +require 'base64' module XeroRuby class ApiClient @@ -136,7 +137,7 @@ def token_request(data, path) req.body = URI.encode_www_form(data) end return_error(response) unless response.success? - if !response.body.blank? + if !response.body.nil? && !response.body.empty? body = JSON.parse(response.body) set_token_set(body) else diff --git a/lib/xero-ruby/models/payroll_uk/earnings_rate.rb b/lib/xero-ruby/models/payroll_uk/earnings_rate.rb index 536a0ebb..9fba8336 100644 --- a/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +++ b/lib/xero-ruby/models/payroll_uk/earnings_rate.rb @@ -33,10 +33,17 @@ class EarningsRate OVERTIME_EARNINGS = "OvertimeEarnings".freeze REGULAR_EARNINGS = "RegularEarnings".freeze STATUTORY_ADOPTION_PAY = "StatutoryAdoptionPay".freeze + STATUTORY_ADOPTION_PAY_NON_PENSIONABLE = "StatutoryAdoptionPayNonPensionable".freeze + STATUTORY_BEREAVEMENT_PAY = "StatutoryBereavementPay".freeze STATUTORY_MATERNITY_PAY = "StatutoryMaternityPay".freeze + STATUTORY_MATERNITY_PAY_NON_PENSIONABLE = "StatutoryMaternityPayNonPensionable".freeze STATUTORY_PATERNITY_PAY = "StatutoryPaternityPay".freeze + STATUTORY_PATERNITY_PAY_NON_PENSIONABLE = "StatutoryPaternityPayNonPensionable".freeze + STATUTORY_PARENTAL_BEREAVEMENT_PAY_NON_PENSIONABLE = "StatutoryParentalBereavementPayNonPensionable".freeze STATUTORY_SHARED_PARENTAL_PAY = "StatutorySharedParentalPay".freeze + STATUTORY_SHARED_PARENTAL_PAY_NON_PENSIONABLE = "StatutorySharedParentalPayNonPensionable".freeze STATUTORY_SICK_PAY = "StatutorySickPay".freeze + STATUTORY_SICK_PAY_NON_PENSIONABLE = "StatutorySickPayNonPensionable".freeze TIPS_DIRECT = "Tips(Direct)".freeze TIPS_NON_DIRECT = "Tips(Non-Direct)".freeze @@ -206,7 +213,7 @@ def list_invalid_properties def valid? return false if @name.nil? return false if @earnings_type.nil? - earnings_type_validator = EnumAttributeValidator.new('String', ["Allowance", "Backpay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryMaternityPay", "StatutoryPaternityPay", "StatutorySharedParentalPay", "StatutorySickPay", "Tips(Direct)", "Tips(Non-Direct)"]) + earnings_type_validator = EnumAttributeValidator.new('String', ["Allowance", "Backpay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "Tips(Direct)", "Tips(Non-Direct)"]) return false unless earnings_type_validator.valid?(@earnings_type) return false if @rate_type.nil? rate_type_validator = EnumAttributeValidator.new('String', ["RatePerUnit", "MultipleOfOrdinaryEarningsRate", "FixedAmount"]) @@ -219,7 +226,7 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] earnings_type Object to be assigned def earnings_type=(earnings_type) - validator = EnumAttributeValidator.new('String', ["Allowance", "Backpay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryMaternityPay", "StatutoryPaternityPay", "StatutorySharedParentalPay", "StatutorySickPay", "Tips(Direct)", "Tips(Non-Direct)"]) + validator = EnumAttributeValidator.new('String', ["Allowance", "Backpay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "Tips(Direct)", "Tips(Non-Direct)"]) unless validator.valid?(earnings_type) fail ArgumentError, "invalid value for \"earnings_type\", must be one of #{validator.allowable_values}." end diff --git a/lib/xero-ruby/version.rb b/lib/xero-ruby/version.rb index 934246ca..3a0204f6 100644 --- a/lib/xero-ruby/version.rb +++ b/lib/xero-ruby/version.rb @@ -7,7 +7,7 @@ Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 -The version of the XeroOpenAPI document: 2.9.3 +The version of the XeroOpenAPI document: 2.9.4 =end module XeroRuby From db234b7116778661c0a4c68446d4d68aa0c1fe34 Mon Sep 17 00:00:00 2001 From: serknight Date: Fri, 26 Feb 2021 10:37:33 -0700 Subject: [PATCH 2/2] bump vsn --- lib/xero-ruby/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xero-ruby/version.rb b/lib/xero-ruby/version.rb index 3a0204f6..bd162663 100644 --- a/lib/xero-ruby/version.rb +++ b/lib/xero-ruby/version.rb @@ -11,5 +11,5 @@ =end module XeroRuby - VERSION = '2.7.0' + VERSION = '2.7.1' end