Class: Plivo::Resources::Identity
- Inherits:
-
Base::Resource
- Object
- Base::Resource
- Plivo::Resources::Identity
- Defined in:
- lib/plivo/resources/identities.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Base::Resource
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(client, options = nil) ⇒ Identity
constructor
A new instance of Identity.
- #to_s ⇒ Object
-
#update(file_to_upload = nil, options = nil) ⇒ Identity
Update an identity.
Methods included from Utils
GetSortedQueryParamString?, compute_signatureV3?, expected_type?, expected_value?, generate_url?, getMapFromQueryString?, is_one_among_string_url?, multi_valid_param?, raise_invalid_request, valid_account?, valid_date_format?, valid_mainaccount?, valid_multiple_destination_integers?, valid_multiple_destination_nos?, valid_param?, valid_range?, valid_signature?, valid_signatureV3?, valid_subaccount?, valid_url?
Constructor Details
#initialize(client, options = nil) ⇒ Identity
Returns a new instance of Identity.
6 7 8 9 10 |
# File 'lib/plivo/resources/identities.rb', line 6 def initialize(client, = nil) @_name = 'Verification/Identity' @_identifier_string = 'id' super end |
Instance Method Details
#delete ⇒ Object
12 13 14 |
# File 'lib/plivo/resources/identities.rb', line 12 def delete perform_delete end |
#to_s ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/plivo/resources/identities.rb', line 86 def to_s { account: @account, alias: @alias, api_id: @api_id, 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, salutation: @salutation, subaccount: @subaccount, url: @url, validation_status: @validation_status, verification_status: @verification_status }.to_s end |
#update(file_to_upload = nil, options = nil) ⇒ Identity
Update an identity
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/plivo/resources/identities.rb', line 45 def update(file_to_upload = nil, = nil) params = {} unless .nil? %i[salutation first_name last_name country_iso birth_place birth_date nationality id_nationality id_issue_date id_type id_number address_line1 address_line2 city region postal_code alias business_name fiscal_identification_code street_code municipal_code callback_url subaccount ] .each do |param| if .key?(param) && valid_param?(param, [param], [String, Symbol], true) params[param] = [param] end end %i[auto_correct_address] .each do |param| if .key?(param) && valid_param?(param, [param], nil, true, [true, false]) params[param] = [param] end end end unless file_to_upload.nil? file_extension = file_to_upload.split('.')[-1] content_type = case file_extension when 'jpeg' then 'image/jpeg' when 'jpg' then 'image/jpeg' when 'png' then 'image/png' when 'pdf' then 'application/pdf' else raise_invalid_request("#{file_extension} is not yet supported for upload") end params[:file] = Faraday::UploadIO.new(file_to_upload, content_type) end return perform_update(params, true) end |