Sha256: 9504c6ede1df7be838384b4922e8cb82c25d420378f6e3fa57e80f6e6ae4601a

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module FakePin
  class Customer
    def self.create(params)
      new(params).create
    end

    def initialize(params)
      @params = params
    end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_pin-0.2 lib/fake_pin/customer.rb
fake_pin-0.0.1 lib/fake_pin/customer.rb