Class: PaypalServerSdk::PhoneNumberWithOptionalCountryCode

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb

Overview

The phone number in its canonical international E.164 numbering plan format.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(national_number:, country_code: SKIP) ⇒ PhoneNumberWithOptionalCountryCode

Returns a new instance of PhoneNumberWithOptionalCountryCode.



49
50
51
52
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 49

def initialize(national_number:, country_code: SKIP)
  @country_code = country_code unless country_code == SKIP
  @national_number = national_number
end

Instance Attribute Details

#country_codeString

The country calling code (CC), in its canonical international E.164 numbering plan format. The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN).

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 19

def country_code
  @country_code
end

#national_numberString

The national number, in its canonical international E.164 numbering plan format. The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN).

Returns:

  • (String)


27
28
29
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 27

def national_number
  @national_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  national_number =
    hash.key?('national_number') ? hash['national_number'] : nil
  country_code = hash.key?('country_code') ? hash['country_code'] : SKIP

  # Create object from extracted values.
  PhoneNumberWithOptionalCountryCode.new(national_number: national_number,
                                         country_code: country_code)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country_code'] = 'country_code'
  @_hash['national_number'] = 'national_number'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



38
39
40
41
42
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 38

def self.optionals
  %w[
    country_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



75
76
77
78
79
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 75

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} country_code: #{@country_code.inspect}, national_number:"\
  " #{@national_number.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



69
70
71
72
# File 'lib/paypal_server_sdk/models/phone_number_with_optional_country_code.rb', line 69

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} country_code: #{@country_code}, national_number: #{@national_number}>"
end