Class: PaypalServerSdk::SubscriptionPayer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/subscription_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) ⇒ SubscriptionPayer

Returns a new instance of SubscriptionPayer.



51
52
53
54
55
# File 'lib/paypal_server_sdk/models/subscription_payer.rb', line 51

def initialize(email_address: SKIP, payer_id: SKIP, name: SKIP)
  @email_address = email_address unless email_address == SKIP
  @payer_id = payer_id unless payer_id == SKIP
  @name = name unless name == SKIP
end

Instance Attribute Details

#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/subscription_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/subscription_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/subscription_payer.rb', line 22

def payer_id
  @payer_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/paypal_server_sdk/models/subscription_payer.rb', line 58

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']

  # Create object from extracted values.
  SubscriptionPayer.new(email_address: email_address,
                        payer_id: payer_id,
                        name: name)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/paypal_server_sdk/models/subscription_payer.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    email_address
    payer_id
    name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



79
80
81
82
83
# File 'lib/paypal_server_sdk/models/subscription_payer.rb', line 79

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

#to_sObject

Provides a human-readable string representation of the object.



73
74
75
76
# File 'lib/paypal_server_sdk/models/subscription_payer.rb', line 73

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