class MockChargebee::Models::Customer

Constants

RESOURCE_ID_PREFIX

Public Class Methods

already_exists?(id) click to toggle source
# File lib/mock_chargebee/models/customer.rb, line 39
def self.already_exists?(id)
  return false if id.nil?

  repositories.customers[id].present?
end
create(params) click to toggle source
# File lib/mock_chargebee/models/customer.rb, line 14
def self.create(params)
  already_exists!(params['id']) if already_exists?(params['id'])

  params['id'] ||= unique_id
  customer = customer_fixture.merge(params)
  repositories.customers.store(customer['id'], customer)

  customer
end
delete(id) click to toggle source
# File lib/mock_chargebee/models/customer.rb, line 32
def self.delete(id)
  customer = find(id)
  repositories.customers.delete(id)

  customer
end
find(id) click to toggle source
# File lib/mock_chargebee/models/customer.rb, line 10
def self.find(id)
  repositories.customers.fetch(id)
end
update(id, params) click to toggle source
# File lib/mock_chargebee/models/customer.rb, line 24
def self.update(id, params)
  customer = find(id)
  customer.merge!(params)
  repositories.customers.store(customer['id'], customer)

  customer
end