Module: MosEisley::Helper
- Defined in:
- lib/http-server/helper.rb
Instance Method Summary collapse
-
#json_with_object(obj, pretty: true, opts: nil) ⇒ String
Convert object into JSON, optionally pretty-format.
- #logger ⇒ Object
- #parse_command(params) ⇒ Object
-
#parse_json(json) ⇒ Object
Parse JSON to Hash with key symbolization by default.
- #valid_token?(token) ⇒ Boolean
Instance Method Details
#json_with_object(obj, pretty: true, opts: nil) ⇒ String
Convert object into JSON, optionally pretty-format
28 29 30 |
# File 'lib/http-server/helper.rb', line 28 def json_with_object(obj, pretty: true, opts: nil) MosEisley::S3PO.json_with_object(obj, pretty: pretty, opts: opts) end |
#parse_command(params) ⇒ Object
9 10 11 12 13 |
# File 'lib/http-server/helper.rb', line 9 def parse_command(params) cmd = {} params.each { |k, v| cmd[k.to_sym] = v } return cmd end |
#parse_json(json) ⇒ Object
Parse JSON to Hash with key symbolization by default
16 17 18 |
# File 'lib/http-server/helper.rb', line 16 def parse_json(json) MosEisley::S3PO.parse_json(json) end |
#valid_token?(token) ⇒ Boolean
20 21 22 |
# File 'lib/http-server/helper.rb', line 20 def valid_token?(token) token == Config.shared.verification_token end |