Class: Wavix::NumberValidator::Results::Client
- Inherits:
-
Object
- Object
- Wavix::NumberValidator::Results::Client
- Defined in:
- lib/wavix/number_validator/results/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Wavix::Types::PhoneValidationBatchResultResponse
Returns the results of an asynchronous batch validation identified by
request_id. - #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/wavix/number_validator/results/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Wavix::Types::PhoneValidationBatchResultResponse
Returns the results of an asynchronous batch validation identified by request_id.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wavix/number_validator/results/client.rb', line 26 def get(request_options: {}, **params) params = Wavix::Internal::Types::Utils.normalize_keys(params) request = Wavix::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v1/validation/#{URI.encode_uri_component(params[:request_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Wavix::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Wavix::Types::PhoneValidationBatchResultResponse.load(response.body) else error_class = Wavix::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |