Class: Saaz::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/saaz/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#customer_resource_classObject

Returns the value of attribute customer_resource_class.



2
3
4
# File 'lib/saaz/configuration.rb', line 2

def customer_resource_class
  @customer_resource_class
end

#plansObject

Returns the value of attribute plans.



2
3
4
# File 'lib/saaz/configuration.rb', line 2

def plans
  @plans
end

#publishable_keyObject

Returns the value of attribute publishable_key.



2
3
4
# File 'lib/saaz/configuration.rb', line 2

def publishable_key
  @publishable_key
end

Instance Method Details

#api_keyObject



8
9
10
# File 'lib/saaz/configuration.rb', line 8

def api_key
  Stripe.api_key
end

#api_key=(v) ⇒ Object



4
5
6
# File 'lib/saaz/configuration.rb', line 4

def api_key=(v)
  Stripe.api_key = v
end

#find_or_create_plansObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/saaz/configuration.rb', line 20

def find_or_create_plans
  plans.each do |key, plan_params|
    begin
      Stripe::Plan.retrieve(key.to_s)
    rescue Stripe::InvalidRequestError # Plan does not exist
      plan_params[:id] ||= key.to_s
      Stripe::Plan.create plan_params
    end
  end
end