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

Returns a new instance of PayPalAccount.



18
19
20
21
22
# File 'lib/braintree/paypal_account.rb', line 18

def initialize(gateway, attributes)
  @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

#edit_paypal_vault_idObject (readonly)

Returns the value of attribute edit_paypal_vault_id.



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

def edit_paypal_vault_id
  @edit_paypal_vault_id
end

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#funding_source_descriptionObject (readonly)

Returns the value of attribute funding_source_description.



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

def funding_source_description
  @funding_source_description
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



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

def image_url
  @image_url
end

#payer_idObject (readonly)

Returns the value of attribute payer_id.



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

def payer_id
  @payer_id
end

#revoked_atObject (readonly)

Returns the value of attribute revoked_at.



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

def revoked_at
  @revoked_at
end

#subscriptionsObject (readonly)

Returns the value of attribute subscriptions.



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

def subscriptions
  @subscriptions
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Class Method Details

._new(*args) ⇒ Object



28
29
30
# File 'lib/braintree/paypal_account.rb', line 28

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

.create(attributes) ⇒ Object



32
33
34
# File 'lib/braintree/paypal_account.rb', line 32

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

.delete(token) ⇒ Object



44
45
46
# File 'lib/braintree/paypal_account.rb', line 44

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

.find(token) ⇒ Object



36
37
38
# File 'lib/braintree/paypal_account.rb', line 36

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

.sale(token, transaction_attributes) ⇒ Object



48
49
50
# File 'lib/braintree/paypal_account.rb', line 48

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

.sale!(token, transaction_attributes) ⇒ Object



52
53
54
# File 'lib/braintree/paypal_account.rb', line 52

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

.update(token, attributes) ⇒ Object



40
41
42
# File 'lib/braintree/paypal_account.rb', line 40

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

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


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

def default?
  @default
end