lib/sportradar/api/soccer/player.rb in sportradar-api-0.1.14 vs lib/sportradar/api/soccer/player.rb in sportradar-api-0.1.15

- old
+ new

@@ -67,17 +67,21 @@ tactical_positions = { "0" => "Unknown", "1" => "Goalkeeper", "2" => "Right back", "3" => "Central defender", "4" => "Left back", "5" => "Right winger", "6" => "Central midfielder", "7" => "Left winger", "8" => "Forward" } tactical_positions[tactical_position] if tactical_position end def get_age - now = Time.now.utc.to_date - dob = birthdate.to_date - now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1) + if birthdate.present? + now = Time.now.utc.to_date + dob = birthdate.to_date + now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1) + end end def get_height_ft - feet, inches = height_in.to_i.divmod(12) - "#{feet}' #{inches}\"" + if height_in.present? + feet, inches = height_in.to_i.divmod(12) + "#{feet}' #{inches}\"" + end end private def set_teams