Sha256: cab98d4cba3c71d85945735564a832223f5528adc45b1ea4e1840fa3a1b1bd45

Contents?: true

Size: 977 Bytes

Versions: 1

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

module SlackRubyBotServer
  module Stripe
    module Config
      extend self

      attr_reader :stripe_api_key

      def stripe_api_key=(value)
        @stripe_api_key = value
        ::Stripe.api_key = value
      end

      attr_accessor :stripe_api_publishable_key
      attr_accessor :subscription_plan_id
      attr_accessor :subscription_plan_amount
      attr_accessor :trial_duration
      attr_accessor :root_url

      def reset!
        self.stripe_api_publishable_key = ENV['STRIPE_API_PUBLISHABLE_KEY']
        self.stripe_api_key = ENV['STRIPE_API_KEY']
        self.subscription_plan_id = ENV['STRIPE_SUBSCRIPTION_PLAN_ID']
        self.subscription_plan_amount = -1
        self.root_url = ENV['URL']
        self.trial_duration = 2.weeks
      end

      reset!
    end

    class << self
      def configure
        block_given? ? yield(Config) : Config
      end

      def config
        Config
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack-ruby-bot-server-stripe-0.2.0 lib/slack-ruby-bot-server-stripe/config.rb