Sha256: 3cefa0fc0f3fc4b8eb27e1d51a0369e1b3c19321c98d81ba9ded9521f3fd2818

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 Bytes

Contents

module Conekta
  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
      "/#{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

3 entries across 3 versions & 1 rubygems

Version Path
conekta-0.3.3 lib/conekta/singleton_api_resource.rb
conekta-0.3.1 lib/conekta/singleton_api_resource.rb
conekta-0.3.0 lib/conekta/singleton_api_resource.rb