Sha256: 4003d6bcb237a48bb7a51402a3698b2db8783643950eda5af0c4751b98f4961c

Contents?: true

Size: 499 Bytes

Versions: 22

Compression:

Stored size: 499 Bytes

Contents

module Stripe
  class SingletonAPIResource < APIResource
    def self.url()
      if self == SingletonAPIResource
        raise NotImplementedError.new('SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Account, etc.)')
      end
      "/v1/#{CGI.escape(class_name.downcase)}"
    end

    def url
      self.class.url
    end

    def self.retrieve(api_key=nil)
      instance = self.new(nil, api_key)
      instance.refresh
      instance
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
stripe-1.16.0 lib/stripe/singleton_api_resource.rb
stripe-1.15.0 lib/stripe/singleton_api_resource.rb
stripe-1.14.0 lib/stripe/singleton_api_resource.rb
stripe-1.13.0 lib/stripe/singleton_api_resource.rb
stripe-1.12.0 lib/stripe/singleton_api_resource.rb
stripe-1.11.0 lib/stripe/singleton_api_resource.rb
stripe-1.10.1 lib/stripe/singleton_api_resource.rb
stripe-1.10.0 lib/stripe/singleton_api_resource.rb
stripe-1.9.9 lib/stripe/singleton_api_resource.rb
stripe-1.8.8 lib/stripe/singleton_api_resource.rb
stripe-1.8.7 lib/stripe/singleton_api_resource.rb
stripe-1.8.6 lib/stripe/singleton_api_resource.rb
stripe-1.8.5 lib/stripe/singleton_api_resource.rb
stripe-1.8.4 lib/stripe/singleton_api_resource.rb
stripe-1.8.3 lib/stripe/singleton_api_resource.rb
stripe-1.8.2 lib/stripe/singleton_api_resource.rb
stripe-1.8.1 lib/stripe/singleton_api_resource.rb
stripe-1.7.11 lib/stripe/singleton_api_resource.rb
stripe-1.7.10 lib/stripe/singleton_api_resource.rb
stripe-1.7.9 lib/stripe/singleton_api_resource.rb