lib/rock_rms/response/base.rb in rock_rms-7.0.2 vs lib/rock_rms/response/base.rb in rock_rms-7.0.3
- old
+ new
@@ -1,10 +1,16 @@
module RockRMS
module Response
class Base
attr_reader :data
+ BASE_MAPPING = {
+ id: 'Id',
+ created_date_time: 'CreatedDateTime',
+ modified_date_time: 'ModifiedDateTime'
+ }.freeze
+
def self.format(data)
new(data).format
end
def initialize(data)
@@ -20,12 +26,14 @@
end
def to_h(dict, data)
return {} if data.nil?
- dict.each_with_object({}) do |(l, r), object|
- object[l] = data[r]
- end
+ dict
+ .merge(BASE_MAPPING)
+ .each_with_object({}) do |(l, r), object|
+ object[l] = data[r]
+ end
end
end
end
end