Class: Everytime::Resource
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Everytime::Resource
show all
- Defined in:
- lib/everytime.rb
Constant Summary
collapse
- API_ROOT =
"/api/v1"
Class Method Summary
collapse
Class Method Details
.all(options = {}) ⇒ Object
30
31
32
|
# File 'lib/everytime.rb', line 30
def self.all(options = {})
find(:all, options)
end
|
.check_prefix_options(options) ⇒ Object
22
23
|
# File 'lib/everytime.rb', line 22
def self.check_prefix_options(options)
end
|
.first(options = {}) ⇒ Object
34
35
36
|
# File 'lib/everytime.rb', line 34
def self.first(options = {})
find(:first, options)
end
|
.last(options = {}) ⇒ Object
38
39
40
|
# File 'lib/everytime.rb', line 38
def self.last(options = {})
find(:last, options)
end
|
.parent_resource(parent) ⇒ Object
14
15
16
|
# File 'lib/everytime.rb', line 14
def self.parent_resource(parent)
@parent_resource = parent
end
|
.prefix(options = {}) ⇒ Object
25
26
27
28
|
# File 'lib/everytime.rb', line 25
def self.prefix(options = {})
args = options.any? ? options.map { |name, value| "/#{name.to_s.chomp('_id').pluralize}/#{value}" }.join : ""
API_ROOT + args + "/"
end
|
.prefix_options ⇒ Object
42
43
44
|
# File 'lib/everytime.rb', line 42
def self.prefix_options
id ? {} : super
end
|
.prefix_source ⇒ Object
18
19
20
|
# File 'lib/everytime.rb', line 18
def self.prefix_source
API_ROOT + "/" + ( @parent_resource ? "#{@parent_resource.to_s.pluralize}/:#{@parent_resource}_id" : "" )
end
|