Sha256: 985dae19b49fdbbbdea89f59e7fb77ba2d1390dd3bf10a139521f9aee6437e5d

Contents?: true

Size: 507 Bytes

Versions: 6

Compression:

Stored size: 507 Bytes

Contents

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

    def api_url
      self.class.api_url
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paid-0.1.0 lib/paid/singleton_api_resource.rb
paid-0.0.8 lib/paid/singleton_api_resource.rb
paid-0.0.7 lib/paid/singleton_api_resource.rb
paid-0.0.6 lib/paid/singleton_api_resource.rb
paid-0.0.5 lib/paid/singleton_api_resource.rb
paid-0.0.4 lib/paid/singleton_api_resource.rb