Class: VaucharAPI::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- VaucharAPI::Base
show all
- Defined in:
- lib/vauchar_api/resources/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.init_prefix(resource) ⇒ Object
26
27
28
|
# File 'lib/vauchar_api/resources/base.rb', line 26
def init_prefix(resource)
init_prefix_explicit(resource.to_s.pluralize, "#{resource}_id")
end
|
.init_prefix_explicit(resource_type, resource_id) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/vauchar_api/resources/base.rb', line 30
def init_prefix_explicit(resource_type, resource_id)
self.prefix = "/#{resource_type}/:#{resource_id}/"
define_method resource_id.to_sym do
@prefix_options[resource_id]
end
end
|
Instance Method Details
#accepts_attributes ⇒ Object
9
|
# File 'lib/vauchar_api/resources/base.rb', line 9
def accepts_attributes; nil; end
|
#encode(options = {}) ⇒ Object
11
12
13
14
15
|
# File 'lib/vauchar_api/resources/base.rb', line 11
def encode(options = {})
same = dup
same.attributes = same.attributes.slice(*accepts_attributes) if (accepts_attributes)
same.send("to_#{self.class.format.extension}", options)
end
|