Module: Safrano::MethodHandlers
- Included in:
- Request
- Defined in:
- lib/safrano/request.rb
Overview
handle GET PUT etc
Instance Method Summary collapse
- #odata_delete ⇒ Object
- #odata_get ⇒ Object
- #odata_head ⇒ Object
- #odata_options ⇒ Object
- #odata_patch ⇒ Object
- #odata_post ⇒ Object
- #odata_put ⇒ Object
Instance Method Details
#odata_delete ⇒ Object
22 23 24 25 |
# File 'lib/safrano/request.rb', line 22 def odata_delete @walker.finalize.tap_error { |err| return err.odata_get(self) } .if_valid { |context| context.odata_delete(self) } end |
#odata_get ⇒ Object
37 38 39 40 |
# File 'lib/safrano/request.rb', line 37 def odata_get @walker.finalize.tap_error { |err| return err.odata_get(self) } .if_valid { |context| context.odata_get(self) } end |
#odata_head ⇒ Object
47 48 49 |
# File 'lib/safrano/request.rb', line 47 def odata_head [200, EMPTY_HASH, [EMPTY_STRING]] end |
#odata_options ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/safrano/request.rb', line 9 def # cf. stackoverflow.com/questions/22924678/sinatra-delete-response-headers headers.delete('Content-Type') @response.headers.delete('Content-Type') @response.headers['Content-Type'] = '' # we only let rack-cors handle Cors OPTIONS . # otherwise dont do it... # see https://www.mnot.net/blog/2012/10/29/NO_OPTIONS # 501 not implemented [501, EMPTY_HASH, ''] end |
#odata_patch ⇒ Object
32 33 34 35 |
# File 'lib/safrano/request.rb', line 32 def odata_patch @walker.finalize.tap_error { |err| return err.odata_get(self) } .if_valid { |context| context.odata_patch(self) } end |
#odata_post ⇒ Object
42 43 44 45 |
# File 'lib/safrano/request.rb', line 42 def odata_post @walker.finalize.tap_error { |err| return err.odata_get(self) } .if_valid { |context| context.odata_post(self) } end |
#odata_put ⇒ Object
27 28 29 30 |
# File 'lib/safrano/request.rb', line 27 def odata_put @walker.finalize.tap_error { |err| return err.odata_get(self) } .if_valid { |context| context.odata_put(self) } end |