Class: Braintree::MerchantAccount

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/merchant_account.rb,
lib/braintree/merchant_account/address_details.rb,
lib/braintree/merchant_account/funding_details.rb,
lib/braintree/merchant_account/business_details.rb,
lib/braintree/merchant_account/individual_details.rb

Defined Under Namespace

Modules: FundingDestination, FundingDestinations, Status Classes: AddressDetails, BusinessDetails, FundingDetails, IndividualDetails

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) ⇒ MerchantAccount

Returns a new instance of MerchantAccount.



52
53
54
55
56
57
58
59
# File 'lib/braintree/merchant_account.rb', line 52

def initialize(gateway, attributes)
  @gateway = gateway
  set_instance_variables_from_hash(attributes)
  @individual_details = IndividualDetails.new(@individual)
  @business_details = BusinessDetails.new(@business)
  @funding_details = FundingDetails.new(@funding)
  @master_merchant_account = MerchantAccount._new(@gateway, attributes.delete(:master_merchant_account)) if attributes[:master_merchant_account]
end

Instance Attribute Details

#business_detailsObject (readonly)

Returns the value of attribute business_details.



21
22
23
# File 'lib/braintree/merchant_account.rb', line 21

def business_details
  @business_details
end

#currency_iso_codeObject (readonly)

Returns the value of attribute currency_iso_code.



22
23
24
# File 'lib/braintree/merchant_account.rb', line 22

def currency_iso_code
  @currency_iso_code
end

#defaultObject (readonly) Also known as: default?

Returns the value of attribute default.



23
24
25
# File 'lib/braintree/merchant_account.rb', line 23

def default
  @default
end

#funding_detailsObject (readonly)

Returns the value of attribute funding_details.



24
25
26
# File 'lib/braintree/merchant_account.rb', line 24

def funding_details
  @funding_details
end

#idObject (readonly)

Returns the value of attribute id.



25
26
27
# File 'lib/braintree/merchant_account.rb', line 25

def id
  @id
end

#individual_detailsObject (readonly)

Returns the value of attribute individual_details.



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

def individual_details
  @individual_details
end

#master_merchant_accountObject (readonly)

Returns the value of attribute master_merchant_account.



27
28
29
# File 'lib/braintree/merchant_account.rb', line 27

def 
  @master_merchant_account
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Class Method Details

._new(*args) ⇒ Object



63
64
65
# File 'lib/braintree/merchant_account.rb', line 63

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

.create(*args) ⇒ Object



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

def self.create(*args)
  Configuration.gateway..create(*args)
end

.create!(*args) ⇒ Object



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

def self.create!(*args)
  Configuration.gateway..create!(*args)
end

.find(*args) ⇒ Object



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

def self.find(*args)
  Configuration.gateway..find(*args)
end

.update(*args) ⇒ Object



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

def self.update(*args)
  Configuration.gateway..update(*args)
end

.update!(*args) ⇒ Object



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

def self.update!(*args)
  Configuration.gateway..update!(*args)
end

Instance Method Details

#inspectObject



68
69
70
71
72
73
74
# File 'lib/braintree/merchant_account.rb', line 68

def inspect
  order = [:id, :status, :master_merchant_account]
  nice_attributes = order.map do |attr|
    "#{attr}: #{send(attr).inspect}"
  end
  "#<#{self.class}: #{nice_attributes.join(', ')}>"
end