Class: Mite::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Mite::Base
- Defined in:
- lib/mite-rb.rb
Class Method Summary collapse
-
.all(options = {}) ⇒ Object
Common shortcuts known from ActiveRecord.
- .first(options = {}) ⇒ Object
- .inherited(base) ⇒ Object
- .last(options = {}) ⇒ Object
-
.undo_destroy(id) ⇒ Object
Undo destroy action on the resource with the ID in the
id
parameter.
Instance Method Summary collapse
-
#undo_destroy ⇒ Object
Undo destroy action.
Class Method Details
.all(options = {}) ⇒ Object
Common shortcuts known from ActiveRecord
67 68 69 |
# File 'lib/mite-rb.rb', line 67 def all(={}) find_every() end |
.first(options = {}) ⇒ Object
71 72 73 |
# File 'lib/mite-rb.rb', line 71 def first(={}) find_every().first end |
.inherited(base) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/mite-rb.rb', line 56 def inherited(base) Mite.resources << base class << base attr_accessor :site_format end base.site_format = '%s' base.timeout = 20 super end |
.last(options = {}) ⇒ Object
75 76 77 |
# File 'lib/mite-rb.rb', line 75 def last(={}) find_every().last end |
.undo_destroy(id) ⇒ Object
Undo destroy action on the resource with the ID in the id
parameter.
80 81 82 |
# File 'lib/mite-rb.rb', line 80 def undo_destroy(id) returning(self.new(:id => id)) { |res| res.undo_destroy } end |
Instance Method Details
#undo_destroy ⇒ Object
Undo destroy action.
86 87 88 89 90 91 92 |
# File 'lib/mite-rb.rb', line 86 def undo_destroy path = element_path().sub(/\.([\w]+)/, '/undo_delete.\1') returning connection.post(path, "", self.class.headers) do |response| load_attributes_from_response(response) end end |