Class: Postio::Models::PhoneResult

Inherits:
Data
  • Object
show all
Defined in:
lib/postio/models.rb

Overview

PhoneResult — validation verdict for one phone number.

SPEC DRIFT (2026-05-02): the OpenAPI spec marks every nullable field as required, but on invalid input the live API drops them entirely. The .from_hash fetcher uses h which returns nil for missing keys, papering over the drift. Also: spec says is_reachable is string|null, but the live API returns bool — we accept either.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#country_codeObject (readonly)

Returns the value of attribute country_code

Returns:

  • (Object)

    the current value of country_code



119
120
121
# File 'lib/postio/models.rb', line 119

def country_code
  @country_code
end

#country_nameObject (readonly)

Returns the value of attribute country_name

Returns:

  • (Object)

    the current value of country_name



119
120
121
# File 'lib/postio/models.rb', line 119

def country_name
  @country_name
end

#current_carrierObject (readonly)

Returns the value of attribute current_carrier

Returns:

  • (Object)

    the current value of current_carrier



119
120
121
# File 'lib/postio/models.rb', line 119

def current_carrier
  @current_carrier
end

#e164_formatObject (readonly)

Returns the value of attribute e164_format

Returns:

  • (Object)

    the current value of e164_format



119
120
121
# File 'lib/postio/models.rb', line 119

def e164_format
  @e164_format
end

#international_formatObject (readonly)

Returns the value of attribute international_format

Returns:

  • (Object)

    the current value of international_format



119
120
121
# File 'lib/postio/models.rb', line 119

def international_format
  @international_format
end

#is_portedObject (readonly)

Returns the value of attribute is_ported

Returns:

  • (Object)

    the current value of is_ported



119
120
121
# File 'lib/postio/models.rb', line 119

def is_ported
  @is_ported
end

#is_possibleObject (readonly)

Returns the value of attribute is_possible

Returns:

  • (Object)

    the current value of is_possible



119
120
121
# File 'lib/postio/models.rb', line 119

def is_possible
  @is_possible
end

#is_reachableObject (readonly)

Returns the value of attribute is_reachable

Returns:

  • (Object)

    the current value of is_reachable



119
120
121
# File 'lib/postio/models.rb', line 119

def is_reachable
  @is_reachable
end

#is_validObject (readonly)

Returns the value of attribute is_valid

Returns:

  • (Object)

    the current value of is_valid



119
120
121
# File 'lib/postio/models.rb', line 119

def is_valid
  @is_valid
end

#levelObject (readonly)

Returns the value of attribute level

Returns:

  • (Object)

    the current value of level



119
120
121
# File 'lib/postio/models.rb', line 119

def level
  @level
end

#lookup_errorObject (readonly)

Returns the value of attribute lookup_error

Returns:

  • (Object)

    the current value of lookup_error



119
120
121
# File 'lib/postio/models.rb', line 119

def lookup_error
  @lookup_error
end

#mccObject (readonly)

Returns the value of attribute mcc

Returns:

  • (Object)

    the current value of mcc



119
120
121
# File 'lib/postio/models.rb', line 119

def mcc
  @mcc
end

#mncObject (readonly)

Returns the value of attribute mnc

Returns:

  • (Object)

    the current value of mnc



119
120
121
# File 'lib/postio/models.rb', line 119

def mnc
  @mnc
end

#national_formatObject (readonly)

Returns the value of attribute national_format

Returns:

  • (Object)

    the current value of national_format



119
120
121
# File 'lib/postio/models.rb', line 119

def national_format
  @national_format
end

#numberObject (readonly)

Returns the value of attribute number

Returns:

  • (Object)

    the current value of number



119
120
121
# File 'lib/postio/models.rb', line 119

def number
  @number
end

#original_carrierObject (readonly)

Returns the value of attribute original_carrier

Returns:

  • (Object)

    the current value of original_carrier



119
120
121
# File 'lib/postio/models.rb', line 119

def original_carrier
  @original_carrier
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



119
120
121
# File 'lib/postio/models.rb', line 119

def type
  @type
end

Class Method Details

.from_hash(h) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/postio/models.rb', line 124

def self.from_hash(h)
  new(
    number:               h["number"].to_s,
    is_valid:             h["isValid"] == true,
    is_possible:          h["isPossible"] == true,
    type:                 h["type"],
    country_code:         h["countryCode"],
    country_name:         h["countryName"],
    national_format:      h["nationalFormat"],
    international_format: h["internationalFormat"],
    e164_format:          h["e164Format"],
    original_carrier:     h["originalCarrier"],
    current_carrier:      h["currentCarrier"],
    is_ported:            h["isPorted"],
    is_reachable:         h["isReachable"],
    mcc:                  h["mcc"],
    mnc:                  h["mnc"],
    level:                h["level"],
    lookup_error:         h["lookupError"]
  )
end