Class: Braintree::PayPalAccount

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/paypal_account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(gateway, attributes) ⇒ PayPalAccount

:nodoc:


16
17
18
19
20
# File 'lib/braintree/paypal_account.rb', line 16

def initialize(gateway, attributes) # :nodoc:
  @gateway = gateway
  set_instance_variables_from_hash(attributes)
  @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
end

Instance Attribute Details

#billing_agreement_idObject (readonly)

Returns the value of attribute billing_agreement_id.


5
6
7
# File 'lib/braintree/paypal_account.rb', line 5

def billing_agreement_id
  @billing_agreement_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.


6
7
8
# File 'lib/braintree/paypal_account.rb', line 6

def created_at
  @created_at
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.


7
8
9
# File 'lib/braintree/paypal_account.rb', line 7

def customer_id
  @customer_id
end

#emailObject (readonly)

Returns the value of attribute email.


8
9
10
# File 'lib/braintree/paypal_account.rb', line 8

def email
  @email
end

#image_urlObject (readonly)

Returns the value of attribute image_url.


9
10
11
# File 'lib/braintree/paypal_account.rb', line 9

def image_url
  @image_url
end

#payer_idObject (readonly)

Returns the value of attribute payer_id.


10
11
12
# File 'lib/braintree/paypal_account.rb', line 10

def payer_id
  @payer_id
end

#revoked_atObject (readonly)

Returns the value of attribute revoked_at.


11
12
13
# File 'lib/braintree/paypal_account.rb', line 11

def revoked_at
  @revoked_at
end

#subscriptionsObject (readonly)

Returns the value of attribute subscriptions.


12
13
14
# File 'lib/braintree/paypal_account.rb', line 12

def subscriptions
  @subscriptions
end

#tokenObject (readonly)

Returns the value of attribute token.


13
14
15
# File 'lib/braintree/paypal_account.rb', line 13

def token
  @token
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.


14
15
16
# File 'lib/braintree/paypal_account.rb', line 14

def updated_at
  @updated_at
end

Class Method Details

._new(*args) ⇒ Object


26
27
28
# File 'lib/braintree/paypal_account.rb', line 26

def self._new(*args)
  self.new(*args)
end

.create(attributes) ⇒ Object


30
31
32
# File 'lib/braintree/paypal_account.rb', line 30

def self.create(attributes)
  Configuration.gateway..create(attributes)
end

.delete(token) ⇒ Object


42
43
44
# File 'lib/braintree/paypal_account.rb', line 42

def self.delete(token)
  Configuration.gateway..delete(token)
end

.find(token) ⇒ Object


34
35
36
# File 'lib/braintree/paypal_account.rb', line 34

def self.find(token)
  Configuration.gateway..find(token)
end

.sale(token, transaction_attributes) ⇒ Object


46
47
48
# File 'lib/braintree/paypal_account.rb', line 46

def self.sale(token, transaction_attributes)
  Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
end

.sale!(token, transaction_attributes) ⇒ Object


50
51
52
# File 'lib/braintree/paypal_account.rb', line 50

def self.sale!(token, transaction_attributes)
  return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
end

.update(token, attributes) ⇒ Object


38
39
40
# File 'lib/braintree/paypal_account.rb', line 38

def self.update(token, attributes)
  Configuration.gateway..update(token, attributes)
end

Instance Method Details

#default?Boolean

Returns true if this paypal account is the customer's default payment method.

Returns:

  • (Boolean)

55
56
57
# File 'lib/braintree/paypal_account.rb', line 55

def default?
  @default
end