Blame view

lib/syspro/singleton_api_resource.rb 562 Bytes
db76748d   Isaac Lewis   cop a bunch of St...
1
2
3
4
5
6
7
8
  require_relative "api_resource"
  
  module Syspro
    class SingletonAPIResource < ApiResource
      def self.resource_url
        if self == SingletonAPIResource
          raise NotImplementedError, "SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Customer, etc.)"
        end
3d0157a5   Isaac Lewis   add logoff
9
        "/#{CGI.escape(class_name.downcase)}"
db76748d   Isaac Lewis   cop a bunch of St...
10
11
12
13
14
15
16
17
18
19
20
21
22
      end
  
      def resource_url
        self.class.resource_url
      end
  
      def self.retrieve(opts = {})
        instance = new(nil, Util.normalize_opts(opts))
        instance.refresh
        instance
      end
    end
  end