Class: Toast::CollectionRequest
- Inherits:
-
Object
- Object
- Toast::CollectionRequest
- Includes:
- Errors, RequestHelpers
- Defined in:
- lib/toast/collection_request.rb
Instance Method Summary collapse
-
#initialize(config, base_config, auth, request) ⇒ CollectionRequest
constructor
A new instance of CollectionRequest.
- #respond ⇒ Object
Methods included from RequestHelpers
#allowed_methods, #attr_selected?, #base_uri, #call_allow, #call_handler, #get_config, #is_active_record?, #represent, #represent_one, #response, #split_link_header
Constructor Details
#initialize(config, base_config, auth, request) ⇒ CollectionRequest
Returns a new instance of CollectionRequest.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/toast/collection_request.rb', line 8 def initialize config, base_config, auth, request @config = config @base_config = base_config @base_uri = base_uri(request) @verb = request.request_method.downcase @requested_range = Toast::HttpRange.new(request.env['HTTP_RANGE']) @selected_attributes = request.query_parameters[:toast_select].try(:split,/ *, */) @uri_params = request.query_parameters @auth = auth @request = request end |
Instance Method Details
#respond ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/toast/collection_request.rb', line 20 def respond if @verb.in? %w(get post) self.send(@verb) else response :method_not_allowed, headers: {'Allow' => allowed_methods(@base_config)}, msg: "method #{@verb.upcase} not supported for collection URIs" end end |