Class: PaypalServerSdk::Subscriber

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

Overview

The subscriber response information.

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, shipping_address: SKIP, payment_source: SKIP) ⇒ Subscriber

Returns a new instance of Subscriber.



62
63
64
65
66
67
68
69
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 62

def initialize(email_address: SKIP, payer_id: SKIP, name: SKIP,
               shipping_address: SKIP, payment_source: SKIP)
  @email_address = email_address unless email_address == SKIP
  @payer_id = payer_id unless payer_id == SKIP
  @name = name unless name == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @payment_source = payment_source unless payment_source == 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)


17
18
19
# File 'lib/paypal_server_sdk/models/subscriber.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/subscriber.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/subscriber.rb', line 21

def payer_id
  @payer_id
end

#payment_sourceSubscriptionPaymentSourceResponse

The payment source used to fund the payment.



33
34
35
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 33

def payment_source
  @payment_source
end

#shipping_addressShippingDetails

The shipping details.

Returns:



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

def shipping_address
  @shipping_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 72

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']
  shipping_address = ShippingDetails.from_hash(hash['shipping_address']) if
    hash['shipping_address']
  payment_source = SubscriptionPaymentSourceResponse.from_hash(hash['payment_source']) if
    hash['payment_source']

  # Create object from extracted values.

  Subscriber.new(email_address: email_address,
                 payer_id: payer_id,
                 name: name,
                 shipping_address: shipping_address,
                 payment_source: payment_source)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
54
55
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 47

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 100

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

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 93

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