Class: TresDelta::Customer
- Inherits:
-
Object
- Object
- TresDelta::Customer
- Defined in:
- lib/tres_delta/customer.rb
Defined Under Namespace
Classes: InvalidCustomer
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Customer
constructor
A new instance of Customer.
- #vault_key ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Customer
Returns a new instance of Customer.
5 6 7 8 |
# File 'lib/tres_delta/customer.rb', line 5 def initialize(params = {}) @vault_key = params[:vault_key] || nil @name = params[:name] || nil end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/tres_delta/customer.rb', line 3 def name @name end |
Class Method Details
.create(params = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/tres_delta/customer.rb', line 15 def create(params = {}) Customer.new(params).tap do |customer| unless Vault.create_customer(customer).success? raise InvalidCustomer end end end |
Instance Method Details
#vault_key ⇒ Object
10 11 12 |
# File 'lib/tres_delta/customer.rb', line 10 def vault_key @vault_key ||= SecureRandom.hex(12) end |