Class: Mooset::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/mooset/model.rb

Direct Known Subclasses

Mooset::Models::Group, Mooset::Models::User

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Model

Returns a new instance of Model.



14
15
16
17
18
19
# File 'lib/mooset/model.rb', line 14

def initialize(*args)
  hash = args[0] || {}
  @endpoint = hash.delete(:endpoint)

  super(*args)
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



5
6
7
# File 'lib/mooset/model.rb', line 5

def endpoint
  @endpoint
end

Class Method Details

.finders(finder_list) ⇒ Object



8
9
10
11
12
# File 'lib/mooset/model.rb', line 8

def self.finders(finder_list)
  define_method :finders do
    finder_list
  end
end

Instance Method Details

#findersObject



25
26
27
# File 'lib/mooset/model.rb', line 25

def finders
  []
end

#to_json(*args) ⇒ Object



21
22
23
# File 'lib/mooset/model.rb', line 21

def to_json(*args)
  attributes.to_json
end

#to_sObject



29
30
31
# File 'lib/mooset/model.rb', line 29

def to_s
  "#{self.class.name.split('::').last}[#{provider}]"
end