Class: PaypalServerSdk::Payer

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

Overview

Payer Model.

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(email_address: SKIP, payer_id: SKIP, name: SKIP, phone: SKIP, birth_date: SKIP, tax_info: SKIP, address: SKIP) ⇒ Payer

Returns a new instance of Payer.



85
86
87
88
89
90
91
92
93
94
# File 'lib/paypal_server_sdk/models/payer.rb', line 85

def initialize(email_address: SKIP, payer_id: SKIP, name: SKIP, phone: SKIP,
               birth_date: SKIP, tax_info: SKIP, address: SKIP)
  @email_address = email_address unless email_address == SKIP
  @payer_id = payer_id unless payer_id == SKIP
  @name = name unless name == SKIP
  @phone = phone unless phone == SKIP
  @birth_date = birth_date unless birth_date == SKIP
  @tax_info = tax_info unless tax_info == SKIP
  @address = address unless address == SKIP
end

Instance Attribute Details

#addressAddress

The portable international postal address. Maps to [AddressValidationMetadata](github.com/googlei18n/libaddressinput/ wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](www.w3.org/TR/html51/sec-forms.html#autofilling-form-co ntrols-the-autocomplete-attribute).

Returns:



52
53
54
# File 'lib/paypal_server_sdk/models/payer.rb', line 52

def address
  @address
end

#birth_dateString

The stand-alone date, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). To represent special legal values, such as a date of birth, you should use dates with no associated time or time-zone data. Whenever possible, use the standard ‘date_time` type. This regular expression does not validate all dates. For example, February 31 is valid and nothing is known about leap years.

Returns:

  • (String)


38
39
40
# File 'lib/paypal_server_sdk/models/payer.rb', line 38

def birth_date
  @birth_date
end

#email_addressString

The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.

Returns:

  • (String)


17
18
19
# File 'lib/paypal_server_sdk/models/payer.rb', line 17

def email_address
  @email_address
end

#nameName

The name of the party.

Returns:



25
26
27
# File 'lib/paypal_server_sdk/models/payer.rb', line 25

def name
  @name
end

#payer_idString

The account identifier for a PayPal account.

Returns:

  • (String)


21
22
23
# File 'lib/paypal_server_sdk/models/payer.rb', line 21

def payer_id
  @payer_id
end

#phonePhoneWithType

The phone information.

Returns:



29
30
31
# File 'lib/paypal_server_sdk/models/payer.rb', line 29

def phone
  @phone
end

#tax_infoTaxInfo

The tax ID of the customer. The customer is also known as the payer. Both ‘tax_id` and `tax_id_type` are required.

Returns:



43
44
45
# File 'lib/paypal_server_sdk/models/payer.rb', line 43

def tax_info
  @tax_info
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/paypal_server_sdk/models/payer.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
  payer_id = hash.key?('payer_id') ? hash['payer_id'] : SKIP
  name = Name.from_hash(hash['name']) if hash['name']
  phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']
  birth_date = hash.key?('birth_date') ? hash['birth_date'] : SKIP
  tax_info = TaxInfo.from_hash(hash['tax_info']) if hash['tax_info']
  address = Address.from_hash(hash['address']) if hash['address']

  # Create object from extracted values.
  Payer.new(email_address: email_address,
            payer_id: payer_id,
            name: name,
            phone: phone,
            birth_date: birth_date,
            tax_info: tax_info,
            address: address)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email_address'] = 'email_address'
  @_hash['payer_id'] = 'payer_id'
  @_hash['name'] = 'name'
  @_hash['phone'] = 'phone'
  @_hash['birth_date'] = 'birth_date'
  @_hash['tax_info'] = 'tax_info'
  @_hash['address'] = 'address'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/paypal_server_sdk/models/payer.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/paypal_server_sdk/models/payer.rb', line 68

def self.optionals
  %w[
    email_address
    payer_id
    name
    phone
    birth_date
    tax_info
    address
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
# File 'lib/paypal_server_sdk/models/payer.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email_address: #{@email_address.inspect}, payer_id: #{@payer_id.inspect},"\
  " name: #{@name.inspect}, phone: #{@phone.inspect}, birth_date: #{@birth_date.inspect},"\
  " tax_info: #{@tax_info.inspect}, address: #{@address.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
125
# File 'lib/paypal_server_sdk/models/payer.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email_address: #{@email_address}, payer_id: #{@payer_id}, name: #{@name},"\
  " phone: #{@phone}, birth_date: #{@birth_date}, tax_info: #{@tax_info}, address:"\
  " #{@address}>"
end