Class: PaypalServerSdk::SubscriberRequest

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

Overview

The subscriber request 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, phone: SKIP) ⇒ SubscriberRequest

Returns a new instance of SubscriberRequest.



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

def initialize(email_address: SKIP, payer_id: SKIP, name: SKIP,
               shipping_address: SKIP, payment_source: SKIP, phone: 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
  @phone = phone unless phone == 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_request.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_request.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_request.rb', line 21

def payer_id
  @payer_id
end

#payment_sourceSubscriptionPaymentSource

The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions.



36
37
38
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 36

def payment_source
  @payment_source
end

#phonePhoneWithType

The phone information.

Returns:



40
41
42
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 40

def phone
  @phone
end

#shipping_addressShippingDetails

The shipping details.

Returns:



29
30
31
# File 'lib/paypal_server_sdk/models/subscriber_request.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.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 82

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 = SubscriptionPaymentSource.from_hash(hash['payment_source']) if
    hash['payment_source']
  phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']

  # Create object from extracted values.

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

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 43

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['phone'] = 'phone'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 113

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}, phone: #{@phone.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
# File 'lib/paypal_server_sdk/models/subscriber_request.rb', line 105

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}, phone:"\
  " #{@phone}>"
end