Method: RunSignup::DataCoercion#coerce_from_api

Defined in:
lib/run_signup/data_coercion.rb

#coerce_from_api(hash) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/run_signup/data_coercion.rb', line 4

def coerce_from_api hash
  if hash
    hash.each do |k, v|
      hash[k] = coerce_value_from_api v
      if k == 'events'
        hash[k] = hash[k].map { |event| RunSignup::Event.new(event) }
      end
    end
  end
  hash
end