Class: FakePin::Customer
- Inherits:
-
Object
- Object
- FakePin::Customer
- Defined in:
- lib/fake_pin/customer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(params) ⇒ Customer
constructor
A new instance of Customer.
Constructor Details
#initialize(params) ⇒ Customer
Returns a new instance of Customer.
7 8 9 |
# File 'lib/fake_pin/customer.rb', line 7 def initialize(params) @params = params end |
Class Method Details
.create(params) ⇒ Object
3 4 5 |
# File 'lib/fake_pin/customer.rb', line 3 def self.create(params) new(params).create end |
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fake_pin/customer.rb', line 11 def create card = @params['card'] @params.require(:email, :card => Card::REQUIRED_PARAMS) if card.present? response = { "token" => Token.generate('cus'), "email" => @params['email'], "created_at" => Time.now.to_s } response['card'] = Card.create(card) if card.present? response end |