Class: PaymentRecipes::PayPal::REST::Payer

Inherits:
Object
  • Object
show all
Includes:
Utils::Converters
Defined in:
lib/payment_recipes/paypal/rest/payer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Converters

#convert_to_money, #convert_to_string, #convert_to_symbol, #convert_to_time

Constructor Details

#initialize(paypal_payer) ⇒ Payer

Returns a new instance of Payer.



11
12
13
14
15
16
17
18
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 11

def initialize(paypal_payer)
  unless paypal_payer.is_a?(::PayPal::SDK::REST::DataTypes::Payer)
    raise Exception, "#{ self.class.name } must be initialized with a PayPal Payer" 
  end

  @payment_method = convert_to_symbol(paypal_payer.payment_method)
  @raw_payer      = paypal_payer
end

Instance Attribute Details

#funding_instrumentsObject (readonly)

Returns the value of attribute funding_instruments.



6
7
8
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 6

def funding_instruments
  @funding_instruments
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



5
6
7
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 5

def payment_method
  @payment_method
end

#raw_payerObject (readonly)

Returns the value of attribute raw_payer.



7
8
9
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 7

def raw_payer
  @raw_payer
end

Instance Method Details

#funding_instrumentObject



20
21
22
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 20

def funding_instrument
  @funding_instruments.first
end

#inspectObject



24
25
26
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 24

def inspect
  to_str
end

#to_sObject



28
29
30
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 28

def to_s
  to_str
end

#to_strObject



32
33
34
# File 'lib/payment_recipes/paypal/rest/payer.rb', line 32

def to_str
  "<#{ self.class.name } payment_method=#{ @payment_method }>"
end