module MosEisley::Helper
Public Instance Methods
json_with_object(obj, pretty: true, opts: nil)
click to toggle source
Convert object into JSON, optionally pretty-format @param obj [Object] any Ruby object @param opts [Hash] any JSON options @return [String] JSON string
# 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
logger()
click to toggle source
# File lib/http-server/helper.rb, line 5 def logger MosEisley.logger end
parse_command(params)
click to toggle source
# 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)
click to toggle source
Parse JSON to Hash with key symbolization by default
# File lib/http-server/helper.rb, line 16 def parse_json(json) MosEisley::S3PO.parse_json(json) end
valid_token?(token)
click to toggle source
# File lib/http-server/helper.rb, line 20 def valid_token?(token) token == Config.shared.verification_token end