Class: ActionService::Base
- Inherits:
-
Object
- Object
- ActionService::Base
- Defined in:
- lib/action_service/base.rb
Overview
Action Service objects implement an exported API. Used in controllers operating in Delegated dispatching mode.
An ActionService::Base derivative is the public interface of an API.
Example
class SearchCriteria < ActionStruct::Base
member :firstname, String
member :lastname, String
member :email, String
end
class PersonApi < ActionService::Base
def find_person(criteria)
Person.find_all [...]
end
def delete_person(id)
Person.find_by_id(id).destroy
end
export :find_person, :expects => [SearchCriteria], :returns => [[Person]]
export :delete_person, :expects => [Integer]
end
See ActionService::Exporting::ClassMethods for more details on the syntax for declaring exported methods.