Class: Lockme::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lockme/base.rb

Overview

Base class for all LockMe API objects

Direct Known Subclasses

Reservation, Room

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.base_pathObject (readonly)

Returns the value of attribute base_path.



8
9
10
# File 'lib/lockme/base.rb', line 8

def base_path
  @base_path
end

Class Method Details

.collection_pathObject



27
28
29
# File 'lib/lockme/base.rb', line 27

def self.collection_path
  base_path
end

.singular_path(id) ⇒ Object



23
24
25
# File 'lib/lockme/base.rb', line 23

def self.singular_path(id)
  [base_path, id].join('/')
end

Instance Method Details

#collection_pathObject



19
20
21
# File 'lib/lockme/base.rb', line 19

def collection_path
  self.class.collection_path
end

#persisted?Boolean

Check if object is persisted with Lockme

Returns:



11
12
13
# File 'lib/lockme/base.rb', line 11

def persisted?
  !id.nil?
end

#singular_pathObject



15
16
17
# File 'lib/lockme/base.rb', line 15

def singular_path
  self.class.singular_path(id)
end