Module: Holoserve::Interface::Control::Helper
- Included in:
- Bucket::Delete, Bucket::Fetch, Holoserve::Interface::Control::History::Delete, Holoserve::Interface::Control::History::Fetch, Index::Fetch, Pair::Fetch, Pair::Index, State::Delete, State::Fetch, State::Update
- Defined in:
- lib/holoserve/interface/control.rb
Instance Method Summary collapse
- #bad_request ⇒ Object
- #bucket ⇒ Object
- #history ⇒ Object
- #not_found ⇒ Object
- #ok(content, content_type = "text/plain") ⇒ Object
- #pairs ⇒ Object
- #respond_json(object) ⇒ Object
- #respond_json_acknowledgement ⇒ Object
- #state ⇒ Object
Instance Method Details
#bad_request ⇒ Object
25 26 27 |
# File 'lib/holoserve/interface/control.rb', line 25 def bad_request [ 400, { }, [ "bad request" ] ] end |
#bucket ⇒ Object
33 34 35 |
# File 'lib/holoserve/interface/control.rb', line 33 def bucket config[:bucket] ||= [ ] end |
#history ⇒ Object
37 38 39 |
# File 'lib/holoserve/interface/control.rb', line 37 def history config[:history] ||= [ ] end |
#not_found ⇒ Object
29 30 31 |
# File 'lib/holoserve/interface/control.rb', line 29 def not_found [ 404, { }, [ "not found" ] ] end |
#ok(content, content_type = "text/plain") ⇒ Object
21 22 23 |
# File 'lib/holoserve/interface/control.rb', line 21 def ok(content, content_type = "text/plain") [ 200, { "Content-Type" => content_type }, [ content ] ] end |
#pairs ⇒ Object
41 42 43 |
# File 'lib/holoserve/interface/control.rb', line 41 def pairs config[:pairs] ||= [:pairs] end |
#respond_json(object) ⇒ Object
17 18 19 |
# File 'lib/holoserve/interface/control.rb', line 17 def respond_json(object) ok JSON.dump(object), "application/json" end |
#respond_json_acknowledgement ⇒ Object
13 14 15 |
# File 'lib/holoserve/interface/control.rb', line 13 def respond_json_acknowledgement respond_json :ok => true end |
#state ⇒ Object
45 46 47 |
# File 'lib/holoserve/interface/control.rb', line 45 def state config[:state] ||= { } end |