Class: RSpecStripe::Factory::Customer

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec-stripe/factories/customer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/rspec-stripe/factories/customer.rb', line 2

def id
  @id
end

Instance Method Details

#cleanupObject



15
16
17
# File 'lib/rspec-stripe/factories/customer.rb', line 15

def cleanup
  get.delete if @should_delete
end

#getObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rspec-stripe/factories/customer.rb', line 3

def get
  @get ||= begin
    if id == :new || id == true
      @should_delete = true
      Stripe::Customer.create
    else
      @should_delete = false
      Stripe::Customer.retrieve(id)
    end
  end
end