Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Richa Verma authored and Richa Verma committed Jan 30, 2019
1 parent 162bfc7 commit 1af3f65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions lib/plivo/resources/addresses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def create(phone_number_country, number_type, salutation, first_name, last_name,
postal_code: postal_code,
country_iso: country_iso,
}
return perform_create(params, true) if options.nil?

if country_iso == 'ES'
valid_param?(:fiscal_identification_code, options[:fiscal_identification_code], [String, Symbol], true)
Expand Down
30 changes: 12 additions & 18 deletions lib/plivo/resources/identities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,18 @@ def update(options = nil)
def to_s
{
account: @account,
address_line1: @address_line1,
address_line2: @address_line2,
alias: @alias,
api_id: @api_id,
city: @city,
country_iso: @country_iso,
document_details: @document_details,
first_name: @first_name,
id: @id,
id_number: @id_number,
id_type: @id_type,
last_name: @last_name,
nationality: @nationality,
postal_code: @postal_code,
region: @region,
salutation: @salutation,
subaccount: @subaccount,
url: @url,
Expand Down Expand Up @@ -229,7 +231,6 @@ def create(phone_number_country, number_type, salutation, first_name, last_name,
valid_param?(:region, region, [String, Symbol], true)
valid_param?(:postal_code, postal_code, [String, Symbol], true)
valid_param?(:country_iso, country_iso, [String, Symbol], true)
valid_param?(:proof_type, proof_type, [String, Symbol], true)
valid_param?(:id_number, id_number, [String, Symbol], true)
valid_param?(:nationality, nationality, [String, Symbol], true)

Expand All @@ -245,11 +246,11 @@ def create(phone_number_country, number_type, salutation, first_name, last_name,
region: region,
postal_code: postal_code,
country_iso: country_iso,
proof_type: proof_type,
id_number: id_number,
nationality: nationality
}

return perform_create(params, true) if options.nil?
unless options[:file].nil?
file_extension = options[:file].split('.')[-1].downcase

Expand All @@ -269,24 +270,17 @@ def create(phone_number_country, number_type, salutation, first_name, last_name,

if country_iso == 'ES'
valid_param?(:fiscal_identification_code, options[:fiscal_identification_code], [String, Symbol], true)
valid_param?(:proof_type, proof_type, [String, Symbol], true, ['NIF', 'NIE', 'DNI'])
params[:proof_type] = proof_type
params[:fiscal_identification_code] = options[:fiscal_identification_code]
end

if country_iso == 'DK'
elsif country_iso == 'DK'
valid_param?(:street_code, options[:street_code], [String, Symbol], true)
valid_param?(:municipal_code, options[:municipal_code], [String, Symbol], true)

params[:street_code] = options[:street_code]
params[:municipal_code] = options[:municipal_code]
end

if options[:proof_type]
if country_iso == 'ES'
valid_param?(:proof_type, options[:proof_type], [String, Symbol], false, ['NIF', 'NIE', 'DNI'])
else
valid_param?(:proof_type, options[:proof_type], [String, Symbol], false, ['national_id', 'passport', 'business_id'])
end
params[:proof_type] = options[:proof_type]
else
valid_param?(:proof_type, proof_type, [String, Symbol], true, ['national_id', 'passport', 'business_id'])
params[:proof_type] = proof_type
end

%i[callback_url alias id_nationality birth_place birth_date id_issue_date business_name fiscal_identification_code street_code municipal_code]
Expand Down

0 comments on commit 1af3f65

Please sign in to comment.