module Helpers::Accessor
Public Instance Methods
get_by_key(key, hash)
click to toggle source
# File lib/lime_light_platform/helpers/accessor.rb, line 17 def get_by_key key, hash hash[key] end
get_if_exists(key, hash, default='')
click to toggle source
# File lib/lime_light_platform/helpers/accessor.rb, line 3 def get_if_exists key, hash, default='' value = default if !hash[key].nil? value = hash[key] end value end
get_response_code(hash={})
click to toggle source
# File lib/lime_light_platform/helpers/accessor.rb, line 33 def get_response_code hash={} response_code = '' if key_exists 'response_code', hash response_code = hash['response_code'] elsif key_exists 'responseCode', hash response_code = hash['responseCode'] elsif key_exists 'response', hash response_code = hash['response'] end response_code end
key_exists(key, hash)
click to toggle source
# File lib/lime_light_platform/helpers/accessor.rb, line 13 def key_exists key, hash !hash[key].nil? end
map_param_if_exist(param_map, request, body={})
click to toggle source
# File lib/lime_light_platform/helpers/accessor.rb, line 21 def map_param_if_exist param_map, request, body={} param_map.each do |key, mapped_key| str_mapped_key = key.to_s if key_exists(str_mapped_key, request) body[mapped_key] = request[str_mapped_key] end end body end