# bandwidth # # This file was automatically generated by APIMATIC v2.0 # ( https://apimatic.io ). module Bandwidth # Result Model. class Result < BaseModel SKIP = Object.new private_constant :SKIP # Our vendor's response code. # @return [Integer] attr_accessor :response_code # Message associated with the response code. # @return [String] attr_accessor :message # The telephone number in E.164 format. # @return [String] attr_accessor :e_164_format # The formatted version of the telephone number. # @return [String] attr_accessor :formatted # The country of the telephone number. # @return [String] attr_accessor :country # The line type of the telephone number. # @return [String] attr_accessor :line_type # The service provider of the telephone number. # @return [String] attr_accessor :line_provider # The first half of the Home Network Identity (HNI). # @return [String] attr_accessor :mobile_country_code # The second half of the HNI. # @return [String] attr_accessor :mobile_network_code # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @_hash['response_code'] = 'Response Code' @_hash['message'] = 'Message' @_hash['e_164_format'] = 'E.164 Format' @_hash['formatted'] = 'Formatted' @_hash['country'] = 'Country' @_hash['line_type'] = 'Line Type' @_hash['line_provider'] = 'Line Provider' @_hash['mobile_country_code'] = 'Mobile Country Code' @_hash['mobile_network_code'] = 'Mobile Network Code' @_hash end # An array for optional fields def optionals %w[ response_code message e_164_format formatted country line_type line_provider mobile_country_code mobile_network_code ] end # An array for nullable fields def nullables [] end def initialize(response_code = nil, message = nil, e_164_format = nil, formatted = nil, country = nil, line_type = nil, line_provider = nil, mobile_country_code = nil, mobile_network_code = nil) @response_code = response_code unless response_code == SKIP @message = message unless message == SKIP @e_164_format = e_164_format unless e_164_format == SKIP @formatted = formatted unless formatted == SKIP @country = country unless country == SKIP @line_type = line_type unless line_type == SKIP @line_provider = line_provider unless line_provider == SKIP @mobile_country_code = mobile_country_code unless mobile_country_code == SKIP @mobile_network_code = mobile_network_code unless mobile_network_code == SKIP end # Creates an instance of the object from a hash. def self.from_hash(hash) return nil unless hash # Extract variables from the hash. response_code = hash.key?('Response Code') ? hash['Response Code'] : SKIP message = hash.key?('Message') ? hash['Message'] : SKIP e_164_format = hash.key?('E.164 Format') ? hash['E.164 Format'] : SKIP formatted = hash.key?('Formatted') ? hash['Formatted'] : SKIP country = hash.key?('Country') ? hash['Country'] : SKIP line_type = hash.key?('Line Type') ? hash['Line Type'] : SKIP line_provider = hash.key?('Line Provider') ? hash['Line Provider'] : SKIP mobile_country_code = hash.key?('Mobile Country Code') ? hash['Mobile Country Code'] : SKIP mobile_network_code = hash.key?('Mobile Network Code') ? hash['Mobile Network Code'] : SKIP # Create object from extracted values. Result.new(response_code, message, e_164_format, formatted, country, line_type, line_provider, mobile_country_code, mobile_network_code) end end end