Class: PaypalServerSdk::Payer

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

Overview

The customer who approves and pays for the order. The customer is also known as the payer.

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.



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

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:



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

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)


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

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)


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

def email_address
  @email_address
end

#nameName

The name of the party.

Returns:



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

def name
  @name
end

#payer_idString

The account identifier for a PayPal account.

Returns:

  • (String)


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

def payer_id
  @payer_id
end

#phonePhoneWithType

The phone information.

Returns:



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

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:



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

def tax_info
  @tax_info
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.



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

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



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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.



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

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.



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

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