Skip to content

Commit

Permalink
4 sets built - specs - manual updates added
Browse files Browse the repository at this point in the history
  • Loading branch information
SerKnight committed Nov 2, 2020
1 parent 6523992 commit ac7d27b
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 39 deletions.
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/accounting_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

=end

require 'cgi'

module XeroRuby
class AccountingApi
attr_accessor :api_client
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/asset_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class AssetApi
attr_accessor :api_client
Expand Down
5 changes: 0 additions & 5 deletions lib/xero-ruby/api/files_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class FilesApi
attr_accessor :api_client
Expand Down Expand Up @@ -1263,10 +1261,7 @@ def upload_file_with_http_info(xero_tenant_id, opts = {})
:return_type => return_type
)

puts "new_options: #{new_options}"

data, status_code, headers = @api_client.call_api(:POST, local_var_path, "FilesApi", new_options)

if @api_client.config.debugging
@api_client.config.logger.debug "API called: FilesApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/payroll_au_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class PayrollAuApi
attr_accessor :api_client
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/payroll_nz_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class PayrollNzApi
attr_accessor :api_client
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/payroll_uk_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class PayrollUkApi
attr_accessor :api_client
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/api/project_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
=end

require 'cgi'

module XeroRuby
class ProjectApi
attr_accessor :api_client
Expand Down
7 changes: 4 additions & 3 deletions lib/xero-ruby/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def build_request_body(header_params, form_params, body)
when ::File, ::Tempfile
data[form_params["name"]] = Faraday::UploadIO.new(value.path, form_params["mimeType"], value.path)
when ::Array, nil
# let Faraday handle Array and nil parameters
data[key] = value
else
data[key] = value.to_s
Expand Down Expand Up @@ -317,7 +318,7 @@ def deserialize(response, return_type, api_client)
else
raise e
end
end
end

convert_to_type(data, return_type, api_client)
end
Expand Down Expand Up @@ -349,12 +350,12 @@ def convert_to_type(data, return_type, api_client)
when /\AArray<(.+)>\z/
# e.g. Array<Pet>
sub_type = $1
data.map { |item| convert_to_type(item, sub_type) }
data.map { |item| convert_to_type(item, sub_type, api_client) }
when /\AHash\<String, (.+)\>\z/
# e.g. Hash<String, Integer>
sub_type = $1
{}.tap do |hash|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
data.each { |k, v| hash[k] = convert_to_type(v, sub_type, api_client) }
end
else
case api_client
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/models/accounting/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Account
CISLABOURINCOME = "CISLABOURINCOME".freeze
CISLIABILITY = "CISLIABILITY".freeze
CISMATERIALS = "CISMATERIALS".freeze
EMPTY = "".freeze
# EMPTY = "".freeze

# Shown if set
attr_accessor :reporting_code
Expand Down
26 changes: 13 additions & 13 deletions lib/xero-ruby/models/accounting/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Organisation
N6_MONTHLY = "6MONTHLY".freeze
QUARTERLY = "QUARTERLY".freeze
YEARLY = "YEARLY".freeze
NONE = "NONE".freeze
# NONE = "NONE".freeze

# The default for LineAmountTypes on sales transactions
attr_accessor :default_sales_tax
Expand All @@ -136,18 +136,18 @@ class Organisation

# Organisation Entity Type
attr_accessor :organisation_entity_type
ACCOUNTING_PRACTICE = "ACCOUNTING_PRACTICE".freeze
COMPANY = "COMPANY".freeze
CHARITY = "CHARITY".freeze
CLUB_OR_SOCIETY = "CLUB_OR_SOCIETY".freeze
LOOK_THROUGH_COMPANY = "LOOK_THROUGH_COMPANY".freeze
NOT_FOR_PROFIT = "NOT_FOR_PROFIT".freeze
PARTNERSHIP = "PARTNERSHIP".freeze
S_CORPORATION = "S_CORPORATION".freeze
SELF_MANAGED_SUPERANNUATION_FUND = "SELF_MANAGED_SUPERANNUATION_FUND".freeze
SOLE_TRADER = "SOLE_TRADER".freeze
SUPERANNUATION_FUND = "SUPERANNUATION_FUND".freeze
TRUST = "TRUST".freeze
# ACCOUNTING_PRACTICE = "ACCOUNTING_PRACTICE".freeze
# COMPANY = "COMPANY".freeze
# CHARITY = "CHARITY".freeze
# CLUB_OR_SOCIETY = "CLUB_OR_SOCIETY".freeze
# LOOK_THROUGH_COMPANY = "LOOK_THROUGH_COMPANY".freeze
# NOT_FOR_PROFIT = "NOT_FOR_PROFIT".freeze
# PARTNERSHIP = "PARTNERSHIP".freeze
# S_CORPORATION = "S_CORPORATION".freeze
# SELF_MANAGED_SUPERANNUATION_FUND = "SELF_MANAGED_SUPERANNUATION_FUND".freeze
# SOLE_TRADER = "SOLE_TRADER".freeze
# SUPERANNUATION_FUND = "SUPERANNUATION_FUND".freeze
# TRUST = "TRUST".freeze

# A unique identifier for the organisation. Potential uses.
attr_accessor :short_code
Expand Down
2 changes: 0 additions & 2 deletions lib/xero-ruby/models/files/object_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
module XeroRuby::Files
class ObjectType
ACCOUNT = "ACCOUNT".freeze
ACCPAY = "ACCPAY".freeze
ACCPAY = "Accpay".freeze
ACCPAYCREDIT = "ACCPAYCREDIT".freeze
ACCPAYPAYMENT = "ACCPAYPAYMENT".freeze
ACCREC = "ACCREC".freeze
ACC_REC = "AccRec".freeze
ACCRECCREDIT = "ACCRECCREDIT".freeze
ACCRECPAYMENT = "ACCRECPAYMENT".freeze
Expand Down
6 changes: 3 additions & 3 deletions spec/api_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
api_client = XeroRuby::ApiClient.new
headers = { 'Content-Type' => 'application/json' }
response = double('response', headers: headers, body: '[12, 34]')
data = api_client.deserialize(response, 'Array<Integer>')
data = api_client.deserialize(response, 'Array<Integer>', 'AccountingApi')
expect(data).to be_instance_of(Array)
expect(data).to eq([12, 34])
end
Expand All @@ -65,7 +65,7 @@
api_client = XeroRuby::ApiClient.new
headers = { 'Content-Type' => 'application/json' }
response = double('response', headers: headers, body: '[[12, 34], [56]]')
data = api_client.deserialize(response, 'Array<Array<Integer>>')
data = api_client.deserialize(response, 'Array<Array<Integer>>', 'AccountingApi')
expect(data).to be_instance_of(Array)
expect(data).to eq([[12, 34], [56]])
end
Expand All @@ -74,7 +74,7 @@
api_client = XeroRuby::ApiClient.new
headers = { 'Content-Type' => 'application/json' }
response = double('response', headers: headers, body: '{"message": "Hello"}')
data = api_client.deserialize(response, 'Hash<String, String>')
data = api_client.deserialize(response, 'Hash<String, String>', 'AccountingApi')
expect(data).to be_instance_of(Hash)
expect(data).to eq(:message => 'Hello')
end
Expand Down

0 comments on commit ac7d27b

Please sign in to comment.