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

Returns a new instance of Subscriber.



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

def initialize(name: SKIP, shipping_address: SKIP, payment_source: 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

#nameName

The name of the party.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 14

def name
  @name
end

#payment_sourceSubscriptionPaymentSourceResponse

The payment source used to fund the payment.



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

def payment_source
  @payment_source
end

#shipping_addressShippingDetails

The shipping details.

Returns:



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

def shipping_address
  @shipping_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  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(name: name,
                 shipping_address: shipping_address,
                 payment_source: payment_source)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 25

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 34

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} 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.



71
72
73
74
75
# File 'lib/paypal_server_sdk/models/subscriber.rb', line 71

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