Class: Billomat::SingletonBase

Inherits:
Base
  • Object
show all
Includes:
ResourceWithoutId
Defined in:
lib/billomat-rb.rb

Direct Known Subclasses

ReadOnlySingletonBase, Settings

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ResourceWithoutId

#save

Methods inherited from Base

coll_p, el_p, inherited

Class Method Details

.allObject

Prevent collection methods

Raises:



202
203
204
# File 'lib/billomat-rb.rb', line 202

def self.all
  raise MethodNotAvailable, "Method not supported on #{self.class.name}"
end

.collection_nameObject



169
170
171
# File 'lib/billomat-rb.rb', line 169

def collection_name
  element_name
end

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object



178
179
180
181
# File 'lib/billomat-rb.rb', line 178

def collection_path(prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object



173
174
175
176
# File 'lib/billomat-rb.rb', line 173

def element_path(id,prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end

.firstObject



190
191
192
# File 'lib/billomat-rb.rb', line 190

def self.first
  self.find
end

.lastObject



194
195
196
# File 'lib/billomat-rb.rb', line 194

def self.last
  self.find
end

Instance Method Details

#findObject Also known as: first, last



184
185
186
187
188
# File 'lib/billomat-rb.rb', line 184

def find
  # TODO: Fetch whether ids where given or not
  # and get the wanted one in those cases
  super(1)
end