Class: RSpecStripe::Factory::Plan
- Inherits:
-
Struct
- Object
- Struct
- RSpecStripe::Factory::Plan
- Defined in:
- lib/rspec-stripe/factories/plan.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/rspec-stripe/factories/plan.rb', line 2 def id @id end |
Instance Method Details
#cleanup ⇒ Object
20 21 22 |
# File 'lib/rspec-stripe/factories/plan.rb', line 20 def cleanup get.delete if @should_delete end |
#get ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rspec-stripe/factories/plan.rb', line 3 def get @get ||= begin @should_delete = false Stripe::Plan.retrieve(id.to_s) rescue Stripe::InvalidRequestError @should_delete = true # Lookup the plan's details and then create it Stripe::Plan.create( amount: 2000, interval: 'month', name: 'Amazing Gold Plan', currency: 'usd', id: id.to_s ) end end |