Class: Restfulie::Client::Feature::FollowRequest
- Inherits:
-
Object
- Object
- Restfulie::Client::Feature::FollowRequest
- Defined in:
- lib/restfulie/client/feature/follow_request.rb
Overview
FollowLink follow new location of a document usually with response codes 201,301,302,303 and 307. You can also configure other codes.
Example:
@executor.at(‘/custom/songs’).accepts(‘application/atom+xml’).follow(201).post!(“custom”).code
Instance Method Summary collapse
Instance Method Details
#execute(flow, request, env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/restfulie/client/feature/follow_request.rb', line 15 def execute(flow, request, env) resp = flow.continue(request, env) if !resp.respond_to?(:code) return resp end if should_follow?(resp) follow_this resp, request else resp end end |
#follow(code = nil) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/restfulie/client/feature/follow_request.rb', line 8 def follow(code = nil) unless code.nil? or follow_codes.include?(code) follow_codes << code end self end |