Class: Apruve::CorporateAccount

Inherits:
ApruveObject show all
Defined in:
lib/apruve/resources/corporate_account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from ApruveObject

#initialize, logger, #logger, #to_hash, #to_json, #validate

Constructor Details

This class inherits a constructor from Apruve::ApruveObject

Instance Attribute Details

#authorized_buyersObject

Returns the value of attribute authorized_buyers.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def authorized_buyers
  @authorized_buyers
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def created_at
  @created_at
end

#credit_amount_centsObject

Returns the value of attribute credit_amount_cents.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def credit_amount_cents
  @credit_amount_cents
end

#credit_available_centsObject

Returns the value of attribute credit_available_cents.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def credit_available_cents
  @credit_available_cents
end

#credit_balance_centsObject

Returns the value of attribute credit_balance_cents.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def credit_balance_cents
  @credit_balance_cents
end

#creditor_term_idObject

Returns the value of attribute creditor_term_id.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def creditor_term_id
  @creditor_term_id
end

#customer_uuidObject

Returns the value of attribute customer_uuid.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def customer_uuid
  @customer_uuid
end

#disabled_atObject

Returns the value of attribute disabled_at.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def disabled_at
  @disabled_at
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def id
  @id
end

#merchant_uuidObject

Returns the value of attribute merchant_uuid.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def merchant_uuid
  @merchant_uuid
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def name
  @name
end

#payment_method_idObject

Returns the value of attribute payment_method_id.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def payment_method_id
  @payment_method_id
end

#payment_term_strategy_nameObject

Returns the value of attribute payment_term_strategy_name.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def payment_term_strategy_name
  @payment_term_strategy_name
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def status
  @status
end

#trusted_merchantObject

Returns the value of attribute trusted_merchant.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def trusted_merchant
  @trusted_merchant
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/apruve/resources/corporate_account.rb', line 3

def updated_at
  @updated_at
end

Class Method Details

.find(merchant_id, email = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/apruve/resources/corporate_account.rb', line 7

def self.find(merchant_id, email=nil)
  if email.nil?
    return find_all(merchant_id)
  end
  email = CGI::escape(email)
  response = Apruve.get("merchants/#{merchant_id}/corporate_accounts?email=#{email}")
  CorporateAccount.new(response.body.empty? ? {} : response.body[0])
end

.find_all(merchant_id) ⇒ Object



16
17
18
19
# File 'lib/apruve/resources/corporate_account.rb', line 16

def self.find_all(merchant_id)
  response = Apruve.get("merchants/#{merchant_id}/corporate_accounts")
  response.body.map { |ca| CorporateAccount.new(ca.empty? ? {} : ca) }
end

.find_by_uuid(merchant_id, uuid) ⇒ Object



21
22
23
24
# File 'lib/apruve/resources/corporate_account.rb', line 21

def self.find_by_uuid(merchant_id, uuid)
  response = Apruve.get("merchants/#{merchant_id}/corporate_accounts/#{uuid}")
  CorporateAccount.new response.body
end